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.60';
7 30     30   215 use strict;
  30         92  
  30         864  
8 30     30   163 use warnings;
  30         79  
  30         738  
9              
10 30     30   165 use HTML::Mason::Component;
  30         71  
  30         1093  
11              
12 30     30   209 use vars qw(@ISA);
  30         72  
  30         2630  
13              
14             @ISA = qw(HTML::Mason::Component);
15              
16 30     30   248 use HTML::Mason::MethodMaker ( read_only => [ qw( comp_id is_method name owner path ) ] );
  30         104  
  30         286  
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 225 my $self = shift;
23 120         543 ($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 276 my ($self, $interp, $source) = @_;
31 120         619 $self->SUPER::assign_runtime_properties($interp, $source);
32 120 100       466 $self->{comp_id} = sprintf("[%s '%s' of %s]", $self->{is_method} ? 'method' : 'subcomponent',
33             $self->name, $self->owner->comp_id);
34 120         378 my $owner_path = $self->owner->path;
35 120 50       325 $owner_path = q{} unless defined $owner_path;
36 120         386 $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 389 sub dir_path { return $_[0]->owner->dir_path }
43 25     25 1 130 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 26 sub title { return $_[0]->owner->title . ":" . $_[0]->name }
48              
49             1;
50              
51             __END__