| 1 | package Text::MicroMason::StoreOne; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | ###################################################################### | ||||||||||||||
| 4 | |||||||||||||||
| 5 | 14 | ▶ | sub create { | ||||||||||||
|
Subroutine
create: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||
| 6 | 14 | my ( $class, %options ) = @_; | |||||||||||||
| 7 | 14 | my @compile; | |||||||||||||
| 8 | 14 | ▶ | if ( my $file = delete $options{filename} ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 9 | 5 | @compile = ( 'file' => $file ); | |||||||||||||
| 10 | } elsif ( my $string = delete $options{text} ) { | ||||||||||||||
| 11 | 2 | @compile = ( 'text' => $string ); | |||||||||||||
| 12 | } | ||||||||||||||
| 13 | 14 | my $self = $class->NEXT('create', %options); | |||||||||||||
| 14 | 14 | ▶ | $self->compile( @compile ) if @compile; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 15 | 14 | $self; | |||||||||||||
| 16 | } | ||||||||||||||
| 17 | |||||||||||||||
| 18 | 9 | ▶ | sub compile { | ||||||||||||
|
Subroutine
compile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 19 | 9 | my $self = shift; | |||||||||||||
| 20 | 9 | my $sub = $self->NEXT('compile', @_); | |||||||||||||
| 21 | 9 | $self->{last_compile} = $sub; | |||||||||||||
| 22 | } | ||||||||||||||
| 23 | |||||||||||||||
| 24 | 12 | ▶ | sub execute_again { | ||||||||||||
|
Subroutine
execute_again: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||
| 25 | 12 | my $self = shift; | |||||||||||||
| 26 | my $sub = $self->{last_compile} | ||||||||||||||
| 27 | 12 | ▶ | or $self->croak_msg("No template has been compiled yet"); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | 12 | &$sub( @_ ); | |||||||||||||
| 29 | } | ||||||||||||||
| 30 | |||||||||||||||
| 31 | ###################################################################### | ||||||||||||||
| 32 | |||||||||||||||
| 33 | 2 | 1; | |||||||||||||
| 34 | |||||||||||||||
| 35 | __END__ | ||||||||||||||