HTML-XHTML-Lite
view release on metacpan or search on metacpan
HTML-XHTML-Lite version 0.01
============================
INTRODUCTION
This module provides a light-weight alternative to the Perl built-in,
CGI.pm, for those who wish for an easy way to produce a well-formed
XHTML <head></head>, with Dublin Core metadata. A function to create
a footer is provided for completeness and it is even possible to
provide body text to return a complete document. Provision is made
for the inclusion of links to RSS (or other) feeds and FOAF data.
The 'extras' property allows for the insertion of arbitrary elements
into the document header.
In addition to the generation of XHTML, the function getvars() is
included to populate a hash with data from the query string and POST
data. This is an unsophisticated equivalent to CGI.pm's
$q->para('xyz') functionality.
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
my $expires=(defined $p{expires} ? time2str(iso2time($p{expires})) : $now);
unless ($p{isfile})
{
$page.="Expires: $expires\n";
$page.="Date: $now\n";
$page.="Content-type: $p{content_type}; charset=$charset\n\n";
}
$page.="<?xml version=\"1.0\" encoding=\"" . lc($charset) . "\"?>\n" unless $p{noxml} || $p{nohead};
$page.="<!DOCTYPE html\n\tPUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" unless $p{nodoctype} || $p{nohead};
$page.=<<EOT;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$p{lang}" lang="$p{lang}">
<head>
<title>$p{title}</title>
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />
<meta name="DC.language" scheme="DCTERMS.RFC1766" content="$p{lang}" />
<meta name="DC.type" scheme="DCTERMS.DCMIType" content="Text" />
<meta name="DC.format" scheme="DCTERMS.IMT" content="text/html; charset=$charset" />
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
}
return %vars;
}
1;
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
HTML::XHTML::Lite - Light-weight Perl module for XHTML CGI applications
=head1 SYNOPSIS
use HTML::XHTML::Lite;
start_page({
title=>'my_title',
description=>'my_description',
...
});
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
start_page(\%my_page_data);
end_page();
my %vars=getvars();
=head1 DESCRIPTION
This module provides a light-weight alternative to the Perl built-in, CGI.pm, for
those who wish for an easy way to produce a well-formed XHTML <head></head>,
with Dublin Core metadata. A function to create a footer is provided for
completeness and it is even possible to provide body text to return a complete
document. Provision is made for the inclusion of links to RSS (or other) feeds
and FOAF data. The 'extras' property allows for the insertion of arbitrary elements
into the document header.
In addition to the generation of XHTML, the function getvars() is included to
populate a hash with data from the query string and POST data. This is an
unsophisticated equivalent to CGI.pm's $q->para('xyz') functionality and does
NOT work with forms where enc="multipart/form-data" - in other words, forms that
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
title=>'My Web Page',
description=>'About My Web Page',
creator=>'Matthew Smith',
identifier=>'http://www.mss.cx',
foaf=>'http://www.mss.cx/foaf.rdf',
foaftitle=>'FOAF data',
});
=head4 Methods
string Return the XHTML created as a scalar variable; the
default behaviour is to print the XHTML to STDOUT or the
currently selected handle.
my $foo=start_page({string=>1, ....., });
isfile Target is a file, so we don't want to create any
headers. This example writes to a file, without any headers.
open (OUT,">foo.out");
select OUT;
start_page({isfile=>, ....., });
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
=head1 TO DO
* Inclusion of dc.accessibility, when more mature
* Links to EARL assertions about the document
* You tell me...
=head1 APPLICATION EXAMPLE
#!/usr/bin/perl
# Programme to create XHTML template
# through command line interaction.
use strict;
use warnings;
use HTML::XHTML::Lite;
my @tnow=localtime(time());
my $yearnow=1900+$tnow[5];
my $datenow="$yearnow-$tnow[4]-$tnow[3]";
lib/HTML/XHTML/Lite.pm view on Meta::CPAN
}
=head1 SEE ALSO
A web page for this module may be found here:
http://www.mss.cx/xhtmllite/
The alternative: man CGI.pm
Dublin Core Metadata: http://www.dublincore.org
XHTML Specification: http://www.w3.org/TR/xhtml1/
=head1 AUTHOR
Matthew Smith, smiffy@cpan.org
Matthew welcomes feedback and suggestions regarding this module.
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005 by Matthew Smith
( run in 2.058 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )