test.pl Script
Verify script requirements
 
Home > test.pl

  1. If you plan on running our scripts on your Windows PC computer and you have already installed ActivePerl on your Windows PC, then you do not need to run the following test. ActivePerl works with our scripts. If you need to install ActivePerl, see "How to install ActivePerl". If you still want to run the following test, copy the text below and save it as a file called test.pl or click your right mouse button here and select "Save Target as..." (or equivalent) from the popup menu and save it as test.pl

    If you plan on running our scripts on your Linux server use our test.pl script shown below to verify that our scripts will work on your Linux server. Copy the text below and save it as a file called test.pl or click your right mouse button here and select "Save Target as..." (or equivalent) from the popup menu and save it as test.pl

#!/usr/local/bin/perl
# test.pl v6.01.18
# (c)2002-2006 Cusimano.Com Corporation, all rights reserved

$www = $ENV{'SERVER_PORT'} ne "";
eval "use Compress::Zlib"; $hasCompress = $@ ? 0 : 1;
eval "use LWP"; $hasLWP = $@ ? 0 : 1;
eval "use LWP::Simple"; $hasLWPsimple = $@ ? 0 : 1;
if ($hasLWPsimple) {
	eval "use LWP::UserAgent";
	my $ua = LWP::UserAgent->new(timeout => 30);
	$u = "http://www.c3scripts.com/test/test.txt";
	$resp = $ua->request(HTTP::Request->new('GET', $u));
	$okLWP = $resp->content =~ /test\.pl/i;
}
eval "use CGI::Carp qw(fatalsToBrowser)"; $hasCGI = $@ ? 0 : 1;
$w = 16; $f = "<b>%" . $w . "s</b> : %s\n"; $f2 = " " x $w . " & %s\n";
print "Content-type: text/html\n\n<html><body><pre>" if ($www);
printf $f, "test.pl", "v6.01.18";
printf $f, "Perl", "v$]";
printf $f, "CGI::Carp", ($hasCGI? "" : "not ") . "installed";
printf $f, "Compress::Zlib", ($hasCompress? "" : "not ") . "installed";
printf $f, "LWP", ($hasLWP? "v$LWP::VERSION " : "not ") . "installed";
printf $f, "LWP::Simple", ($hasLWPsimple? "" : "not ") . "installed";
printf $f, "LWP::Simple", "rx " . ($okLWP? "" : "not ") . "ok" if ($hasLWPsimple);
printf $f, "\@INC", $INC[0]; foreach $x (1..$#INC) { printf $f2, $INC[$x];}
foreach $x (sort split(",",
  "DOCUMENT_ROOT,SCRIPT_FILENAME,PATH_INFO,PATH_TRANSLATED,".
  "REQUEST_FILENAME,HTTP_HOST,SERVER_SOFTWARE"))
    { printf $f, $x, $ENV{$x} }
print "</pre></body></html>\n" if ($www);
1;
  1. If you plan on running our scripts on your Linux server, you must have telnet/SSH access to the Linux command line prompt. If you don't know what telnet/SSH is, then you'll have to run the script on your Windows PC computer or learn how to use telnet/SSH. If necessary, change the first line of the script so that it has the path to the perl interpreter on your server. The default "/usr/local/bin/perl" works on most Linux servers. Be sure to upload the script using the ASCII mode of your FTP program. To run the script, type "perl test.pl".

    If you plan on running our scripts on your Windows PC computer, you'll need to install ActivePerl (see "How to install ActivePerl"). ActivePerl is free and we use it ourselves to run our scripts. To run the script, type "perl test.pl"in an MS-DOS window (see the tutorial "How to use an MS-DOS window"). To open an MS-DOS window, select "Start > Run..." and type the word "command" (no quotation marks); then in the MS-DOS window, type "cd DIRNAME" where DIRNAME is the name of the directory where you saved the test.pl script, such as "cd \download", then type "perl test.pl". You must be connected to the internet when you run test.pl.

  2. When you run test.pl, you should see output similar to the following:

            test.pl : v6.01.18
               Perl : v5.006001
          CGI::Carp : installed
     Compress::Zlib : installed
                LWP : v5.64 installed
        LWP::Simple : installed
        LWP::Simple : rx ok
               @INC : /usr/lib/perl5/5.6.1/i386-linux
                    & /usr/lib/perl5/5.6.1
                    & /usr/lib/perl5/site_perl/5.6.1/i386-linux
                    & /usr/lib/perl5/site_perl/5.6.1
                    & /usr/lib/perl5/site_perl/5.6.0/i386-linux
                    & /usr/lib/perl5/site_perl/5.6.0
                    & /usr/lib/perl5/site_perl
                    & .

    The script tests to see if certain perl modules are installed. Some of our scripts require the Compress::Zlib perl module (for data compression) and some require the LWP::Simple perl module (for internet access). ActivePerl comes with all required perl modules. The following table summarizes which modules are required for each script:

    Script

    Compress::Zlib

    LWP::Simple

    allposters.pl

    Yes

    No

    ae.pl

    Optional

    Yes

    audible.pl

    Optional

    Optional

    bettym.pl

    Optional

    Optional

    gocollect.pl

    No

    Optional

    If the LWP::Simple perl module is required and it is not installed on your Linux server, your system administrator can login as superuser and type the following Linux command to install the free libwww-perl package from the CPAN official perl distribution website:

    perl -MCPAN -e 'install Bundle::LWP'

    If in the above table the Compress::Zlib module is indicated as "Optional", the script will work whether the module is installed or not. If the Compress::Zlib module is installed then less disk space will be required since the script will compress its data files. Otherwise, the script will use uncompressed data files thus taking up more disk space for its data files. Uncompressed data files are typically about 4-7 times larger than compressed data files.

    If Compress::Zlib is not installed on your web server, see Compress::Zlib at cpan.org for installation instructions.





E.&O.E.; © Cusimano.Com Corporation; www.c3scripts.com