Yeah, what that would pretty much mean is that you will make a file
called, say, CommonFuncts.pm and then in each Perl script say

use CommonFuncts;

Alternatively, you can make a common_functs.pl file, where each one of
the above actions is performed in a subroutine (the file should only
have subroutines, and should not do anything outside of them (except
like use strict;)) and then, from within each file, you could do
something like

BEGIN
{
   do ('common_functs.pl');
   die if $@;
}


The BEGIN just makes the block be loaded at the beginning of
execution, the do() function loads files and eval()s them (except
since all we have are subroutines, nothing is actually performed, you
just now have all of the new subroutines to work with) and the 'die if
$@' exits if there were syntax errors in the common_functs.pl file and
it prints them.

Either of the two ways work, I just prefer do();

Cheers!

--
Leonid Grinberg
[EMAIL PROTECTED]
http://www.lgrinberg.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to