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 154 my ( $class, %options ) = @_;
7 14         18 my @compile;
8 14 100       43 if ( my $file = delete $options{filename} ) {
    100          
9 5         7 @compile = ( 'file' => $file );
10             } elsif ( my $string = delete $options{text} ) {
11 2         5 @compile = ( 'text' => $string );
12             }
13 14         50 my $self = $class->NEXT('create', %options);
14 14 100       43 $self->compile( @compile ) if @compile;
15 14         68 $self;
16             }
17              
18             sub compile {
19 9     9 1 623 my $self = shift;
20 9         21 my $sub = $self->NEXT('compile', @_);
21 9         102 $self->{last_compile} = $sub;
22             }
23              
24             sub execute_again {
25 12     12 1 16 my $self = shift;
26             my $sub = $self->{last_compile}
27 12 50       27 or $self->croak_msg("No template has been compiled yet");
28 12         25 &$sub( @_ );
29             }
30              
31             ######################################################################
32              
33             1;
34              
35             __END__