Embed HTML directly into your Perl code. Just be sure you're using warnings.
package HTML; $SIG{__WARN__} = sub { if ($_[0] =~ /readline\(\) on unopened filehandle (\S+)/) { print "<$1>"; } elsif ($_[0] !~ /only once/) { warn @_ } }; sub import { my $pkg = caller; *{ $pkg . "::glob" } = \&tag; } sub tag { my $tag = shift; $tag =~ s/\s+$//; wantarray ? "<$tag>" : print "<$tag>"; } 1; __END__ #!/usr/bin/perl -w use HTML; print <html>, <head>, <title>, "This is vile", </title>, </head>, <body bgcolor="#ffffaa">, <tt>, "japhy", </tt>, " is insane.", </body>, </html>, ;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: use HTML; # !!!
by dragonchild (Archbishop) on Jul 26, 2002 at 18:51 UTC | |
Re: use HTML; # !!!
by dws (Chancellor) on Jul 26, 2002 at 17:38 UTC | |
by Bird (Pilgrim) on Jul 26, 2002 at 17:50 UTC | |
Re: use HTML; # !!!
by RMGir (Prior) on Jul 26, 2002 at 21:18 UTC | |
Re: use HTML; # !!!
by BrowserUk (Patriarch) on Jul 26, 2002 at 21:33 UTC | |
Re: use HTML; # !!!
by strfry() (Monk) on Aug 05, 2002 at 19:15 UTC | |
Re: use HTML; # !!!
by Anonymous Monk on Jul 28, 2002 at 22:55 UTC |
Back to
Cool Uses for Perl