To add on to the suggestions above, I would also put it all in a BEGIN block.
#!/usr/bin/perl use strict; use warnings; use vars qw( $ne_loaded ); + BEGIN { eval "use Non::Existent"; if ($@) { warn "You don't have Non::Existent installed so..."; $ne_loaded = 0; } }
In reply to Re: Optional modules?
by crouchingpenguin
in thread Optional modules?
by Jeppe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |