in reply to Re^3: Can we do "use Win32:Service" on Unix ?"
in thread Can we do "use Win32:Service" on Unix ?"

My mistake. I use this

my @prereqs = ( "DBI", "MIME::Base64"); foreach (@prereqs) { if (!eval("require \($_\)")) { print "Missing prerequisite - $_\n"; exit 0; } }

Which of course doesn't have "" in the require.

VGhpcyBtZXNzYWdlIGludGVudGlvbmFsbHkgcG9pbnRsZXNz

Replies are listed 'Best First'.
Re^5: Can we do "use Win32:Service" on Unix ?"
by Tanktalus (Canon) on Jan 27, 2005 at 15:33 UTC

    Believe it or not, but I benchmarked this ... and there is a slight advantage to not recompiling strings via eval. Depending on how hungry you are for CPU cycles...

    foreach my $p (@prereqs) { (my $x = $p) =~ s[::][/]g; $x .= '.pm'; eval { require $x; } if ($@) { print "Missing prerequisite - $p\n"; exit 0; } }

    A bit more code - but a bit faster, too. The tradeoff is up to you.