Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Simple Module Tutorial

by twotone (Beadle)
on Oct 14, 2007 at 05:06 UTC ( #644703=note: print w/ replies, xml ) Need Help??


in reply to Simple Module Tutorial

Great summary of module basics!

Here's a little code I came up with to add my module location to @INC (in a cgi environment) by dynamically determining the document root for the script. It works on the remote apache server and when testing locally in windows. It might be of some interest:

BEGIN { # get doc root from %ENV # implicitly declare file root path if %ENV not fount my $doc_root = $ENV{DOCUMENT_ROOT} || 'C:/Users/User/Documents/website/sites/mysite'; # change \ to / $doc_root =~ s/\\/\//g; # add module folder location $doc_root .= "/cgi-bin/cms/"; # add module location to @INC push(@INC,$doc_root); }


Comment on Re: Simple Module Tutorial
Download Code
Re^2: Simple Module Tutorial
by bychan (Initiate) on Jan 28, 2008 at 08:45 UTC
    This tutorial is great. The only problem is, that I get the following result, if I comment out all the cases:

    !rekcaH~lreP~rehtonA~tsuJ
    JUST~ANOTHER~PERL~HACKER!
    !rekcaH~lreP~rehtonA~tsuJ
    JUST~ANOTHER~PERL~HACKER!
    !rekcaH~lreP~rehtonA~tsuJ
    JUST~ANOTHER~PERL~HACKER!
    !rekcaH~lreP~rehtonA~tsuJ
    JUST~ANOTHER~PERL~HACKER!

    Shouldn't there be some error messages or warnings?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-09-20 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls