This is kind of a weird situation and *disclaimer* isn't my code!  :-)

The problem is that we're getting a weird error with this code...  (this
is from the actual program)

Undefined subroutine &TicketEmail::set_path_information called at
/usr2/local/PerlModules/TicketEmail.pm line 30.
Compilation failed in require at
/home/ticketsystem/parse_email_into_log.v2.pl line 29.
BEGIN failed--compilation aborted at
/home/ticketsystem/parse_email_into_log.v2.pl line 29.

TicketEmail.pm line 30 is : set_path_information();

parse_email_into_log.v2.pl line 29 is : use TicketEmail;

What he's trying to do is use the library.pm file as a set of defaults
that can be dumped into multiple programs...  The reason for using it in
the TicketEmail.pm file is that he wants those variables to be in the
same namespace (for reusability purposes) as the package.  It's used in
the main program because he needs access to those variables there as
well...

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

3 files.  File #1 is called library.pm...  Basic structure is as follows
:

-----begin-----
#!/usr/bin/perl

sub set_paths {
        $path1 = '/some/where';
        $path2 = '/some/where/else';
}

1;
-----end-----

File #2 is a package called mypackage.pm :

-----begin-----
#!/usr/bin/perl

package mypackage;
use Exporter;
use library;
@ISA= qw(Exporter);
@EXPORT=(mysub);

# Prototyping
sub mysub($);

# Set paths
set_paths();

sub mysub($) {
        # Do something
}

1;
-----end-----

And lastly, the main program called main.perl

-----begin-----
#!/usr/bin/perl

use lib '/path/to/libs';
use library;
use mypackage;

# set constants
set_paths;

# use package
mysub($var);
-----end-----

---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"I love deadlines.  I especially like the whooshing sound they make as
they go flying by." -- Douglas Adams [1952-2001]


Reply via email to