I
ivowel
Dear perl experts: I want to create a rather lightweight package that
just uses what is installed in standard perl. this problem must be
very common.
package mypackage:
require Exporter;
our @ISA= qw(Exporter);
our @EXPORT = qw( v1 v2 v3 v4 );
our ($v1, $v2, $v3, $v4) = ("user-please-set", "a", "b", "c");
($v1=~ /whatisit/);
## a lot more stuff, a lot more variables, etc.
so far so good. alas, I now realize that $v1 is something that I
would like my package users to change. instead of leaving it in
mypackage, I think it would be nice to have such variables layed out
into mypackageconfig.pm . mypackage should just load in
mypackageconfig.pm at compile time, and treat everything in it as its
own---like the C preprocessor #include.
optimally, I would like syntax like
package mypackage:
require Exporter;
our @ISA= qw(Exporter);
our @EXPORT = qw( v1 v2 v3 v4 );
include mypackageconfig;
our ($v2, $v3, $v4) = ("a", "b", "c");
($v1=~ /whatisit/);
## a lot more stuff, a lot more variables, etc.
and the file mypackageconfig would just contain
our $v1= "user-please-set";
is there a standard way to do this? I have been trying to accomplish
this, but always run into import/export problems.
sincerely,
/iaw
just uses what is installed in standard perl. this problem must be
very common.
package mypackage:
require Exporter;
our @ISA= qw(Exporter);
our @EXPORT = qw( v1 v2 v3 v4 );
our ($v1, $v2, $v3, $v4) = ("user-please-set", "a", "b", "c");
($v1=~ /whatisit/);
## a lot more stuff, a lot more variables, etc.
so far so good. alas, I now realize that $v1 is something that I
would like my package users to change. instead of leaving it in
mypackage, I think it would be nice to have such variables layed out
into mypackageconfig.pm . mypackage should just load in
mypackageconfig.pm at compile time, and treat everything in it as its
own---like the C preprocessor #include.
optimally, I would like syntax like
package mypackage:
require Exporter;
our @ISA= qw(Exporter);
our @EXPORT = qw( v1 v2 v3 v4 );
include mypackageconfig;
our ($v2, $v3, $v4) = ("a", "b", "c");
($v1=~ /whatisit/);
## a lot more stuff, a lot more variables, etc.
and the file mypackageconfig would just contain
our $v1= "user-please-set";
is there a standard way to do this? I have been trying to accomplish
this, but always run into import/export problems.
sincerely,
/iaw