| 1 | package Class::HasA; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $VERSION = '1.00'; | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=5 SCAR=16.1
| |||||||||||
| 11 | 1 | my ($self, @args) = @_; | |||||||||
| 12 | 1 | ▶ | croak "Wrong number of arguments to import" if @args & 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | while (my ($method, $how) = splice(@args, 0,2)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 2 | my @methods = $method; | |||||||||
| 16 | 2 | ▶ | @methods = @$method if ref $method eq "ARRAY"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 2 | for $method (@methods) { | |||||||||
| 18 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 3 | ▶ | *{caller()."::$method"} = sub { (shift->$how)->$method(@_) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 20 | } | ||||||||||
| 21 | } | ||||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | # Preloaded methods go here. | ||||||||||
| 25 | |||||||||||
| 26 | 1 | 1; | |||||||||
| 27 | __END__ | ||||||||||