Thread Routinen erzeugen (18 answers)
Opened by bloonix at 2007-01-30 16:53

pq
 2007-01-30 21:34
#73846 #73846
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
[quote=opi,30.01.2007, 15:53]
Code: (dl )
1
2
3
for (qw(foo bar)) {
  *{"$_"} = sub { my $self = shift; $self->foobar("$_", @_); };
}
[/quote]
Code: (dl )
1
2
3
4
for my $sub (qw(foo bar)) {
  no strict 'refs';
  *$sub = sub { my $self = shift; $self->foobar($sub, @_); };
}
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 Routinen erzeugen