From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Preston de Guise Sent: 01 May 2007 04:16 > To: Brenda Powers > Cc: activeperl@listserv.ActiveState.com > Subject: Re: Include problem > > On 01/05/2007, at 8:42 AM, Brenda Powers wrote: > > > Hello: > > I am attempting to access a module in another file and get an error stating the module cannot be found. > > My main module is simply: > > require 'Telnet.pm'; > use Net::Telnet (); > $t = new Net::Telnet (Timeout => 10, > Prompt => '/bash\$ $/'); > > The first line was created with the 'Require Module' tab. The Telnet.pm file is in the same directory as my > main module but cannot be located. > What is the problem and how do I set an include path in ActivePerl ( if that is the problem )? > > Hi Brenda, > > Try: > > use lib "."; > use Telnet > > That should do the trick for you.
Unlikely for two reasons. First, the default Activestate installation already has "." in the include path (@INC - a quick check with 'perl -V' will confirm that in case I am wrong). Second, the current directory is probably not the same as the directory that the script and module live in. The special variable $0 contains the name of the script being executed (see 'perldoc perlvar'), which may contain path information, but a more reliable to locate the directory you want way is to use FindBin (see 'perldoc FindBin'), for example. use FindBin qw($Bin); use lib $Bin; require Telnet; Note that the module name is not quoted and has no '.pm' extension. See 'perldoc -f require' for an explanation. HTH -- Brian Raven ========================================= Atos Euronext Market Solutions Disclaimer ========================================= The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited - Registered in England & Wales with registration no. 3962327. Registered office address at 25 Bank Street London E14 5NQ United Kingdom. Atos Euronext Market Solutions SAS - Registered in France with registration no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 75009 Paris France. L'information contenue dans cet e-mail est confidentielle et uniquement destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail vous parvient par erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce message electronique ne represente pas necessairement la position ou le point de vue d'Atos Euronext Market Solutions. Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank Street E14 5NQ Londres Royaume Uni. Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France. ========================================= _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs