Thread Bad name after...
(52 answers)
Opened by bianca at 2015-02-19 12:08 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 use strict; use warnings; use IO::File; my @units = qw(foo bar); foreach my $unit(@units){ my $source = do{ my $fh = IO::File->new; $fh->open("$unit.pm", "r") or die $!; read($fh, my $buffer, -s $fh); $fh->close; "package $unit;\n".$buffer; }; eval "$source"; $unit->foo(); # FQN: Der Name der Package ist das erste Argument! } Last edited: 2015-02-20 07:53:04 +0100 (CET) |