TAPORlib - TAPORlib is a Perl module that contains some useful functions.
TAPORlib
This library used by some great modules as WWW::Promotion, etc. It is provided by TAPOR, Inc.
Description: $eol = "\x0D\x0A";
Description: @rndletters = qw(q w e r t y u i o p a s d f g h j k l z x c v b n m);
Description: %countrycodes = ( 'ca' => 'Canada', 'af' => 'Afghanistan', 'al' => 'Albania', 'dz' => 'Algeria', ... ); %countrycodesbyname = reverse %countrycodes;
Description: %operation_systems = ( 'Windows 98' => 'Windows 98', 'Win98' => 'Windows 98', 'Windows 95' => 'Windows 95', 'Win95' => 'Windows 95', 'Mozilla/3.01 (compatible;)' => 'Windows 95',
Description: %monthbynumber = ( '1' => "January", '2' => "February", '3' => "March", '4' => "April", ...); %monthbyname = reverse %monthbynumber;
Description: %color =( 'normal' => "[0;37m", 'black' => "[0;30m", 'red' => "[0;31m" , 'ligthred' => "[1;31m", ... );
Description: Function removes trailing "r" and "\n" from end of $string.
Description: This function adds $string to the end of file "filename".
Description: This function makes special output to "filename". String shows like this: --- $who ---------------- $string --------------------$end
Description: This function returns massive that contains filenames with path in directory $dirname and filenames with path in subdirs also.
Description: This function returns massive that contains content of all files in directory $dirname (subdirs also).
Description: Use this function to get page from website. Usage: $pagenow{'url'} = "http://www.any.com/anyware"; $pagenow{'method'} = "POST|GET"; $pagenow{'referer'} = "http://www.any.com/anyware/ref"; $pagenow{'content'} = "user=blah\&info=blah-blah"; # If defined this agent string will be used insted Netscape $pagenow{'agent'} = "My AGENT"; # If specified Print some useful information to this logfile; $pagenow{'logfile'} = "logfile.log"; # If proxy not specified then Get Page without usage of proxy. $pagenow{'proxy'} = "proxy.online.ru:8080"; # If specified then send to page this cookies: $pagenow{'cookies'} = "C=12345; F=1"; # TimeOut to Connect To Proxy/Host. Default: 60 $pagenow{'timeoutconnect'} = 60; # TimeOut to Request Page. Default: 300 $pagenow{'timeoutrequest'} = 180; # No Request. GetPageNow_4() returns simple 'FAST MODE' page. $pagenow{'norequest'} = 1; # Show Error Page If Error Detected $pagenow{'showerrors'} = 1; %out = &GetPageNow_4(%pagenow); Output: $out{'error'} == 0 - No errors $out{'error'} == 1 - Some Error. $out{'errortxt'} - Error description if $out{'error'} == 1 $out{'status'} - Status of downloaded page $out{'headers'} - Header of downloaded page $out{'body'} - Body of downloaded page $out{'cookies'} - Cookies If page returns some cookies
Description: This function escapes url, commonly used to changes special symbols in url. Usage: $text = "sss" $pattern = "\x00-\xFF"; $text = &uri_escape($text,$pattern); Output: $text = "%73%73%73";
Description: Send HTML page with $text to STDOUT and exit program.
Description: Function returns TRUE if script executed in console, FALSE otherwise, e.g. when running under Apache.
Example: $headers = "Server: Netscape-Enterprise/2.01 Date: Thu, 29 Nov 2001 08:28:33 GMT Set-Cookie: registered=no; path=/; domain=.excite.com; expires=Wednesday, 31-Dec-2010 12:00:00 GMT Set-Cookie: UID=35813BB13C05F10C; path=/; domain=.excite.com; expires=Wednesday, 31-Dec-2010 12:00:00 GMT Location: http://www.excite.com/info/add_url/thanks/?url=&email=&country=&brand=excite X-Cache: MISS from ns.ahxk.ru Proxy-Connection: close"; $cookies = &getcookies($headers); print "$cookies\n"; Output: UID=35813BB13C05F10C; registered=no
Example: $cookies = joincookies("C=1; D=2","D=3; F=2"); print "$cookies\n"; Output: C=1; D=3; F=2
Example: %cookies = (D => 1, F => 2); $cookies = &joincookiesinhash(%cookies); print "$cookies\n"; Output: D=1; F=2
Description: This function returns string with $number random chars.
Description: This function returns random string selected from text file $text. Returns undef if no selection available.
Description: This function will create HTML page, print it to stdout and exit. $type may be: 1 - CreateAndSendOutHtmlPage() will execute script in $a path, print it output to stdout and exit. 2 - CreateAndSendOutHtmlPage() will read file $a, print it contents to stdout and exit. 3 - CreateAndSendOutHtmlPage() will print string "Location: $a\n\n" to stdout and exit. Examples: CreateAndSendOutHtmlPage("/path/index.cgi",1); CreateAndSendOutHtmlPage("/path/index.html",2); CreateAndSendOutHtmlPage("http://www.tapor.com",3);
Description: This function does very simple task, it compare $domain with $ENV{'HTTP_HOST'}. If equal function returns TRUE otherwise it returns FALSE.
Description: This function resend Web user to new location if domain not $domain. See previous function description.
Description: This function does very simple task, it convert massive @massive to string $string.
Description: This function returns connected socket to $host:$port if no error. $timeoutconnect is timeout to connect to $host:$port. Usage: %out = &newsocketto(*S,$host,$port,$timeoutconnect); Output: $out{'error'} == 0 - No errors $out{'error'} == 1 - Some Error. $out{'errortxt'} - Error description if $out{'error'} == 1 S - connected socket to $host:$port.
Description: This function checks for proxy server. $proxy server must be passed in the following format: 129.168.1.1:80 Output: TRUE if proxy server is valid. FALSE if proxy server is invalid.
Description: Functions does Win -> Koi and Koi -> Win translation.
Description: Function returns current script name.
Description: Function sets current directory to script directory.
Description: Sends NULL GIF image to client browser and exit.
Description: If date invalid function returns FALSE, otherwise TRUE.
Description: Parse forms content and returns it as hash %Config.
Description: Returns $date in string format. For Russian users also GetDateRus_2() function available.
Example: $flag = &SendEmailMsg("from@tapor.com","to@tapor.com","test message"); if(!$flag) { print "Can't e-mail to to@tapor.com :(\n"; }
Example: $flag = &SendEmailMultiMsg("from@tapor.com","to@tapor.com",("test message","2 line")); if(!$flag) { print "Can't e-mail to to@tapor.com :(\n"; }
Description: Function will cut massive @msv to size 10.
Example: @msv = qw(test test test test2 test2 ); @tops = &GetTops(@msv); Output: @tops = ("test - 3","test2 - 2");
Description: Function will test visitor of your page. It will return Search Engine Name if visitor is Serch Engine. It will return FALSE if visitor is surfer. The "./robots" is directory. See "./txt/robots" in the package.
Description: Function returns operation system which visitor is uses.
Description: Functions checks if script allready executed. If script allready executed functions returns TRUE, otherwise FALSE. $numstarts defines what maximum executions are allowed. We recomend you to use IsAllreadyRunning_2() function.
Description: This function returns random proxy server selected from file $proxy.
Copyright (c) 2000-2001 TAPOR, Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://www.tapor.com/TAPORlib/
To install TAPORlib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TAPORlib
CPAN shell
perl -MCPAN -e shell install TAPORlib
For more information on module installation, please visit the detailed CPAN module installation guide.