Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Perl/Helpful Libraries/Throughput/Usage"
From NetSec
Chantal21I (Talk | contribs) |
Chantal21I (Talk | contribs) |
||
Line 1: | Line 1: | ||
To set up your development environment for Throughput, you'll need to put the contents of '''Throughput.tgz''' in your perl include directory or put the '''Throughput''' directory in the same directory as the application you are developing. | To set up your development environment for Throughput, you'll need to put the contents of '''Throughput.tgz''' in your perl include directory or put the '''Throughput''' directory in the same directory as the application you are developing. | ||
+ | |||
+ | ====Config.pm==== | ||
+ | {{:Perl/Helpful Libraries/Throughput/Usage/Config}} | ||
+ | ====Log.pm==== | ||
+ | {{:Perl/Helpful Libraries/Throughput/Usage/Log}} | ||
+ | ====Server.pm==== | ||
+ | {{:Perl/Helpful Libraries/Throughput/Usage/Server}} |
Latest revision as of 01:49, 19 July 2012
To set up your development environment for Throughput, you'll need to put the contents of Throughput.tgz in your perl include directory or put the Throughput directory in the same directory as the application you are developing.
Config.pm
- A simple config parser
use Throughput::Config qw(parse); my %config = Throughput::parse('config.conf'); |
- The config file should be formatted as:
variable=value # comment
- The %config hash will return as :
$config{variable} |
Log.pm
- A simple logger
my $logger = new Log(); $logger->error("an error has occured"); |
- Output defaults to STDERR but can be set to files in the constructor or using accessors.
$logger->error_log($filehandle); |
- Log also supports info, warn and digest:
$logger->info("info message"); $logger->warn("warning!"); $logger->info_log($filehandle); $logger->warn_log($filehandle); |
$logger->digest_log($filehandle); |
Server.pm
Notice: This segment will be updated with documentation in the next 24 hours; apologies for the delay. The code itself has been completed and seasoned perl developers should be able to implement it quickly.