The following module was proposed for inclusion in the Module List:

  modid:       HTML::Native
  DSLIP:       RdpOg
  description: HTML via native Perl data structures
  userid:      MCB (Michael Brown)
  chapterid:   15 (World_Wide_Web_HTML_HTTP_CGI)
  communities:

  similar:
    HTML::Tree Template HTML::Mason

  rationale:

    I chose the name HTML::Native since the idea is to provide a
    Perl-native way to manipulate an HTML document tree.

    (From the module documentation:)

    Perl has a rich, natural, and extremely efficient syntax for
    manipulating tree-like data structures. HTML::Native allows you to
    use this syntax to manipulate an HTML document tree. For example:

    # Mark the link to the current page with class="active" foreach my
    $link ( @$navbar ) { $link->{class}->{active} = ( $link->{href} eq
    $current ); }

    # Wrap any <table> elements inside a <div> element foreach my $elem
    ( @$list ) { $elem = HTML::Native->new ( div => { class => "results"
    }, $elem ) if is_html_element ( $elem, "table" ); }

    HTML::Native is an alternative to mixed-language modules such as
    the Template Toolkit and HTML::Mason, and to method-based modules
    such as HTML::Tree. HTML::Native aims to provide the most naturally
    Perlish way of generating and manipulating an HTML document tree.

    Compare the code required to conditionally add an attribute
    class="fatal" to a <div> element based on the variable $fatal:

    Template Toolkit:

    <div class="error[% $fatal ? " fatal" : "" %]">

    HTML::Mason:

    <div class="error<% $fatal ? " fatal": "" %>">

    HTML::Tree:

    $div->attr ( "class", $div->attr ( "class" )." fatal" ) if $fatal;

    HTML::Native (this module):

    $div->{class}->{fatal} = $fatal;

    I suspect that I am not the only person who might find this useful,
    so I would like to share it on CPAN.

  enteredby:   MCB (Michael Brown)
  enteredon:   Wed Jun  8 17:18:18 2011 GMT

The resulting entry would be:

HTML::
::Native          RdpOg HTML via native Perl data structures         MCB


Thanks for registering,
-- 
The PAUSE

PS: The following links are only valid for module list maintainers:

Registration form with editing capabilities:
  
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=fe800000_5f1953e265cb01d7&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
  
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=fe800000_5f1953e265cb01d7&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
  
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=HTML%3A%3ANative

Reply via email to