CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
@INC variable

 



vmnaren
New User

Sep 17, 2008, 10:15 PM

Post #1 of 4 (964 views)
@INC variable Can't Post

Windows 2008 Perl[cygwin installed in it]
-----------------------
I have a user defined module existing in /opt/mailh/sys/
which invokes a function within Process.pm which exists in /opt/syn/Win32/Process.pm.Though I include the "/opt/syn/Win32/Process.pm" in the @INC variable[I print it to verify it as well], the user defined module says "Undefined subroutine" .So I copy the Process.pm to the local directory in which user defined module exists and now it works fine.So why is this not searching from the @INC directory ?Please reply.


shawnhcorey
Enthusiast


Sep 18, 2008, 8:21 AM

Post #2 of 4 (955 views)
Re: [vmnaren] @INC variable [In reply to] Can't Post


In Reply To
Windows 2008 Perl[cygwin installed in it]
-----------------------
I have a user defined module existing in /opt/mailh/sys/
which invokes a function within Process.pm which exists in /opt/syn/Win32/Process.pm.Though I include the "/opt/syn/Win32/Process.pm" in the @INC variable[I print it to verify it as well], the user defined module says "Undefined subroutine" .So I copy the Process.pm to the local directory in which user defined module exists and now it works fine.So why is this not searching from the @INC directory ?Please reply.


You need to add the directory where your module is to @INC. Use the lib pragma to do so.


Code
use lib '/opt/syn/Win32'; 

use Process;


See `perldoc lib` for details.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


KevinR
Veteran


Sep 18, 2008, 9:43 AM

Post #3 of 4 (951 views)
Re: [vmnaren] @INC variable [In reply to] Can't Post

As shown above, you add the folder where the module is, not the folder and the module name to @INC, just the folder.
-------------------------------------------------


vmnaren
New User

Sep 25, 2008, 9:56 PM

Post #4 of 4 (785 views)
Re: [shawnhcorey] @INC variable [In reply to] Can't Post

Thank you very much for the reply and am able to get the issue solved.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives