the following snippet allows stating things like 

      use Entitize;
      ...
      print qq{<input name="data" value="$Entitize{$old_data}">\n};
      ... 
      print qq{The full text of the block is <pre>$Entitize{$block}</pre>\n};

directly, rather that using the generating functions of CGI.pm, or making
intermediate variables to hold the results of encode_entities calls. (nothing
against them, but here's Another Way To Do It)

cat > lib/Entitize.pm <<EOF
     package Entitize;
     use HTML::Entities;
     use Tie::Function;
     tie my %Entitize, 'Tie::Function' => \&encode_entities;
     sub import{ *{caller().'::Entitize'} = \%Entitize };
     1;
EOF

These three lines are too small to bother wrapping up in Entitize.pm
and publishing to CPAN, in my opinion.  You want it, it will copy and
paste into your cygwin bash or xterm.  Opinions are subject to change.


-- 
David L Nicol
"Oh, shit." -- Jane Fonda

Reply via email to