GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::DECLARE (3)

.ds Aq ’

NAME

HTML::Declare - For When Template Systems Are Too Huge And Heredocs Too Messy

CONTENTS

SYNOPSIS



    # Import all constructors
    use HTML::Declare :all;

    # A simple hello world
    print HTML {
        _ => [
            HEAD { _ => TITLE { _ => Hello World! } },
            BODY { _ => Hello World! }
        ]  
    };

    # Import specific constructors
    use HTML::Declare qw/DIV A/;

    # A simple anchor nested in a div
    my $tree = DIV {
        _ => [
            A {
                href => http://127.0.0.1,
                _    => << Home Sweet Home!
            }
        ]
    };
    print "$tree";



DESCRIPTION

A very simple micro language to generate HTML.

This is not a real template system like Template or HTML::Mason, it’s just a simple (and fun) way to avoid those messy heredocs. ;)

METHODS

HTML::Declare instances have the following methods.

    new

    as_html

    attributes

    children

    tag

FUNCTIONS

All exported functions work the same, they expect a hashref as first argument which contains attributes for the tag to generate.

The special attribute _ contains the content for the tag. The content may be a single string (in this case entities are auto encoded), a arrayref containing strings that shouldn’t be encoded or HTML::Declare instances.



    <TAG> { attribute => value }
    DIV { id => foo, _ => lalala<<encode me>> }
    DIV { id => link _ => [ <b>Dont encode me!</b> ] }
    DIV { _ => [ A { href => http://127.0.0.1, _ => Home! } ] }
    DIV { _ => [ A { href => http://host, _ => H1 { _ => Test } } ] }



    A

    ABBR

    ACRONYM

    ADDRESS

    AREA

    B

    BASE

    BDO

    BIG

    BLOCKQUOTE

    BODY

    BR

    BUTTON

    CAPTION

    CITE

    CODE

    COL

    COLGROUP

    DD

    DEL

    DIV

    DFN

    DL

    DT

    EM

    FIELDSET

    FORM

    FRAME

    FRAMESET

    H1

    H2

    H3

    H4

    H5

    H6

    HEAD

    HR

    HTML

    I

    IFRAME

    IMG

    INPUT

    INS

    KBD

    LABEL

    LEGEND

    LI

    LINK

    MAP

    META

    NOFRAMES

    NOSCRIPT

    OBJECT

    OL

    OPTGROUP

    OPTION

    P

    PARAM

    PRE

    Q

    SAMP

    SCRIPT

    SELECT

    SMALL

    SPAN

    STRONG

    STYLE

    SUB

    SUP

    TABLE

    TAG

    TBODY

    TD

    TEXTAREA

    TFOOT

    TH

    THEAD

    TITLE

    TR

    TT

    UL

    VAR

AUTHOR

Sebastian Riedel, sri@oook.de

THANK YOU

Tatsuhiko Miyagawa

LICENSE

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::DECLARE (3) 2009-06-01

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.