alias tperl='perl -I/home/myuserid/bin/lib -we'\''use strict; use P;'
tperl
use Config;
use Data::Dumper;
my $dmp = Data::Dumper->new([\%Config], [ "Config" ]);
$dmp->Indent(1)->Deepcopy(0)->Sortkeys(1)->Deparse(1)->Purity(1)->Quotekeys(0);
printf "%s\n", $dmp->Dump;'
####
use FindBin qw($Bin); $FindBin::Bin =~ s{/bin/lib/?$}{/bin};
use lib ($FindBin::Bin . "/lib", $ENV{HOME} . "/bin/lib");
####
#!/usr/bin/perl
use warnings; use strict;
use P;
use parent 'Switches';
## example of a PERL compile-time constant
## based on a command line argument "-NODEBUG"
## using 'Switches' & BEGIN
## to run, place "-DNODEBUG" on the command line. (law)
BEGIN {
Switches->process_options({DNODEBUG =>
{ act => [ sub { eval '# line '.__LINE__.' "'.__FILE__.'"
use constant "_NODEBUG_"=>1;';
$@ && P::Pe("eval: %s\n", $@);
} ], } }, \@ARGV);
eval 'use constant _NODEBUG_ => undef;' unless *main::_NODEBUG_{CODE};
}
sub declared ($) {
use constant 1.01; # note: needed for "declared", below
my ($name, $pkg) = (shift, caller);
# prepend module name (must be a full-name)
$name = q(main) . $name if '::' eq substr $name,0,2;
# use caller pkg if needed
my $full_name = 0 <= index($name,'::') ? $name : $pkg.'::'.$name;
$constant::declared{$full_name};
}
P "_NODEBUG_ is a %s %s", declared(q(_NODEBUG_)) ? "constant" : "sub",
P "and is %s", _NODEBUG_ ?
"TRUE (devel checks disabled)." :
"FALSE (devel checks enabled)."