Created
          August 3, 2009 02:48 
        
      - 
      
- 
        Save typester/160340 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | diff --git a/lib/Text/MicroTemplate.pm b/lib/Text/MicroTemplate.pm | |
| index 2f00f51..bbfdd62 100644 | |
| --- a/lib/Text/MicroTemplate.pm | |
| +++ b/lib/Text/MicroTemplate.pm | |
| @@ -393,6 +393,8 @@ package Text::MicroTemplate::EncodedString; | |
| use strict; | |
| use warnings; | |
| +use overload q{""} => sub { shift->as_string }, fallback => 1; | |
| + | |
| sub new { | |
| my ($klass, $str) = @_; | |
| bless \$str, $klass; | |
| diff --git a/t/03-modes.t b/t/03-modes.t | |
| index 0bb1987..ea71038 100644 | |
| --- a/t/03-modes.t | |
| +++ b/t/03-modes.t | |
| @@ -1,6 +1,6 @@ | |
| use strict; | |
| use warnings; | |
| -use Test::More tests => 6; | |
| +use Test::More tests => 8; | |
| use Text::MicroTemplate qw(:all); | |
| # comment | |
| @@ -17,6 +17,10 @@ do { | |
| is render_mt('<?= $_[0] ?>', 'foo<a')->as_string, 'foo<a'; | |
| my $rs = encoded_string('foo<a'); | |
| is render_mt('<?= $_[0] ?>', $rs)->as_string, 'foo<a'; | |
| + | |
| + # overload | |
| + is $rs, 'foo<a'; | |
| + is render_mt('<?= $_[0] ?>', $rs), 'foo<a'; | |
| }; | |
| do { | |
| use utf8; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment