***** infoCopter.com/perl *****

Internet Programming



Internet Programming with Perl

Reference Title Sample Code
R1019Base64 Encoding / Decoding require MIME::Base64;

# ----- Decoding -----
$Enc = 'bXl1c2VyOm15cGFzcw==';

print "$Enc\n" . MIME::Base64::decode($Enc) . "\n\n";


# ----- Encoding -----
R1034FTP command line client with Net::FTP #!/usr/local/bin/perl -w

#=========================================================
# Script :        ftp.pl
#
# Brief Desc :        Fetches data from a ftp host
#<...
R1011Get Cookies
#!/usr/bin/perl
use strict;

my %cookie;

&get_cookie;

print "Content-type: text/html\n\n";

print qq~
Values of Cooki...
R1044Get data from a webserver without using LWP #!/usr/local/bin/perl -w

use Socket;

if (open_TCP(F, 'www.zh1.ch', 80) == undef) {
        print "Error";
   &nb...
R1020LWP & HTTP - Post Data #!/usr/bin/perl

use strict;
use LWP::UserAgent;
use HTTP::Request::Common;

&upload;

sub upload {

        my $ua =...
R1018LWP Sample #!/usr/bin/perl

use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new(agent => "$ENV{'SCRIPT_NAME'} V$VERSION");

my $request = HTTP::Request->new('GET', 'ht...
R1026Net::FTP use Net::FTP;

$ftp = Net::FTP->new("some.host.name");
$ftp->login("anonymous","me@here.there");
$ftp->cwd("/pub");
$ftp->get("that.file");
$ftp-...
R1055Parsing HTML See Link!
R1016Replace all HTML tags in a page line $Elems[$i] =~ s/<[^>]*>//g; # Remove HTML tags
R1012Set Cookies #!/usr/bin/perl
use strict;

# works on IE _and_ NC !!
# -----------------------

my $expires; # global variable


&createExpiryDate(86400); # Create expiry date 24h from no...
R1021Upload a file from Perl #!/usr/bin/perl

use strict;
use LWP::UserAgent;
use HTTP::Request::Common;

&upload;

sub upload {

my $ua = LWP::UserAgent->new();

$...
R1015Variable Parser for HTML pages my @repLines = (
        "REP1 = first value",
        "REP2 = 2nd value" ,
        "FANCY_VAR = Hi, World!"
);

my @tplLines = (
        "ABC Old Value<...

© reto :)