Thread Module-Path ermitteln (8 answers)
Opened by esskar at 2005-04-08 01:03

pq
 2005-04-08 13:22
#53587 #53587
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
[quote=esskar,08.04.2005, 00:41]
Code: (dl )
1
2
3
4
5
6
my $name = "";
my $basename = Ox::File::basename($filename, ".pm");

require "$pckpath/Type/$basename.pm";
eval '$name = $'.$pck.'::Type::'.$basename.'::Name';
die "[$name]";


:)[/quote]
iih, wieso denn eval, wenns auch mit symrefs geht:
my $name;
{ no strict 'refs';
 $name = ${ $pck.'::Type::'.$basename.'::Name' };
}
\n\n

<!--EDIT|pq|1112952174-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Module-Path ermitteln