Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2010/01/28

Solutions to my Remedial Perl Module Problems

Thanks to Stack Overflow, I can move forward. Stupid examples below.

test.pl
  1. #!/usr/bin/perl  
  2. use 5.010 ;  
  3. use strict ;  
  4. use warnings ;  
  5.   
  6. #use Dumb::Database ':all' ;  
  7. use Dumb ':all' ;  
  8.   
  9. my_dumb_function() ;  


Dumb.pm
  1. package Dumb ;  
  2. use 5.010 ;  
  3. use strict;  
  4. use warnings;  
  5. use Exporter qw(import);  
  6. use lib '/home/jacoby/lib' ;  
  7. use Dumb::Database ':all' ;  
  8.   
  9. our %EXPORT_TAGS = ('all' => [ qw(  
  10.                                    my_dumb_function  
  11.                             ) ],  
  12.                     );  
  13. our @EXPORT_OK   = ( @{$EXPORT_TAGS{'all'}} );  
  14. our $VERSION = 0.0.1;  
  15.   
  16. 1;  


Dumb/Database.pm
  1. package Dumb::Database ;  
  2. use 5.010 ;  
  3. use strict;  
  4. use warnings;  
  5.   
  6. use Exporter qw(import);  
  7. our %EXPORT_TAGS = ('all' => [ qw(  
  8.                                    my_dumb_function  
  9.                             ) ],  
  10.                     );  
  11. our @EXPORT_OK   = ( @{$EXPORT_TAGS{'all'}} );  
  12.   
  13. sub my_dumb_function {  
  14.     say 'dumb' ;  
  15.     }  
  16. 1;  

No comments:

Post a Comment