Ask a Question related to PERL Beginners, Design and Development.
-
Jan Eden #1
Placing handmade modules
Hi all,
I use the following code to use a module I made:
use lib "$ENV{HOME}/Library/Scripts/Modules";
use Test::Template;
my ($update_path, $gallery_title) = &Test::Template::choose();
The module sits in /Users/jan/Library/Scripts/Modules/Test. Now Perl tells me it cannot locate the subroutine "choose". If I place Template.pm directly into the path set in the "use lib" line and remove the "Test::" at both places, everything works fine.
I read in the camel that double colon separators in a module name would be translated to a directory structure when Perl searches for them.
Why doesn't Perl do it for me?
Thanks,
Jan
--
How many Microsoft engineers does it take to screw in a lightbulb? None. They just redefine "dark" as the new standard.
Jan Eden Guest
-
placing flash over w3d
Hi i want to be able to place a flash swf file on top of a w3d scene on stage. every time i do this the flash file is sent behind the w3d. Is it... -
Placing EPS vs. AI into Indesign 2.0
After placing .eps files (created in Illustrator) into Indesign 2.0 there is a slight cropping of the edge of the graphic. And when placing the same... -
Placing EPS or images in Ai
Has anyone else experienced this one?...Go to "place" and image ...now before actually selecting the image to place ...hit cancel instead,,,INSTANT... -
placing pdf as transparent
Hello, I have a bunch of pdf graphichs made with StarOffice Starcalc I want to place in an Indesign document. These pdf show a white... -
Help me with "handmade" messageboard
Hello, Tom! You wrote on Sun, 28 Mar 2004 14:53:16 GMT: TT> On 27-Mar-2004, "Nurchi BECHED" <nurchi@telus.net> wrote: TT> First, you... -
Rob Hanson #2
RE: Placing handmade modules
> my ($update_path, $gallery_title) = &Test::Template::choose();
Can I assume that your module has the line "package Test::Template;" at the
top of the file? If not, that is why.
This says "load {lib directory}/Test/Template.pm.> use Test::Template;
This says "execute choose() in the Test::Template package".> &Test::Template::choose();
Rob
-----Original Message-----
From: Jan Eden [mailto:lists@jan-eden.de]
Sent: Monday, January 26, 2004 11:39 AM
To: Perl Lists
Subject: Placing handmade modules
Hi all,
I use the following code to use a module I made:
use lib "$ENV{HOME}/Library/Scripts/Modules";
use Test::Template;
my ($update_path, $gallery_title) = &Test::Template::choose();
The module sits in /Users/jan/Library/Scripts/Modules/Test. Now Perl tells
me it cannot locate the subroutine "choose". If I place Template.pm directly
into the path set in the "use lib" line and remove the "Test::" at both
places, everything works fine.
I read in the camel that double colon separators in a module name would be
translated to a directory structure when Perl searches for them.
Why doesn't Perl do it for me?
Thanks,
Jan
--
How many Microsoft engineers does it take to screw in a lightbulb? None.
They just redefine "dark" as the new standard.
--
To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
For additional commands, e-mail: [email]beginners-help@perl.org[/email]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Rob Hanson Guest
-
Drieux #3
Re: Placing handmade modules
On Jan 26, 2004, at 8:38 AM, Jan Eden wrote:
[..]sounds like your package line in the Template.pm> The module sits in /Users/jan/Library/Scripts/Modules/Test. Now Perl
> tells me it cannot locate the subroutine "choose". If I place
> Template.pm directly into the path set in the "use lib" line and
> remove the "Test::" at both places, everything works fine.
file is set as
package Template;
and NOT as
package Test::Template;
Hence what you wanted to do is
use lib "$ENV{HOME}/Library/Scripts/Modules";
use Template;
...
my ($update_path, $gallery_title) = &Test::Template::choose();
Yes and no - the yes part is that IF the package line and> I read in the camel that double colon separators in a module name
> would be translated to a directory structure when Perl searches for
> them.
the file name are set appropriately.
This is one of the reasons that the perldoc advocates
doing the start of a perl module with h2xs
cf perldoc h2xs
so that you can start off at least modestly sanely
my traditional rant on PM's is at
<http://www.wetware.com/drieux/CS/lang/Perl/PM/quick_pm.html>
When I am brewing up a new module, I then of course use
something like
<http://www.wetware.com/drieux/CS/lang/Perl/PM/PerlInstall.plx>
so that i can install the module in my home directory.
ciao
drieux
---
Drieux Guest
-
Jan Eden #4
Re: Placing handmade modules
Thanks Rob and drieux,
you were both right. The package line read
package Template;
Since I noticed my error just one minute after asking for help on the list,I tried to send a followup, but - alas! - my provider's SMTP server deniedconnections for about two hours.
Now I learned some more perlish behaviour: double colons are used for both the namespace and the replicated directory structure.
Thanks again,
Jan
drieux wrote:
-->
>On Jan 26, 2004, at 8:38 AM, Jan Eden wrote:
>[..]>>> The module sits in /Users/jan/Library/Scripts/Modules/Test. Now Perl
>> tells me it cannot locate the subroutine "choose". If I place
>> Template.pm directly into the path set in the "use lib" line and
>> remove the "Test::" at both places, everything works fine.
>sounds like your package line in the Template.pm
>file is set as
>
> package Template;
>
>and NOT as
>
> package Test::Template;
>
>Hence what you wanted to do is
>
> use lib "$ENV{HOME}/Library/Scripts/Modules";
> use Template;
> ...
> my ($update_path, $gallery_title) = &Test::Template::choose();
>>>> I read in the camel that double colon separators in a module name
>> would be translated to a directory structure when Perl searches for
>> them.
>Yes and no - the yes part is that IF the package line and
>the file name are set appropriately.
>
>This is one of the reasons that the perldoc advocates
>doing the start of a perl module with h2xs
>
> cf perldoc h2xs
>
>so that you can start off at least modestly sanely
>
>my traditional rant on PM's is at
><http://www.wetware.com/drieux/CS/lang/Perl/PM/quick_pm.html>
>
>When I am brewing up a new module, I then of course use
>something like
>
><http://www.wetware.com/drieux/CS/lang/Perl/PM/PerlInstall.plx>
>
>so that i can install the module in my home directory.
>
>ciao
>drieux
>
>---
>
>
There's no place like ~/
Jan Eden Guest
-
Drieux #5
Re: Placing handmade modules
On Jan 26, 2004, at 2:45 PM, Jan Eden wrote:
actually, the double colons indicate a name space,> Now I learned some more perlish behaviour: double colons are used for
> both the namespace and the replicated directory structure.
and IF the name space IS external, then it is
left to the File System Implementation of 'use'
and/or 'require' how to go and find the appropriate file.
As you will have noticed from say
BEGIN {
package Foo::Bar;
......
} # end begin
# back in package main::*
One can put packages into a script and use them,
without having to externalize them as a Perl Module.
ciao
drieux
---
Drieux Guest



Reply With Quote

