/usr/share/perl5/HTML/Mason/Component/Subcomponent.pm is in libhtml-mason-perl 1:1.56-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | # Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
package HTML::Mason::Component::Subcomponent;
$HTML::Mason::Component::Subcomponent::VERSION = '1.56';
use strict;
use warnings;
use HTML::Mason::Component;
use vars qw(@ISA);
@ISA = qw(HTML::Mason::Component);
use HTML::Mason::MethodMaker ( read_only => [ qw( comp_id is_method name owner path ) ] );
#
# Assign parent, name, and is_method flag when owner component is created.
#
sub assign_subcomponent_properties {
my $self = shift;
($self->{owner}, $self->{name}, $self->{is_method}) = @_;
}
#
# Override path that would be set by parent's version of method.
#
sub assign_runtime_properties {
my ($self, $interp, $source) = @_;
$self->SUPER::assign_runtime_properties($interp, $source);
$self->{comp_id} = sprintf("[%s '%s' of %s]", $self->{is_method} ? 'method' : 'subcomponent',
$self->name, $self->owner->comp_id);
my $owner_path = $self->owner->path;
$owner_path = q{} unless defined $owner_path;
$self->{path} = $owner_path . ":" . $self->name;
}
sub cache_file { return $_[0]->owner->cache_file }
sub load_time { return $_[0]->owner->load_time }
sub compiler_id { return $_[0]->owner->compilation_params }
sub dir_path { return $_[0]->owner->dir_path }
sub is_subcomp { 1 }
sub object_file { return $_[0]->owner->object_file }
sub parent { return $_[0]->owner->parent }
sub persistent { return $_[0]->owner->persistent }
sub title { return $_[0]->owner->title . ":" . $_[0]->name }
1;
__END__
=head1 NAME
HTML::Mason::Component::Subcomponent - Mason Subcomponent Class
=head1 DESCRIPTION
This is a subclass of
L<HTML::Mason::Component|HTML::Mason::Component>. Mason uses it to
implement both subcomponents (defined by C<< <%def> >>) and methods (defined
by C<< <%method> >>).
A subcomponent/method gets most of its properties from its owner. Note
that the link from the subcomponent to its owner is a weak reference
(to prevent circular references), so if you grab a subcomponent/method
object, you should also grab and hold a reference to its owner. If the
owner goes out of scope, the subcomponent/method object will become unusable.
=head1 METHODS
=over 4
=item is_method
Returns 1 if this is a method (declared by C<< <%method> >>), 0 if it is a
subcomponent (defined by c<< <%def> >>).
=item owner
Returns the component object within which this subcomponent or method
was defined.
=back
=cut
|