Include problem

Include problem

am 01.05.2007 00:42:06 von Brenda Powers

This is a multi-part message in MIME format.

--===============0586366101==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C78B78.C7E05E68"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C78B78.C7E05E68
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hello:
=20
I am attempting to access a module in another file and get an error
stating the module cannot be found.
=20
My main module is simply:
=20
require 'Telnet.pm';
use Net::Telnet ();
$t =3D new Net::Telnet (Timeout =3D> 10,
Prompt =3D> '/bash\$ $/');
=20
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.=20
What is the problem and how do I set an include path in ActivePerl ( if
that is the problem )?
=20
Thanks,
Brenda

------_=_NextPart_001_01C78B78.C7E05E68
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable



charset=3Dus-ascii">


class=3D908273722-30042007>Hello:

class=3D908273722-30042007> 

I am =
attempting to=20
access a module in another file and get an error stating the module =
cannot be=20
found.

class=3D908273722-30042007> 

My =
main module is=20
simply:

class=3D908273722-30042007> 

class=3D908273722-30042007>     require=20
'Telnet.pm';
        use =
Net::Telnet=20
();

class=3D908273722-30042007>       &nbs=
p;     $t=20
=3D new Net::Telnet (Timeout =3D>=20
10,
           =
            &=
nbsp;     =20
Prompt =3D> '/bash\$ $/');

class=3D908273722-30042007> 

The =
first line was=20
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=20
and how do I set an include path in ActivePerl ( if that is the problem=20
)?

class=3D908273722-30042007> 

class=3D908273722-30042007>Thanks,

class=3D908273722-30042007>Brenda


------_=_NextPart_001_01C78B78.C7E05E68--

--===============0586366101==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0586366101==--

Re: Include problem

am 01.05.2007 05:15:48 von Preston de Guise

--===============0323614418==
Content-Type: multipart/alternative; boundary=Apple-Mail-3--33830538


--Apple-Mail-3--33830538
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed

Hi Brenda,

Try:

use lib ".";
use Telnet

That should do the trick for you.

Cheers,

Preston.

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 )?
>
> Thanks,
> Brenda
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

--
Preston de Guise
pdeguise@gmail.com

http://www.anywebdb.com




--Apple-Mail-3--33830538
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=ISO-8859-1

-khtml-line-break: after-white-space; ">Hi Brenda,


class=3D"khtml-block-placeholder">
Try:

class=3D"khtml-block-placeholder">
use lib ".";
use =
Telnet

That =
should do the trick for you.

class=3D"khtml-block-placeholder">
Cheers,

class=3D"khtml-block-placeholder">
Preston.

<=
DIV>On 01/05/2007, at 8:42 AM, Brenda Powers wrote:

class=3D"Apple-interchange-newline">
=
class=3D"908273722-30042007">Hello:
face=3D"Arial" size=3D"2"> class=3D"908273722-30042007">=A0
face=3D"Arial" size=3D"2">I am =
attempting to access a module in another file and get an error stating =
the module cannot be found.
size=3D"2">=A0
=
My=
main module is simply:
size=3D"2">=A0
=
class=3D"908273722-30042007">    =A0require =
'Telnet.pm';
      =A0 use Net::Telnet =
();
class=3D"908273722-30042007">          = A0  $t =3D=
new Net::Telnet (Timeout =3D> 10,
          =A0=
                   Prompt =3D> =
'/bash\$ $/');
size=3D"2">=A0
=
class=3D"908273722-30042007">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.
face=3D"Arial" size=3D"2">What is the =
problem and how do I set an include path in ActivePerl ( if that is the =
problem )?
class=3D"908273722-30042007">=A0
face=3D"Arial" size=3D"2"> class=3D"908273722-30042007">Thanks,
face=3D"Arial" size=3D"2"> class=3D"908273722-30042007">Brenda
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; =
">_______________________________________________
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">ActivePerl mailing list
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> href=3D"mailto:ActivePerl@listserv.ActiveState.com">ActivePe rl@listserv.Ac=
tiveState.com
margin-bottom: 0px; margin-left: 0px; ">To unsubscribe: href=3D"http://listserv.ActiveState.com/mailman/mysubs">http ://listserv.Ac=
tiveState.com/mailman/mysubs

=
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "> class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "> class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; =
">
--
Preston de Guise

class=3D"khtml-block-placeholder">
class=3D"khtml-block-placeholder">

class=3D"Apple-interchange-newline">
=

=

--Apple-Mail-3--33830538--

--===============0323614418==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0323614418==--

RE: Include problem

am 01.05.2007 10:33:31 von Brian Raven

From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] 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 =3D new Net::Telnet (Timeout =3D> 10,
> Prompt =3D> '/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 =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

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 immediat=
ely 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 Lon=
don 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 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Include problem

am 01.05.2007 10:43:50 von Preston de Guise

--===============0219652645==
Content-Type: multipart/alternative; boundary=Apple-Mail-7--14148456


--Apple-Mail-7--14148456
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed


On 01/05/2007, at 6:33 PM, Brian Raven 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.

Well, I guess that all my current scripts that do this when I'm
developing must be malfunctioning :-) I do however tend to only
execute during development from the directory it comes from though,
so yes, if you execute from another directory, that's not going to
work; I hadn't factored that in. But using PDK I tend to end up
compiling everything and treating it as a binary...

> 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.

Alternatively, another technique would be to setup your own modules
directory so that you can reliably reference this at all times.

E.g.:

# mkdir /opt/MyPerl/modules
# mkdir /opt/MyPerl/modules/MyPerl

copy Telnet.pm to /opt/MyPerl/modules/MyPerl

then:

use lib "/opt/MyPerl/modules";
use MyPerl::Telnet


(Or some other apropos derivation).

Cheers,

Preston.

--
Preston de Guise
pdeguise@gmail.com

http://www.anywebdb.com




--Apple-Mail-7--14148456
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=ISO-8859-1

-khtml-line-break: after-white-space; ">

On 01/05/2007, at =
6:33 PM, Brian Raven wrote:

class=3D"Apple-interchange-newline">
type=3D"cite">
margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "> style=3D"white-space:pre"> Hello:

0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"> class=3D"Apple-tab-span" style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0
class=3D"khtml-block-placeholder">

margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> I am =
attempting to access a module in another file and get an
=
margin-bottom: 0px; margin-left: 0px; ">error stating the module cannot =
be found.

0.0px 0.0px 0.0px; min-height: 14.0px"> style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0
class=3D"khtml-block-placeholder">

margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> My main =
module is simply:

min-height: 14.0px"> style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0
class=3D"khtml-block-placeholder">

margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0 =A0 require =
'Telnet.pm';
margin-bottom: 0px; margin-left: 0px; "> style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0 =A0 =A0 =A0 use Net::Telnet =
();
margin-bottom: 0px; margin-left: 0px; "> style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0 =A0 =A0 =A0 =A0 =A0 $t =3D =
new Net::Telnet (Timeout =3D> 10,
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0
Prompt =3D> '/bash\$ $/');

style=3D"margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"> class=3D"Apple-tab-span" style=3D"white-space:pre"> class=3D"Apple-converted-space">=A0
class=3D"khtml-block-placeholder">

margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> The first =
line was created with the 'Require Module' tab. The
=
margin-bottom: 0px; margin-left: 0px; ">Telnet.pm file is in the same =
directory as my > main module but cannot
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">be =
located.=A0
=
0px; margin-bottom: 0px; margin-left: 0px; "> class=3D"Apple-tab-span" style=3D"white-space:pre"> What is =
the problem and how do I set an include path in
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">ActivePerl ( if that is the problem )?
=
0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; =
">
margin-bottom: 0px; margin-left: 0px; ">Hi Brenda, class=3D"Apple-converted-space">=A0
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
min-height: 14px; ">
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
">Try:
margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">use lib ".";
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">use =
Telnet
margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">That should do the trick for you.
=
margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Unlikely for two reasons. First, the default =
Activestate installation
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">already has =
"." in the include path (@INC - a quick check with 'perl -V'
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">will confirm that in case I am wrong). Second, the =
current directory is
0px; margin-bottom: 0px; margin-left: 0px; ">probably not the same as =
the directory that the script and module live
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">in.

class=3D"khtml-block-placeholder">
Well, I guess that all my =
current scripts that do this when I'm developing must be malfunctioning =
:-)=A0 I do however tend to only execute during development from the =
directory it comes from though, so yes, if you execute from another =
directory, that's not going to work; I hadn't factored that in. But =
using PDK I tend to end up compiling everything and treating it as a =
binary...

style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">The special variable $0 contains the name of the =
script being executed
0px; margin-bottom: 0px; margin-left: 0px; ">(see 'perldoc perlvar'), =
which may contain path information, but a more
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">reliable to locate the directory you want way is to =
use FindBin (see
margin-bottom: 0px; margin-left: 0px; ">'perldoc FindBin'), for =
example.
margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">use FindBin qw($Bin);
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">use lib =
$Bin;
margin-bottom: 0px; margin-left: 0px; ">require Telnet;
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; ">
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Note =
that the module name is not quoted and has no '.pm' extension. =
See
margin-bottom: 0px; margin-left: 0px; ">'perldoc -f require' for an =
explanation.

class=3D"khtml-block-placeholder">
Alternatively, another technique =
would be to setup your own modules directory so that you can reliably =
reference this at all times.

class=3D"khtml-block-placeholder">
E.g.:

class=3D"khtml-block-placeholder">
# mkdir =
/opt/MyPerl/modules
# mkdir =
/opt/MyPerl/modules/MyPerl

class=3D"khtml-block-placeholder">
copy Telnet.pm to =
/opt/MyPerl/modules/MyPerl

class=3D"khtml-block-placeholder">
then:

class=3D"khtml-block-placeholder">
use lib =
"/opt/MyPerl/modules";
use MyPerl::Telnet

class=3D"khtml-block-placeholder">

class=3D"khtml-block-placeholder">
(Or some other apropos =
derivation).

class=3D"khtml-block-placeholder">
Cheers,

class=3D"khtml-block-placeholder">
Preston.
E type=3D"cite">

class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "> class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "> class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; =
">
--
Preston de Guise

class=3D"khtml-block-placeholder">
class=3D"khtml-block-placeholder">

class=3D"Apple-interchange-newline">
=

=

--Apple-Mail-7--14148456--

--===============0219652645==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0219652645==--