Created
October 1, 2009 04:01
-
-
Save Util/198715 to your computer and use it in GitHub Desktop.
Util's own stripped-down and modernized example of how to make a module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package CoolMod; | |
# Util's own stripped-down and modernized example of how to make a module. | |
# File must be named CoolMod.pm | |
# Usage: `use CoolMod qw( foo bar );` | |
use strict; | |
use warnings; | |
use base qw(Exporter); | |
our $VERSION = 1.00; | |
our @EXPORT_OK = qw( &foo &bar ); | |
sub foo { | |
print "foo got @_\n"; | |
} | |
sub bar { | |
print "bar got @_\n"; | |
} | |
1; # Mandatory! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use CoolMod qw( foo bar ); | |
foo( 'Hello', 99 ); | |
bar( 'Hi', 'Max' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment