PurpleWiki::View::Driver

PurpleWiki::View::Driver is a Perl module to view driver base class.
Download

PurpleWiki::View::Driver Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Matthew O'Connor
  • Publisher web site:
  • http://search.cpan.org/~cdent/PurpleWiki-0.94/PurpleWiki/View/Driver.pm

PurpleWiki::View::Driver Tags


PurpleWiki::View::Driver Description

PurpleWiki::View::Driver is a Perl module to view driver base class. PurpleWiki::View::Driver is a Perl module to view driver base class.SYNOPSISThe PurpleWiki::View::Driver is primarily used as a base class, because by itself it doesn't do anything but traverse a PurpleWiki::Tree. This example defines a view driver that extracts image links from a PurpleWiki::Tree. package PurpleWiki::View::getImages; use strict; use warnings; use PurpleWiki::View::Driver; use vars qw(@ISA); @ISA = qw(PurpleWiki::View::Driver); sub new { my $prototype = shift; my $class = ref($prototype) || $prototype; my $self = $class->SUPER::new(@_); # Object State $self->{images} = []; bless($self, $class); return $self; } sub view { my ($self, $tree) = @_; $self->SUPER::view($tree); return @{$self->{images}}; } sub imageMain { my ($self, $nodeRef) = @_; push @{$self->{images}}, $nodeRef->href; } 1;PurpleWiki::View::Driver is the base class used by all of the view drivers. Its default behavior is to recurse down a PurpleWiki::Tree depth first from left most (oldest) child to right most (youngest) child. Child nodes are represented as a list within a PurpleWiki::Tree, so left most means the first child in the list and right most means the last child in the list.Other than the methods mentioned in the METHODS section, this class also uses AUTOLOAD to export pre, main, and post handling methods for every node type. Three generic handlers are also exported via AUTOLOAD and they are called simply "Pre()", "Main()", and "Post()" and get called on every node. Requirements: · Perl


PurpleWiki::View::Driver Related Software