Thread Prüfen ob ein Modul installiert ist (16 answers)
Opened by roli at 2007-03-13 14:24

pq
 2007-03-13 16:53
#75016 #75016
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=GwenDragon,13.03.2007, 13:34]
Code: (dl )
1
2
eval "require NonExistantPackage;";
print "Modul nicht installiert" if $@;
[/quote]
bei require kann man auch block-eval nehmen.
Code: (dl )
1
2
3
4
eval {
 require Module;
};
print "Modul nicht installiert" if $@;
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 Prüfen ob ein Modul installiert ist