[Templates-cvs] cvs commit: TT3/lib/Template/TT3 Constants.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Thu, 11 Dec 2003 15:12:09 +0000
cvs 03/12/11 15:12:09
Added: lib/Template/TT3 Constants.pm
Log:
added Constants.pm
Revision Changes Path
1.1 TT3/lib/Template/TT3/Constants.pm
Index: Constants.pm
===================================================================
#============================================================= -*-perl-*-
#
# Template::TT3::Constants
#
# DESCRIPTION
# Defines constants used by othe Template::TT3 modules.
#
# AUTHOR
# Andy Wardley <abw@wardley.org>
#
# COPYRIGHT
# Copyright (C) 1996-2003 Andy Wardley. All Rights Reserved.
# Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# REVISION
# $Id: Constants.pm,v 1.1 2003/12/11 15:12:09 abw Exp $
#
#========================================================================
package Template::TT3::Constants;
require Exporter;
use strict;
use warnings;
use base qw( Exporter );
use vars qw( $VERSION @EXPORT_OK %EXPORT_TAGS );
use vars qw( @CHOMP );
$VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);
# CHOMP constants for PRE_CHOMP and POST_CHOMP
use constant CHOMP_NONE => 0; # do not remove whitespace
use constant CHOMP_ALL => 1; # remove whitespace
use constant CHOMP_COLLAPSE => 2; # collapse whitespace to single space
@CHOMP = qw( CHOMP_NONE CHOMP_ALL CHOMP_COLLAPSE );
@EXPORT_OK = ( @CHOMP );
%EXPORT_TAGS = (
'all' => [ @EXPORT_OK ],
'chomp' => [ @CHOMP ],
);
1;
__END__
=head1 NAME
Template::TT3::Constants - defines constants for other TT modules
=head1 SYNOPSIS
use Template::TT3::Constants;
# TODO
=head1 DESCRIPTION
This module defines a number of constants used by other modules in the
Template Toolkit. They can be used by specifying the
Template::Constants package explicitly as part of the name:
use Template::TT3::Constants;
$chomp = Template::TT3::Constants::CHOMP_ALL;
Constants may be imported into the caller's namespace by naming them as
options to the C<use Template::TT3::Constants> statement:
use Template::TT3::Constants qw( CHOMP_ALL );
$chomp = CHOMP_ALL;
Alternatively, one of the tagset identifiers may be specified
to import different sets of constants.
use Template::TT3::Constants qw( :chomp );
$chomp = CHOMP_ALL;
=head1 EXPORTABLE TAG SETS
The following tag sets and associated constants are defined:
:exception # constants relating to exception handling
TYPE # 0 - first field of Template::TT3::Exception
INFO # 1 - second field
TEXT # 2 - third field
:all All the above constants.
=head1 AUTHOR
Andy Wardley E<lt>abw@wardley.orgE<gt>
=head1 VERSION
$Revision: 1.1 $
=head1 COPYRIGHT
Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved.
Copyright (C) 1998-2002 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SEE ALSO
See L<Exporter> for more information on exporting variables.
=cut
# Local Variables:
# mode: perl
# perl-indent-level: 4
# indent-tabs-mode: nil
# End:
#
# vim: expandtab shiftwidth=4: