Hi,

The following template:

        [% META
                author = "Sean O'Halpin"
        %]
        Author: $template.author

comes out correctly as:

        Author: Sean O'Halpin

but causes the warning:

        Use of uninitialized value in concatenation (.) at
c:/Perl/site/lib/Template/Document.pm line 241.

This is the patch I applied (where Document-org.pm is revision 2.11):

--- Document-org.pm     Fri Jun 22 16:12:10 2001
+++ Document.pm Fri Jun 22 16:15:52 2001
@@ -238,7 +238,7 @@
     $metadata = join('',
                       map

                           my $x = $metadata->{ $_ };
-                          $x =~ s/['\\]/\\$1/g;
+                          $x =~ s/(\\)/\\$1/g;
                           "'$_' => '$x',\n";
                       } keys %$metadata);

You don't need to escape the single quote - the following cases run against
the modified Document.pm show this I think:

Template:

        [% META
          test0 = 'S�an O\'Halpin'
          test1 = "S�an O\'Halpin"
          test2 = "S�an O'Halpin"
          test3 = 'S�an O\nHalpin'
          test4 = "S�an O\nHalpin"
          test5 = 'S�an O\Halpin'
          test6 = 'S�an O\\Halpin'
          test7 = "S�an O\\Halpin"
        %]
        $template.test0
        $template.test1
        $template.test2
        $template.test3
        $template.test4
        $template.test5
        $template.test6
        $template.test7

Output:

        S�an O'Halpin
        S�an O'Halpin
        S�an O'Halpin
        S�an O\nHalpin
        S�an O
        Halpin
        S�an O\Halpin
        S�an O\\Halpin
        S�an O\Halpin

Hope I'm being too pedantic about this - but I do like to be able to
use my name without programs choking (or in this case perhaps
hiccupping :) on it.

By the way, thanks Andy for such a fantastic piece of software!

HTH,

Sean O'Halpin
Interactive Media
Bamber Forsyth Limited
1-5 Midford Place
London W1P 0LQ

Tel: +44 (0) 20 7969 5056
Email: [EMAIL PROTECTED]




Reply via email to