home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_5a28cca34f48a08bfac9df21b553e4f8
< prev
next >
Wrap
Text File
|
2000-03-23
|
4KB
|
107 lines
<HTML>
<HEAD>
<TITLE>HTML::AsSubs - functions that construct a HTML syntax tree</TITLE>
<LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> HTML::AsSubs - functions that construct a HTML syntax tree</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<LI><A HREF="#acknowledgement">ACKNOWLEDGEMENT</A></LI>
<LI><A HREF="#bugs">BUGS</A></LI>
<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>HTML::AsSubs - functions that construct a HTML syntax tree</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
use HTML::AsSubs;
$h = body(
h1("This is the heading"),
p("This is the first paragraph which contains a ",
a({href=>'link.html'}, "link"),
" and an ",
img({src=>'img.gif', alt=>'image'}),
"."
),
);
print $h->as_HTML;</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>This module exports functions that can be used to construct various
HTML elements. The functions are named after the tags of the
correponding HTML element and are all written in lower case. If the
first argument is a hash reference then it will be used to initialize the
attributes of this element. The remaining arguments are regarded as
content.</P>
<P>
<HR>
<H1><A NAME="acknowledgement">ACKNOWLEDGEMENT</A></H1>
<P>This module was inspired by the following message:</P>
<PRE>
Date: Tue, 4 Oct 1994 16:11:30 +0100
Subject: Wow! I have a large lightbulb above my head!</PRE>
<PRE>
Take a moment to consider these lines:</PRE>
<PRE>
%OVERLOAD=( '""' => sub { join("", @{$_[0]}) } );</PRE>
<PRE>
sub html { my($type)=shift; bless ["<$type>", @_, "</$type>"]; }</PRE>
<PRE>
:-) I *love* Perl 5! Thankyou Larry and Ilya.</PRE>
<PRE>
Regards,
Tim Bunce.</PRE>
<PRE>
p.s. If you didn't get it, think about recursive data types: html(html())
p.p.s. I'll turn this into a much more practical example in a day or two.
p.p.p.s. It's a pity that overloads are not inherited. Is this a bug?</PRE>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>The exported <A HREF="../../../lib/Pod/perlfunc.html#item_link"><CODE>link()</CODE></A> function overrides the builtin <A HREF="../../../lib/Pod/perlfunc.html#item_link"><CODE>link()</CODE></A> function.
The exported <A HREF="../../../lib/Pod/perlfunc.html#item_tr"><CODE>tr()</CODE></A> function must be called using &tr(...) syntax
because it clashes with the builtin tr/../../ operator.</P>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF="../../../site/lib/HTML/Element.html">the HTML::Element manpage</A></P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> HTML::AsSubs - functions that construct a HTML syntax tree</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>