On Thursday, Sep 25, 2003, at 17:44 US/Pacific, seldan wrote: [..]
[..]
However, I am trying to keep this site as modular and easy to maintain as
possible and cannot seem to find the right equivalent for a basic PHP
"include" or "require" function. I use several variables that stay the same
throughout the scripts, and would like to host them in a separate file.
Sifting through ideas on this I've come across: SSI, Embperl, Mason, and
possibly creating modules to handle this. All seem like a bit of work,
which isn't a problem, I just want to make sure that I'm not missing a
simple, obvious way to make this happen!
The modules would be my first choice since you want to be able to assert
use lib "./lib"; # we will put our PM in a directory lib use thisProj;
my $value = thisProj->get_value(); print "got $value\n";
so that you can 'keep' track of the relationship between the 'class accessor' and the value you got.
so the snappy quick intro is to create the file thisProj.pm and put it in the 'lib' directory.
package thisProj;
our $value = 'this_value_here'; # the value(s) up here
sub get_value { $value ; } # the accessor merely wraps it
hence you wind up with a file system layout like:
/some/path this_code.plx lib/thisProj.pm
eg: /some/path/this_code.plx and /some/path/lib/thisProj.pm
and you are out and away.
The alternative strategy would be to create the Package, and just Rip out the value
my $alt = $thisProj::value;
but personally I think that is 'garish', and that starting down the road to doing the module is more appropriate.
you will also want to do
perldoc h2xs perldoc perlsub perldoc perlmod perldoc perlmodlib
and you might as well pick up the learning perl references and modules book.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]