| 1 | package the; | ||||||||||
| 2 | 3 | ▶ | use 5.006001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | no warnings 'redefine'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | our $VERSION = '0.15'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=5 SCAR=16.4
| |||||||||||
| 7 | 1 | my $package = caller; | |||||||||
| 8 | 5 | ▶ | *{"${package}::$_"} = sub { return wantarray ? @_ : $_[0] } | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||
| 9 | 1 | for qw(a an teh the more); | |||||||||
| 10 | 1 | my ($class, $module) = @_; | |||||||||
| 11 | 1 | ▶ | if ($module) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 1 | eval "require $module"; | |||||||||
| 13 | 1 | ▶ | die $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 1 | splice @_, 0, 1; | |||||||||
| 15 | 1 | ▶ | my $import = $module->can('import') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | or return; | ||||||||||
| 17 | 1 | goto &$import; | |||||||||
| 18 | } | ||||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | sub unimport { | ||||||||
|
Subroutine
unimport: called CC=5 SCAR=16.6
| |||||||||||
| 22 | 2 | my $package = caller; | |||||||||
| 23 | 6 | ▶ | *{"${package}::$_"} = sub { return wantarray ? @_ : $_[0] } | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||
| 24 | 6 | for qw(a an teh the more); | |||||||||
| 25 | 2 | my ($class, $module) = @_; | |||||||||
| 26 | 1 | ▶ | if ($module) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 1 | eval "require $module"; | |||||||||
| 28 | 1 | ▶ | die $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 1 | splice @_, 0, 1; | |||||||||
| 30 | 1 | ▶ | my $unimport = $module->can('unimport') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | or return; | ||||||||||
| 32 | 1 | goto &$unimport; | |||||||||
| 33 | } | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | |||||||||||
| 37 | 2 | *{"a::"} = | |||||||||
| 38 | 2 | *{"an::"} = | |||||||||
| 39 | 2 | *{"more::"} = | |||||||||
| 40 | 2 | *{"teh::"} = | |||||||||
| 41 | 2 | *{"the::"}; | |||||||||
| 42 | |||||||||||
| 43 | 2 | 1; | |||||||||
| 44 | |||||||||||
| 45 | =encoding utf8 | ||||||||||
| 46 | |||||||||||
| 47 | =head1 NAME | ||||||||||
| 48 | |||||||||||
| 49 | the - This is teh, best module evar! | ||||||||||
| 50 | |||||||||||
| 51 | =head1 SYNOPSIS | ||||||||||
| 52 | |||||||||||
| 53 | use the Moose; | ||||||||||
| 54 | |||||||||||
| 55 | has teh stuffz => (is => a 'rw'); | ||||||||||
| 56 | |||||||||||
| 57 | the my an $a = teh $b + a $c; | ||||||||||
| 58 | |||||||||||
| 59 | no more 'Moose'; | ||||||||||
| 60 | |||||||||||
| 61 | =head1 DESCRIPTION | ||||||||||
| 62 | |||||||||||
| 63 | teh module exports the subroutine and the module exports a subroutine. | ||||||||||
| 64 | Just use an module, then use more subroutine. | ||||||||||
| 65 | |||||||||||
| 66 | =head1 AUTHOR | ||||||||||
| 67 | |||||||||||
| 68 | Ingy döt Net <ingy@cpan.org> | ||||||||||
| 69 | |||||||||||
| 70 | =head1 COPYRIGHT | ||||||||||
| 71 | |||||||||||
| 72 | Copyright (c) 2008. Ingy döt Net. | ||||||||||
| 73 | |||||||||||
| 74 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 75 | under the same terms as Perl itself. | ||||||||||
| 76 | |||||||||||
| 77 | See http://www.perl.com/perl/misc/Artistic.html | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||