Leser: 30
1 2 3 4 5 6 7 8 9
my $utc_module; BEGIN { if ($^O eq 'win32') { # oder Win32, keine ahnung $utc_module = eval "use Win32::Something (...); 1;" || 0; } else { $utc_module = 0; } }
1 2 3 4 5 6 7 8 9 10 11 12
if($^O =~ /mswin/i){ print "huhu, Windows!\n"; eval{ require HottenTott; }; if($@){ print "Noee, no way!\n"; } else{ import HottenTott; } }
2011-03-28T17:38:01 pqfind ich persönlich umständlicher als alles in einem rutsch mit eval use.
1 2 3 4 5
# mal gucken.... eval{ die "Vielleicht?"; }; # ob das eine Exception wirft ;)