Permalink
Browse files

big documentation cleanup - no longer using docsrc

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@1078 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 1ce78e6 commit a66889989f93482a228a8aad7cb19ef7a8eb298d @abw committed May 14, 2007
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -10,15 +10,11 @@
# Andy Wardley <abw@wardley.org>
#
# COPYRIGHT
-# Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved.
-# Copyright (C) 1998-2000 Canon Research Centre Europe Ltd.
+# Copyright (C) 1996-2007 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$
-#
#========================================================================
package Template::Base;
@@ -27,7 +23,7 @@ use strict;
use warnings;
use Template::Constants;
-our $VERSION = 2.77;
+our $VERSION = 2.78;
#------------------------------------------------------------------------
@@ -43,9 +39,9 @@ our $VERSION = 2.77;
sub new {
my $class = shift;
my ($argnames, @args, $arg, $cfg);
-# $class->error(''); # always clear package $ERROR var?
+# $class->error(''); # always clear package $ERROR var?
- { no strict qw( refs );
+ { no strict qw( refs );
$argnames = \@{"$class\::BASEARGS"} || [ ];
}
@@ -151,18 +147,6 @@ sub module_version {
__END__
-
-#------------------------------------------------------------------------
-# IMPORTANT NOTE
-# This documentation is generated automatically from source
-# templates. Any changes you make here may be lost.
-#
-# The 'docsrc' documentation source bundle is available for download
-# from http://www.template-toolkit.org/docs.html and contains all
-# the source templates, XML files, scripts, etc., from which the
-# documentation for the Template Toolkit is built.
-#------------------------------------------------------------------------
-
=head1 NAME
Template::Base - Base class module implementing common functionality
@@ -171,16 +155,16 @@ Template::Base - Base class module implementing common functionality
package My::Module;
use base qw( Template::Base );
-
+
sub _init {
- my ($self, $config) = @_;
- $self->{ doodah } = $config->{ doodah }
- || return $self->error("No 'doodah' specified");
- return $self;
+ my ($self, $config) = @_;
+ $self->{ doodah } = $config->{ doodah }
+ || return $self->error("No 'doodah' specified");
+ return $self;
}
-
+
package main;
-
+
my $object = My::Module->new({ doodah => 'foobar' })
|| die My::Module->error();
@@ -195,10 +179,10 @@ functionality for various Template Toolkit modules.
Constructor method which accepts a reference to a hash array or a list
of C<name =E<gt> value> parameters which are folded into a hash. The
-_init() method is then called, passing the configuration hash and should
+C<_init()> method is then called, passing the configuration hash and should
return true/false to indicate success or failure. A new object reference
is returned, or undef on error. Any error message raised can be examined
-via the error() class method or directly via the package variable ERROR
+via the L<error()> class method or directly via the C<$ERROR> package variable
in the derived class.
my $module = My::Module->new({ ... })
@@ -209,63 +193,63 @@ in the derived class.
=head2 error($msg, ...)
-May be called as an object method to get/set the internal _ERROR member
-or as a class method to get/set the $ERROR variable in the derived class's
+May be called as an object method to get/set the internal C<_ERROR> member
+or as a class method to get/set the C<$ERROR> variable in the derived class's
package.
my $module = My::Module->new({ ... })
|| die My::Module->error(), "\n";
$module->do_something()
- || die $module->error(), "\n";
+ || die $module->error(), "\n";
When called with parameters (multiple params are concatenated), this
method will set the relevant variable and return undef. This is most
often used within object methods to report errors to the caller.
package My::Module;
-
+
sub foobar {
- my $self = shift;
-
- # some other code...
-
- return $self->error('some kind of error...')
- if $some_condition;
+ my $self = shift;
+
+ # some other code...
+
+ return $self->error('some kind of error...')
+ if $some_condition;
}
=head2 debug($msg, ...)
Generates a debugging message by concatenating all arguments
-passed into a string and printing it to STDERR. A prefix is
+passed into a string and printing it to C<STDERR>. A prefix is
added to indicate the module of the caller.
package My::Module;
-
+
sub foobar {
- my $self = shift;
-
- $self->debug('called foobar()');
-
- # some other code...
+ my $self = shift;
+
+ $self->debug('called foobar()');
+
+ # some other code...
}
-When the foobar() method is called, the following message
-is sent to STDERR:
+When the C<foobar()> method is called, the following message
+is sent to C<STDERR>:
[My::Module] called foobar()
-Objects can set an internal DEBUG value which the debug()
+Objects can set an internal C<DEBUG> value which the C<debug()>
method will examine. If this value sets the relevant bits
-to indicate DEBUG_CALLER then the file and line number of
+to indicate C<DEBUG_CALLER> then the file and line number of
the caller will be appened to the message.
use Template::Constants qw( :debug );
-
+
my $module = My::Module->new({
DEBUG => DEBUG_SERVICE | DEBUG_CONTEXT | DEBUG_CALLER,
});
-
+
$module->foobar();
This generates an error message such as:
@@ -276,27 +260,18 @@ This generates an error message such as:
Andy Wardley E<lt>abw@wardley.orgE<gt>
-L<http://wardley.org/|http://wardley.org/>
-
-
-
-
-=head1 VERSION
-
-2.77, distributed as part of the
-Template Toolkit version 2.19, released on 27 April 2007.
+L<http://wardley.org/>
=head1 COPYRIGHT
- Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
-
+Copyright (C) 1996-2007 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.
=head1 SEE ALSO
-L<Template|Template>
+L<Template>
=cut
Oops, something went wrong.

0 comments on commit a668899

Please sign in to comment.