File Coverage

blib/lib/Text/MicroMason/StoreOne.pm
Criterion Covered Total %
statement 14 14 100.0
branch 7 8 87.5
condition n/a
subroutine 3 3 100.0
pod 3 3 100.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Text::MicroMason::StoreOne;
2              
3             ######################################################################
4              
5             sub create {
6 14     14 1 156 my ( $class, %options ) = @_;
7 14         23 my @compile;
8 14 100       54 if ( my $file = delete $options{filename} ) {
    100          
9 5         11 @compile = ( 'file' => $file );
10             } elsif ( my $string = delete $options{text} ) {
11 2         6 @compile = ( 'text' => $string );
12             }
13 14         60 my $self = $class->NEXT('create', %options);
14 14 100       58 $self->compile( @compile ) if @compile;
15 14         90 $self;
16             }
17              
18             sub compile {
19 9     9 1 771 my $self = shift;
20 9         31 my $sub = $self->NEXT('compile', @_);
21 9         122 $self->{last_compile} = $sub;
22             }
23              
24             sub execute_again {
25 12     12 1 25 my $self = shift;
26             my $sub = $self->{last_compile}
27 12 50       33 or $self->croak_msg("No template has been compiled yet");
28 12         36 &$sub( @_ );
29             }
30              
31             ######################################################################
32              
33             1;
34              
35             __END__