Skip to content

Commit

Permalink
Patches to turn on fallback behavior with Template::Exception's overl…
Browse files Browse the repository at this point in the history
…oading

so string conversion happens if you try to do any op on it that's not
defined with is probably the thing to do to DTRT.


git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@608 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information
2shortplanks committed Jan 28, 2003
1 parent c87bba2 commit 47d0037
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Template/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use vars qw( $VERSION );
use constant TYPE => 0;
use constant INFO => 1;
use constant TEXT => 2;
use overload q|""| => "as_string";
use overload q|""| => "as_string", fallback => 1;


$VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/);
Expand Down Expand Up @@ -241,4 +241,4 @@ modify it under the same terms as Perl itself.
=head1 SEE ALSO
L<Template|Template>, L<Template::Context|Template::Context>
L<Template|Template>, L<Template::Context|Template::Context>
3 changes: 3 additions & 0 deletions t/exception.t
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ ok( $e3 );
ok( $e3->text() eq '');
ok( $e3->as_string() eq 'e3.type error - e3.info' );

# test to check that overloading fallback works properly
# by using a non explicitly defined op
ok( $e3 ne "fish");

0 comments on commit 47d0037

Please sign in to comment.