| 1 | package EPUB::Parser::Util::Context; | ||||||||||
| 2 | 14 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 14 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 14 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 14 | ▶ | use Smart::Args; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 14 | ▶ | use Exporter qw/import/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 14 | our @EXPORT_OK = qw/ child_class context_name parser /; | |||||||||
| 9 | |||||||||||
| 10 | 17 | ▶ | sub child_class { | ||||||||
|
Subroutine
child_class: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 11 | 17 | args( | |||||||||
| 12 | my $class => 'ClassName', | ||||||||||
| 13 | my $context_name => 'Str', | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | 17 | my $child_class = sprintf( "%s::%s", $class, ucfirst($context_name) ); | |||||||||
| 17 | |||||||||||
| 18 | 17 | local $@; | |||||||||
| 19 | 17 | eval "require $child_class"; | |||||||||
| 20 | 17 | ▶ | die $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 17 | return $child_class; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 44 | ▶ | sub context_name { shift->{context_name} } | ||||||||
|
Subroutine
context_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 26 | |||||||||||
| 27 | 44 | ▶ | sub parser { | ||||||||
|
Subroutine
parser: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 28 | 44 | my $self = shift; | |||||||||
| 29 | 44 | my $context = 'in_' . $self->context_name; | |||||||||
| 30 | 44 | $self->{parser}->$context; | |||||||||
| 31 | 44 | $self->{parser}; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 14 | 1; | |||||||||
| 36 | |||||||||||