my @prereqs = qw(DBI DBIx::AnyDBD); foreach my $prereq (@prereqs) { eval "use $prereq;"; die "Blah\n" if $@; my $v = $prereq->VERSION; print "Found $prereq version $v\n"; }
You could use symbolic references ($v = ${"${prereq}::VERSION"};), but it's smarter to use the methods handed to you. :-)
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In reply to Re: eliminating warnings with conditional uses
by dragonchild
in thread eliminating warnings with conditional uses
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |