File Coverage

blib/lib/HTML/Mason/Component/Subcomponent.pm
Criterion Covered Total %
statement 26 32 81.2
branch 3 4 75.0
condition n/a
subroutine 10 16 62.5
pod 6 11 54.5
total 45 63 71.4


line stmt bran cond sub pod time code
1             # Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved.
2             # This program is free software; you can redistribute it and/or modify
3             # it under the same terms as Perl itself.
4              
5             package HTML::Mason::Component::Subcomponent;
6             $HTML::Mason::Component::Subcomponent::VERSION = '1.58';
7 30     30   177 use strict;
  30         62  
  30         825  
8 30     30   138 use warnings;
  30         52  
  30         731  
9              
10 30     30   155 use HTML::Mason::Component;
  30         54  
  30         713  
11              
12 30     30   146 use vars qw(@ISA);
  30         57  
  30         1959  
13              
14             @ISA = qw(HTML::Mason::Component);
15              
16 30     30   173 use HTML::Mason::MethodMaker ( read_only => [ qw( comp_id is_method name owner path ) ] );
  30         60  
  30         233  
17              
18             #
19             # Assign parent, name, and is_method flag when owner component is created.
20             #
21             sub assign_subcomponent_properties {
22 120     120 0 212 my $self = shift;
23 120         445 ($self->{owner}, $self->{name}, $self->{is_method}) = @_;
24             }
25              
26             #
27             # Override path that would be set by parent's version of method.
28             #
29             sub assign_runtime_properties {
30 120     120 0 280 my ($self, $interp, $source) = @_;
31 120         551 $self->SUPER::assign_runtime_properties($interp, $source);
32 120 100       411 $self->{comp_id} = sprintf("[%s '%s' of %s]", $self->{is_method} ? 'method' : 'subcomponent',
33             $self->name, $self->owner->comp_id);
34 120         288 my $owner_path = $self->owner->path;
35 120 50       291 $owner_path = q{} unless defined $owner_path;
36 120         335 $self->{path} = $owner_path . ":" . $self->name;
37             }
38              
39 0     0 0 0 sub cache_file { return $_[0]->owner->cache_file }
40 0     0 1 0 sub load_time { return $_[0]->owner->load_time }
41 0     0 0 0 sub compiler_id { return $_[0]->owner->compilation_params }
42 126     126 1 323 sub dir_path { return $_[0]->owner->dir_path }
43 25     25 1 105 sub is_subcomp { 1 }
44 0     0 1 0 sub object_file { return $_[0]->owner->object_file }
45 0     0 1 0 sub parent { return $_[0]->owner->parent }
46 0     0 0 0 sub persistent { return $_[0]->owner->persistent }
47 11     11 1 27 sub title { return $_[0]->owner->title . ":" . $_[0]->name }
48              
49             1;
50              
51             __END__