Thread Klassenaufruf aus Variable erstellen? (12 answers)
Opened by roooot at 2010-04-07 14:04

pq
 2010-04-07 14:18
#135794 #135794
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
2010-04-07T12:04:31 roooot
Code (perl): (dl )
1
2
3
4
$foo = 'klasse'; # kleingeschrieben
$bar = 'losgehts';
# soll werden zu
new Klasse->losgehts;

ich wess nicht genau, was "new Klasse->losgehts" für eine syntax sein soll, daher nehme ich mal an, das "new" ist hier ein vertipper. dann geht das ganz einfach:
Code (perl): (dl )
"\u$foo"->$bar;
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 Klassenaufruf aus Variable erstellen?