1
#============================================================= -*-Perl-*-
6
# Visitor class for creating a view of all or part of a Pod Object
10
# Andy Wardley <abw@kfs.org>
13
# Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
15
# This module is free software; you can redistribute it and/or
16
# modify it under the same terms as Perl itself.
21
#========================================================================
23
package Pod::POM::View;
28
use vars qw( $VERSION $DEBUG $ERROR $AUTOLOAD );
30
$VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
31
$DEBUG = 0 unless defined $DEBUG;
34
#------------------------------------------------------------------------
36
#------------------------------------------------------------------------
40
my $args = ref $_[0] eq 'HASH' ? shift : { @_ };
41
bless { %$args }, $class;
46
my ($self, $item) = @_;
47
return UNIVERSAL::can($item, 'present')
48
? $item->present($self) : $item;
53
my ($self, $type, $node) = @_;
64
return if $name eq 'DESTROY';
66
# my ($pkg, $file, $line) = caller;
67
# print STDERR "called AUTOLOAD $name from $file line $line\n";
69
if ($name =~ s/^view_//) {
70
return $self->view($name, @_);
73
die "can't access $name in $self\n";
76
die "no such method for $self: $name ($AUTOLOAD)"
77
unless defined ($item = $self->{ $name });
79
return wantarray ? ( ref $item eq 'ARRAY' ? @$item : $item ) : $item;