public
Description: My personal script stash
Homepage: http://github.com/melo/scripts
Clone URL: git://github.com/melo/scripts.git
Search Repo:
Added the `require_module` funtion to detect missing modules and suggest 
solutions

Signed-off-by: Pedro Melo <melo@simplicidade.org>
melo (author)
Sat May 03 01:38:08 -0700 2008
commit  a7401a23690309fa3e2e84101aded8c2b2dbda3d
tree    e2e8972c2a9ad33788a78fa359cd9a9d5c3cddf9
parent  e33d6b2f3065dd62ac0c0767c0b35b0770620b5f
...
12
13
14
15
 
16
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
12
13
14
 
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
0
@@ -12,7 +12,23 @@
0
 
0
 use strict;
0
 use warnings;
0
-use Lingua::Bork qw( bork );
0
+require_module('Lingua::Bork', qw(bork));
0
 
0
 print bork($_) while (<>);
0
+
0
+#################################
0
+# My little require module method
0
+
0
+sub require_module {
0
+ my $module = shift;
0
+
0
+ eval "require $module";
0
+ if (my $e = $@) {
0
+ print STDERR "FATAL: $0 requires the Perl module '$module'.\n\n";
0
+ print STDERR "You can install it with:\n\n";
0
+ print STDERR " cpan $module\n\n";
0
+ exit(1);
0
+ }
0
+ $module->import(@_);
0
+}

Comments

    No one has commented yet.