Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Strawberry, CPAN and PERL5

by perl-diddler (Chaplain)
on Sep 02, 2019 at 05:15 UTC ( [id://11105403]=note: print w/replies, xml ) Need Help??


in reply to Strawberry, CPAN and PERL5

First off, I'm sorta guessing, but l5, sounds like an abbreviation for /usr/lib/perl(5)/(site|local)/.... Since in a normal install of Win7 you are your own 'site'. In regards to SBperl not putting thing under neat your own User dir, where would you put your 'local site' modules dir that were added by the user that were in a personal version of SBperl? If you were compiling for a company, you might already know how to build your own perl, but for an individual?

Have you looked at %Config to see what has the path under your home dir? (i.e. is it the SITE paths?) -- sounds like not or it should have found them at run time.

I just dumped my config with:

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)->Quot +ekeys(0); printf "%s\n", $dmp->Dump;'
Might also want to look at your CPAN config for clues: more ~/.cpan/CPAN/MyConfig.pm

The other thing to do would be to create a 'lib' dir under your executable and add the relative path at runtime:

use FindBin qw($Bin); $FindBin::Bin =~ s{/bin/lib/?$}{/bin}; use lib ($FindBin::Bin . "/lib", $ENV{HOME} . "/bin/lib");
For conditional compilation, I used something like:
#!/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", belo +w 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)."
Switches will check if "-DNODEBUG" is on the command line, if so, it will call the first eval, otherwise the end.

The constant created (_NODEBUG_) becomes a compile time constant that will be either '1' or 'undef'.

When working locally, create an alias or batch file to run your program with the -DNODEBUG switch. You can still take it out later, but this way if you upload your code w/o removing your custom code, it won't get activated.

Since _NODEBUG_ is a compile time constant, perl should either not include or include your debug code at runtime.

Those were just a few things I thought of off the top of my head. Hope it helps!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105403]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found