Possible Alternative Simplified Interfaces

<<<< ^^^^^ >>>>

  • First there was DBD::Chart and now... DBD::FTP!

use DBD::FTP;

my $dbh = DBI->connect(\%common_cfg, %netftp_config);

my $sth = $dbh->do('SELECT file FROM "ftp://anonymous@gatekeeper.dec.com:/pub/gnu" WHERE file LIKE "%.jpg"'); my $sth = $dbh->do('SELECT file FROM "ftp://anonymous@gatekeeper.dec.com:/pub/gnu" WHERE extension = "jpg" or extension = "jpeg"'); my $sth = $dbh->do('SELECT file FROM "ftp://anonymous@gatekeeper.dec.com:/pub/gnu" WHERE file_type = "D"'); my $sth = $dbh->do('SELECT file_name FROM ftpsite WHERE file_type = "directory" and dir = "pub/gnu" and site="gatekeeper.dec.com"'); my $sth = $dbh->prepare('SELECT file_data FROM ftpsite WHERE file_type = "directory" and dir = "pub/gnu" and site="gatekeeper.dec.com" file_name="wo.doc"');

  • Tie::FTP

tie @cpan, 'Tie::FTP', 'ftp.cpan.org', 'pub/authors/LWALL';
print "dir contents: @cpan";
 # .. but how to change dirs?
 # .. upload? ah....
push @cpan, 'new_cool_ware.pl';
 # .. how to distinguish files from dirs?

  • Tie::FTP::Hash

tie $cpan, 'Tie::FTP', 'ftp.cpan.org';
 # cd and list files:
@files = $cpan->{pub}{authors}{LWALL}->list;
 # upload to directory
$cpan->{pub}{authors}{LWALL}->push('new_file');
 # .. hmmm, not bad
$cpan->{pub}{authors}{LWALL}{nntp.pl}->rename('ice_news.pm');
 # .. but mapping over many hosts would require a new tie each time .. FEH!
 # .. that's a hard to grok cd syntax.