[Templates-cvs] cvs commit: TT3/lib/Template Exception.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Fri, 10 Dec 2004 12:50:08 +0000
cvs 04/12/10 12:50:08
Modified: lib/Template Exception.pm
Log:
* changed exception to accept hash ref as first argument to new()
Revision Changes Path
1.4 +14 -4 TT3/lib/Template/Exception.pm
Index: Exception.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/Exception.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Exception.pm 2004/11/26 12:42:35 1.3
+++ Exception.pm 2004/12/10 12:50:07 1.4
@@ -16,7 +16,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Exception.pm,v 1.3 2004/11/26 12:42:35 abw Exp $
+# $Id: Exception.pm,v 1.4 2004/12/10 12:50:07 abw Exp $
#
# TODO
# Decide if exceptions still need to handle text buffers and how
@@ -31,7 +31,7 @@
use Template::Base;
use base qw( Template::Base );
-our $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
+our $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $FORMAT = '<type> error - <info>' unless defined $FORMAT;
@@ -50,7 +50,17 @@
#------------------------------------------------------------------------
sub new {
- my ($class, $type, $info, $text) = @_;
+ my $class = shift;
+ my ($type, $info, $text);
+
+ if (@_ && UNIVERSAL::isa($_[0], 'HASH')) {
+ my $hash = shift;
+ ($type, $info, $text) = @$hash{ qw( type info text ) };
+ }
+ else {
+ ($type, $info, $text) = @_;
+ }
+
my $default;
# look for $DEFAULT hash in derived package
@@ -277,7 +287,7 @@
=head1 VERSION
-$Revision: 1.3 $
+$Revision: 1.4 $
=head1 COPYRIGHT