Perl: the Markov chain saw | |
PerlMonks |
autoloading functions from a text stringby hackmare (Pilgrim) |
on Feb 14, 2002 at 19:44 UTC ( [id://145539]=perlquestion: print w/replies, xml ) | Need Help?? |
hackmare has asked for the wisdom of the Perl Monks concerning the following question: Fellow Monks, I have a fear. A fear of the darkness of the unknown, of the listlessness that impurity of mind and flimsiness of knowledge causes my frail frame. A module exists which uses autosubs: -------------------------- package SVG::Element; $VERSION = "1.0"; use strict; use vars qw(@ISA $AUTOLOAD %autosubs); #@ISA = qw( SVG::XML ); use SVG::XML; my @autosubs=qw( sub1 sub2 sub3 ); %autosubs=map { $_ => 1 } @autosubs; #- - - - - - - - - sub new ($$;@) { my ($proto,$name,%attrs)=@_; my $class=ref($proto) || $proto; my $self={-name => $name}; foreach my $key (keys %attrs) { next if $key=~/^\-/; $self->{$key}=$attrs{$key}; } return bless($self,$class); } -------------------------- Now what I would like to do is define the names of the subs sub1 sub2 sub3 externally (say, within a file) And this is where my knowledge of Perl falls down really hard. I would like the subs to be the names of a subset of html tags, such as qw(a href html head ul ol li p h1 h2 b i) for example, ignoring that some of these may be reserved words (or not). Now here is the crux... I have no idea to pass the name of the file that contains this list to the program so that it is dymanically generated. The second issue is that I do not want to recompile the script everytime it runs. I would like it to run with a single setup file and keep going with that without having to go through a recompilation each time it is invoked. Thank you for your wise consideration Hackmare
Back to
Seekers of Perl Wisdom
|
|