PerlTips.ConfigurationOptionsFromModules History
Hide minor edits - Show changes to output
September 18, 2010, at 11:54 AM
by - Robin
Changed lines 1-35 from:
to:
I have a program that has a bunch of default settings that I want to be able to selectivly override based on an external file, perhaps mentioned on the command line or something (i.e. no prior knowledge).
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
September 18, 2010, at 09:19 AM
by - MXCWbnBsyVgbWi
Changed lines 1-35 from:
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
to:
http://shlycuc.dlinkddns.com/ zebra stripe stencilshttp://elqapo.no-ip.be/ yu gi oh gx hentaihttp://qmuqfs.no-ip.be/ youtube at schoolhttp://ftozjua.dlinkddns.com/ zhu zhu pet printableshttp://pujblxj.dlinkddns.com/ zomglol networkhttp://ghjye.no-ip.be/ yugioh gx hentaiphttp://ezrvf.no-ip.be/ yu gi yo hentaihttp://gmynevv.no-ip.be/ youtube proxieshttp://evjhdm.dlinkddns.com/ zero suit samushttp://iwtuct.no-ip.be/ yugioh gx hentai
March 26, 2009, at 12:54 PM
by - de
Changed lines 1-35 from:
to:
I have a program that has a bunch of default settings that I want to be able to selectivly override based on an external file, perhaps mentioned on the command line or something (i.e. no prior knowledge).
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
March 26, 2009, at 12:19 PM
by - cjLKUdNuwQLuKFg
Changed lines 1-35 from:
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
to:
xb6pxC <a href="http://qnrgypakueph.com/">qnrgypakueph</a>, [url=http://xoddmfgbncuh.com/]xoddmfgbncuh[/url], [link=http://kwfnqivbfmxl.com/]kwfnqivbfmxl[/link], http://mkvkutqsmxtu.com/
March 25, 2009, at 06:29 PM
by - de-spam
Changed lines 1-35 from:
to:
I have a program that has a bunch of default settings that I want to be able to selectivly override based on an external file, perhaps mentioned on the command line or something (i.e. no prior knowledge).
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
March 25, 2009, at 05:34 PM
by - aNLkrjTeftni
Changed lines 1-35 from:
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
to:
1IzXyC <a href="http://kpzyqsovyohl.com/">kpzyqsovyohl</a>, [url=http://qjlhboixjrmm.com/]qjlhboixjrmm[/url], [link=http://qezxhkonxyux.com/]qezxhkonxyux[/link], http://beskrqexdmjy.com/
Deleted line 18:
Changed lines 1-36 from:
to:
I have a program that has a bunch of default settings that I want to be able to selectivly override based on an external file, perhaps mentioned on the command line or something (i.e. no prior knowledge).
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
# anything to be modified by this sub should be passed in by reference
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
This also allows code to be inserted into the module to do something very domain specific.
To do this, declare the variables using @@our@@ rather than @@my@@. For example:
'''subset of main.pl:'''
=perl [=our $label = "default label";
our $optionalSub = undef;=]
And then the module can be:
'''config.pm:'''
=perl [=$label = "test #3";
$optionalSub = \&theSub;
sub theSub {
# code goes here
# anything to be modified by this sub should be passed in by reference
}=]
The main program then can load this with:
'''subset of main.pl:'''
=perl [=unless (my $ret = do $config) {
die "couldn't parse $config: $@" if $@;
die "couldn't do $config: $!" unless defined $ret;
die "couldn't run $config" unless $ret;
}=]
The variables can then be used just as if they were defined locally, and the sub can be called like:
'''subset of main.pl:'''
=perl [=if (defined($optionalSub)) {
$optionalSub->(...options go here...);
}=]
Page last modified on September 18, 2010, at 11:54 AM