test.pl Script Verify script requirements |
||
Home > test.pl |
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/bin/env perl # test.pl v18.08.08 # (c)2002-2018 Cusimano.Com Corporation, all rights reserved use HTML::Entities; my $www = $ENV{'SERVER_PORT'} ne ''; sub enc { return $www ? encode_entities( $_[0] ) : $_[0] } 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 = 24; $f = '<b>%' . $w . "s</b> : %s\n"; $f2 = ' ' x $w . ' ' . &enc('&') . " %s\n"; print "Content-type: text/html\n\n<html><body><pre>" if ($www); printf $f, 'test.pl', 'v18.08.08'; 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', &enc($INC[0]); foreach $x (1..$#INC) { printf $f2, &enc($INC[$x]) } foreach $x (sort keys %ENV) { printf $f, &enc($x), &enc($ENV{$x}) } print "</pre></body></html>\n" if ($www); 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
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
When you run test.pl, you should see output similar to the following:
test.pl : v18.08.08 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 |
ae.pl |
Optional |
Yes |
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