/usr/share/perl5/Pod/POM/View.pm is in libpod-pom-perl 0.29-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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #============================================================= -*-Perl-*-
#
# Pod::POM::View
#
# DESCRIPTION
# Visitor class for creating a view of all or part of a Pod Object
# Model.
#
# AUTHOR
# Andy Wardley <abw@kfs.org>
#
# COPYRIGHT
# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
# $Id: View.pm 32 2009-03-17 21:08:25Z ford $
#
#========================================================================
package Pod::POM::View;
require 5.004;
use strict;
use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD $INSTANCE );
$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
#------------------------------------------------------------------------
# new($pom)
#------------------------------------------------------------------------
sub new {
my $class = shift;
my $args = ref $_[0] eq 'HASH' ? shift : { @_ };
bless { %$args }, $class;
}
sub print {
my ($self, $item) = @_;
return UNIVERSAL::can($item, 'present')
? $item->present($self) : $item;
}
sub view {
my ($self, $type, $node) = @_;
return $node;
}
sub instance {
my $self = shift;
my $class = ref $self || $self;
no strict 'refs';
my $instance = \${"$class\::_instance"};
defined $$instance
? $$instance
: ($$instance = $class->new(@_));
}
sub visit {
my ($self, $place) = @_;
$self = $self->instance() unless ref $self;
my $visit = $self->{ VISIT } ||= [ ];
push(@$visit, $place);
return $place;
}
sub leave {
my ($self, $place) = @_;
$self = $self->instance() unless ref $self;
my $visit = $self->{ VISIT };
return $self->error('empty VISIT stack') unless @$visit;
pop(@$visit);
}
sub visiting {
my ($self, $place) = @_;
$self = $self->instance() unless ref $self;
my $visit = $self->{ VISIT };
return 0 unless $visit && @$visit;
foreach (reverse @$visit) {
return 1 if $_ eq $place;
}
return 0;
}
sub AUTOLOAD {
my $self = shift;
my $name = $AUTOLOAD;
my $item;
$name =~ s/.*:://;
return if $name eq 'DESTROY';
if ($name =~ s/^view_//) {
return $self->view($name, @_);
}
elsif (! ref $self) {
die "can't access $name in $self\n";
}
else {
die "no such method for $self: $name ($AUTOLOAD)"
unless defined ($item = $self->{ $name });
return wantarray ? ( ref $item eq 'ARRAY' ? @$item : $item ) : $item;
}
}
1;
=head1 NAME
Pod::POM::View - view POM objects
=head1 DESCRIPTION
Visitor class for creating a view of all or part of a Pod Object Model.
=head1 METHODS
=over 4
=item C<new>
=item C<print>
=item C<view>
=item C<instance>
=item C<visit>
=item C<leave>
=item C<visiting>
=back
=head1 AUTHOR
Andy Wardley E<lt>abw@kfs.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
|