I follow completely...  The idea behind the library.pm file is for it to
basically be an include file ala C/C++.  The intent is to not re-write
the same functions over and over again...

With the exception of using it in an actual package (ala the
mypackage.pm example), this is used successfully in a few dozen other
programs..  Basically he just puts a 'use library;' at the beginning of
the program, calls the needed subs and goes on his merry way.
Everything joins the main namespace...  It's when he places it in both
the package and the main that it causes this error...

That make sense?

---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"Imagination is more important than knowledge. Knowledge is limited.
Imagination encircles the world." -- Albert Einstein [1879-1955]


-----Original Message-----
From: drieux [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 28, 2002 3:20 PM
To: Jason Frisvold
Cc: begin begin
Subject: Re: 'use' question


On Tuesday, May 28, 2002, at 12:03 , Jason Frisvold wrote:
[..]
>
> Undefined subroutine &TicketEmail::set_path_information called at
> /usr2/local/PerlModules/TicketEmail.pm line 30.

here is a part of your problem - you neither exported 'set_path_info'
from the 'library.pm' file - so that the compiler would know to
check for it there, nor did you expressly call it out in
your TicketEmail.pm as being 'an extern'....

[..]
>
> Ugh... longwinded, but I think I got everything right....  Is this
> doable?  Or should I direct him to a programming class?  *grin*

a good place to start the reading would be:

        http://perl.plover.com/FAQs/Namespaces.html

[..]
yes, but you will want to think about some of the problems
that you have spawned for yourself....

the problem is that while

        use library;

would be somewhat useful - the complication here is
that your

        library.pm

is not really a 'perl module' since it is not exporting
anything back - merely sorta declaring that it has something
like a function....

if you did say

        package library

        sub hide_vals {

                my $path1 = '/some/where';
                my $path2 = '/some/where/else';

                return($path1, $path2) ; # this makes it at least like a
method

        }

and then in your mypackage.pm
were to guard for them with say

        my ($p1, $p2) = &library::hide_vals ; # expressly call their
function.

then you would be able to get them into your
mypackage.pm - for re-use else where.


does that give you a way to start reconsidering it????



ciao
drieux

---


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to