For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2006 > Use command usage - Newbie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Use command usage - Newbie
Justin

2006-12-26, 7:00 pm


When using the use command does it assume the other module is in the
same directory or path? What is the logical look-up ?

Paul Lalli

2006-12-26, 7:00 pm

Justin wrote:
> When using the use command does it assume the other module is in the
> same directory or path? What is the logical look-up ?


It looks in all directories that are in the @INC array. If you need to
add a new directory to that list, you need to add it to the @INC array
before using the module. Since 'use' happens at compile time, though,
you need to either modify @INC in a BEGIN block, or preferably use the
'lib' pragma:

#!/usr/bin/perl
use strict;
use warnings;
use lib 'some/other/directory/';
use MyNonStandardLocationModule;

See also:
perldoc lib
perldoc -f use
perldoc -f require

Paul Lalli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com