- Subversion Version Control System Notes
Perl
- Regular Expressions Cheat Sheet
- Debugging Perl - Debugging Perl with custom carp output format
Calling cluck() for a stack trace
print "-" x 73, "\n"; cluck(); print "-" x 73, "\n";
Custom Output Format
BEGIN {
use Carp::Heavy;
no warnings 'redefine';
*Carp::format_arg = sub {
package Carp;
my $arg = shift;
if( not defined $arg )
{ $arg = 'undef' }
elsif( ref $arg )
{
use Data::Dumper;
local $Data::Dumper::Indent = 0; # salt to taste
local $Data::Dumper::Terse = 0;
$arg = Dumper( $arg );
$arg =~ s/^\$VAR\d+\s*=\s*//;
$arg =~ s/;\s*$//;
}
else
{
$arg =~ s/'/\'/g;
$arg = str_len_trim($arg, $MaxArgLen);
$arg = "'$arg'" unless $arg =~ /^-?[\d.]+\z/;
}
$arg =~ s/([[:cntrl:]]|[[:^ascii:]])/sprintf("\\x{%x}",ord($1))/eg;
return $arg;
};
}- Use warn() without a new line to also print the file name and line number
- Carp() will provide arguments for the current subroutine
use Carp qw(carp); carp( "Danger Will Robinson");
- Use perldoc for your own modules and core modules
perldoc net::snmp perldoc lib/xPL/Client.pm
Writing Perl Modules
Creating (and Maintaining) Perl Modulesperlnewmod - preparing a new module for distribution
perlmodlib - constructing new Perl modules and finding existing ones
perlpod - the Plain Old Documentation format
ppm
install Module-Starter
module-starter --module=Weather::NOAA::Alert \
--author="Michael Stovenour" --email=michael@stovenour.net
Last wiki comments