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.59';
7 30     30   216 use strict;
  30         65  
  30         869  
8 30     30   147 use warnings;
  30         64  
  30         750  
9              
10 30     30   159 use HTML::Mason::Component;
  30         67  
  30         1117  
11              
12 30     30   178 use vars qw(@ISA);
  30         82  
  30         2644  
13              
14             @ISA = qw(HTML::Mason::Component);
15              
16 30     30   235 use HTML::Mason::MethodMaker ( read_only => [ qw( comp_id is_method name owner path ) ] );
  30         66  
  30         271  
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 255 my $self = shift;
23 120         482 ($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 284 my ($self, $interp, $source) = @_;
31 120         616 $self->SUPER::assign_runtime_properties($interp, $source);
32 120 100       450 $self->{comp_id} = sprintf("[%s '%s' of %s]", $self->{is_method} ? 'method' : 'subcomponent',
33             $self->name, $self->owner->comp_id);
34 120         306 my $owner_path = $self->owner->path;
35 120 50       304 $owner_path = q{} unless defined $owner_path;
36 120         359 $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 390 sub dir_path { return $_[0]->owner->dir_path }
43 25     25 1 113 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 30 sub title { return $_[0]->owner->title . ":" . $_[0]->name }
48              
49             1;
50              
51             __END__