Skip Menu |
 

This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id: 83264
Status: resolved
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: HMBRAND [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.42
Fixed in: 3.44



Subject: Doc fixes
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 4331
Download (untitled) / with headers
text/plain 4.2k
Here are some techinical fixes for your documentation where code snippets - including examples - had syntax errors: --- a/XML/Twig.pm 2013-02-11 15:13:43.231156933 +0100 +++ b/XML/Twig.pm 2013-02-11 15:34:48.111256684 +0100 @@ -9948,7 +9948,7 @@ confuse XML::Twig ;--( Note: you can set handlers (twig_handlers) using twig_roots Example: my $t= XML::Twig->new( twig_roots => - { title => sub { $_{1]->print;}, + { title => sub { $_[1]->print;}, subtitle => \&process_subtitle } ); @@ -9968,7 +9968,7 @@ value this will print the document outsi sub number_title { my( $twig, $title); $nb++; - $title->prefix( "$nb "; } + $title->prefix( "$nb "); $title->print; } } @@ -9991,7 +9991,7 @@ C<twig_roots> elements will be output to sub number_title { my( $twig, $title); $nb++; - $title->prefix( "$nb "; } + $title->prefix( "$nb "); $title->print( $out); # you have to print to \*OUT here } } @@ -10610,14 +10610,14 @@ example: # using an array ref my $t= XML::Twig->new( index => [ 'div', 'table' ]) - ->parsefile( "foo.xml'); + ->parsefile( "foo.xml"); my $divs= $t->index( 'div'); my $first_div= $divs->[0]; my $last_table= $t->index( table => -1); # using a hashref to name the indexes - my $t= XML::Twig->new( index => { email => 'a[@href=~/^\s*mailto:/]') - ->parsefile( "foo.xml'); + my $t= XML::Twig->new( index => { email => 'a[@href=~/^ \s*mailto:/]'}) + ->parsefile( "foo.xml"); my $last_emails= $t->index( email => -1); Note that the index is not maintained after the parsing. If elements are @@ -10630,7 +10630,7 @@ creates methods that give direct access my $t= XML::Twig->new( att_accessors => [ 'href', 'src']) ->parsefile( $file); - my $first href= $t->first_elt( 'img')->src; # same as ->att( 'src') + my $first_href= $t->first_elt( 'img')->src; # same as ->att( 'src') $t->first_elt( 'img')->src( 'new_logo.png') # changes the attribute value =item elt_accessors @@ -10645,7 +10645,7 @@ or in a hash alias => expression my $title_text= $t->root->head->field( 'title'); # same as $title_text= $t->root->first_child( 'head')->field ( 'title'); - my $t= XML::Twig->new( elt_accessors => { warnings => 'p [@class="warning"]', d2 => 'div[2]', ) + my $t= XML::Twig->new( elt_accessors => { warnings => 'p [@class="warning"]', d2 => 'div[2]', }) ->parsefile( $file); my $body= $t->first_elt( 'body'); my @warnings= $body->warnings; # same as $body->children( 'p [@class="warning"]'); @@ -11747,7 +11747,7 @@ The C<$optional_elt> is the root of a su subtree then the method returns undef. You can then walk a sub-tree with: my $elt= $subtree_root; - while( $elt= $elt->next_elt( $subtree_root) + while( $elt= $elt->next_elt( $subtree_root)) { # insert processing code here } @@ -12321,8 +12321,8 @@ of the element. B<Bug>: in the C<$regexp>, you can only use C<\1>, C<\2>... if the replacement expression does not include elements or attributes. eg - t->subs_text( qr/((t[aiou])\2)/, '$2'); # ok, replaces toto, tata, titi, tutu by to, ta, ti, tu - t->subs_text( qr/((t[aiou])\2)/, '&elt(p => $1)' ); # NOK, does not find toto... + $t->subs_text( qr/((t[aiou])\2)/, '$2'); # ok, replaces toto, tata, titi, tutu by to, ta, ti, tu + $t->subs_text( qr/((t[aiou])\2)/, '&elt(p => $1)' ); # NOK, does not find toto... =item add_id ($optional_coderef) @@ -12564,7 +12564,7 @@ table for example. Optionally each tag can be followed by a hashref of attributes, that will be set on the wrapping element: - $elt->wrap_in( p => { class => "advisory" }, div => { class => "intro", id => "div_intro }); + $elt->wrap_in( p => { class => "advisory" }, div => { class => "intro", id => "div_intro" }); =item insert_new_elt ($opt_position, $tag, $opt_atts_hashref, @opt_content) -->8---
From xmltwig [...] gmail.com Tue Feb 12 05: 41:02 2013
MIME-Version: 1.0
X-Spam-Status: No, score=-5.585 tagged_above=-99.9 required=10 tests=[AWL=-0.365, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=0.999, RCVD_IN_DNSWL_HI=-5, SPF_NEUTRAL=0.779] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-1267-1360594414-1097.83264-4-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-83264 [...] rt.cpan.org> <rt-3.8.HEAD-1267-1360594414-1097.83264-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.14.183.67 with SMTP id p43mr60934003eem.10.1360665651847; Tue, 12 Feb 2013 02:40:51 -0800 (PST)
Message-ID: <511A1C1B.7020502 [...] gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.585
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id AE6942405E8 for <cpan-bug+XML-Twig [...] hipster.bestpractical.com>; Tue, 12 Feb 2013 05:41:02 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3GBtWPku6cSV for <cpan-bug+XML-Twig [...] hipster.bestpractical.com>; Tue, 12 Feb 2013 05:41:00 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0A6CE2405DA for <bug-XML-Twig [...] rt.cpan.org>; Tue, 12 Feb 2013 05:40:59 -0500 (EST)
Received: (qmail 21365 invoked by uid 103); 12 Feb 2013 10:40:59 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 12 Feb 2013 10:40:59 -0000
Received: from mail-ee0-f54.google.com (HELO mail-ee0-f54.google.com) (74.125.83.54) by 16.mx.develooper.com (qpsmtpd/0.84/v0.84-167-g4ed6cab) with ESMTP; Tue, 12 Feb 2013 02:40:55 -0800
Received: by mail-ee0-f54.google.com with SMTP id c41so3936063eek.13 for <bug-XML-Twig [...] rt.cpan.org>; Tue, 12 Feb 2013 02:40:52 -0800 (PST)
Received: from [192.168.2.200] (static-217-133-18-84.clienti.tiscali.it. [217.133.18.84]) by mx.google.com with ESMTPS id k7sm64434294een.8.2013.02.12.02.40.49 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Feb 2013 02:40:50 -0800 (PST)
Delivered-To: cpan-bug+XML-Twig [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
Subject: Re: [rt.cpan.org #83264] Doc fixes
Return-Path: <xmltwig [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=evsy4/do4/GTSO5KMK07YbDgc0iMJQQ0Nv7iFF/GVj0=; b=sWuaXOp3rIW810Zc1zp42NctLJjDcfMjPt1qzu021vW18lsPkHqSGusKKuhR4gbWmt Sc4/hMaRQdnx8vQpvJmRBQ+Kg3KKnLDNoFo7U078aHh3rG5pVgsLtncL8VWdTi9kvcZE 3ptL3/RopNlpPAdnB3nXkTP7WeXwJuDBmRa9MrDFeQlUiv+5Tp3IqP7RAU5/De3QgFMy p6Gvckpw/DZC9T0c64qvxvyHT5o0/4i10D+OUfGAmgCYJ5AZT0GlTxxLKzv0jzClcEd4 pk9voDfmJefsmuq/okVlOs7uFyYYOs8s1+D8wC5Z57SN6B6GTWTJ3lQvHsfflp3Gz8Rq aiPQ==
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+XML-Twig [...] hipster.bestpractical.com
X-RT-Mail-Extension: xml-twig
Date: Tue, 12 Feb 2013 11:40:27 +0100
X-Spam-Level:
To: bug-XML-Twig [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: mirod <xmltwig [...] gmail.com>
RT-Message-ID: <rt-3.8.HEAD-26069-1360665663-251.83264-0-0 [...] rt.cpan.org>
Content-Length: 5042
Download (untitled) / with headers
text/plain 4.9k
Thanks, applied to the development version. -- mirod On 02/11/2013 03:53 PM, H.Merijn Brand via RT wrote: Show quoted text
> Mon Feb 11 09:53:34 2013: Request 83264 was acted upon. > Transaction: Ticket created by HMBRAND > Queue: XML-Twig > Subject: Doc fixes > Broken in: 3.42 > Severity: Important > Owner: Nobody > Requestors: HMBRAND@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=83264 > > > > Here are some techinical fixes for your documentation where code > snippets - including examples - had syntax errors: > > --- a/XML/Twig.pm 2013-02-11 15:13:43.231156933 +0100 > +++ b/XML/Twig.pm 2013-02-11 15:34:48.111256684 +0100 > @@ -9948,7 +9948,7 @@ confuse XML::Twig ;--( > > Note: you can set handlers (twig_handlers) using twig_roots > Example: my $t= XML::Twig->new( twig_roots => > - { title => sub { $_{1]->print;}, > + { title => sub { $_[1]->print;}, > subtitle => \&process_subtitle > } > ); > @@ -9968,7 +9968,7 @@ value this will print the document outsi > sub number_title > { my( $twig, $title); > $nb++; > - $title->prefix( "$nb "; } > + $title->prefix( "$nb "); > $title->print; > } > } > @@ -9991,7 +9991,7 @@ C<twig_roots> elements will be output to > sub number_title > { my( $twig, $title); > $nb++; > - $title->prefix( "$nb "; } > + $title->prefix( "$nb "); > $title->print( $out); # you have to print to \*OUT > here > } > } > @@ -10610,14 +10610,14 @@ example: > > # using an array ref > my $t= XML::Twig->new( index => [ 'div', 'table' ]) > - ->parsefile( "foo.xml'); > + ->parsefile( "foo.xml"); > my $divs= $t->index( 'div'); > my $first_div= $divs->[0]; > my $last_table= $t->index( table => -1); > > # using a hashref to name the indexes > - my $t= XML::Twig->new( index => { email => 'a[@href=~/^\s*mailto:/]') > - ->parsefile( "foo.xml'); > + my $t= XML::Twig->new( index => { email => 'a[@href=~/^ > \s*mailto:/]'}) > + ->parsefile( "foo.xml"); > my $last_emails= $t->index( email => -1); > > Note that the index is not maintained after the parsing. If elements > are > @@ -10630,7 +10630,7 @@ creates methods that give direct access > > my $t= XML::Twig->new( att_accessors => [ 'href', 'src']) > ->parsefile( $file); > - my $first href= $t->first_elt( 'img')->src; # same as ->att( 'src') > + my $first_href= $t->first_elt( 'img')->src; # same as ->att( 'src') > $t->first_elt( 'img')->src( 'new_logo.png') # changes the attribute > value > > =item elt_accessors > @@ -10645,7 +10645,7 @@ or in a hash alias => expression > my $title_text= $t->root->head->field( 'title'); > # same as $title_text= $t->root->first_child( 'head')->field > ( 'title'); > > - my $t= XML::Twig->new( elt_accessors => { warnings => 'p > [@class="warning"]', d2 => 'div[2]', ) > + my $t= XML::Twig->new( elt_accessors => { warnings => 'p > [@class="warning"]', d2 => 'div[2]', }) > ->parsefile( $file); > my $body= $t->first_elt( 'body'); > my @warnings= $body->warnings; # same as $body->children( 'p > [@class="warning"]'); > @@ -11747,7 +11747,7 @@ The C<$optional_elt> is the root of a su > subtree then the method returns undef. You can then walk a sub-tree > with: > > my $elt= $subtree_root; > - while( $elt= $elt->next_elt( $subtree_root) > + while( $elt= $elt->next_elt( $subtree_root)) > { # insert processing code here > } > > @@ -12321,8 +12321,8 @@ of the element. > B<Bug>: in the C<$regexp>, you can only use C<\1>, C<\2>... if the > replacement > expression does not include elements or attributes. eg > > - t->subs_text( qr/((t[aiou])\2)/, '$2'); # ok, replaces > toto, tata, titi, tutu by to, ta, ti, tu > - t->subs_text( qr/((t[aiou])\2)/, '&elt(p => $1)' ); # NOK, does not > find toto... > + $t->subs_text( qr/((t[aiou])\2)/, '$2'); # ok, replaces > toto, tata, titi, tutu by to, ta, ti, tu > + $t->subs_text( qr/((t[aiou])\2)/, '&elt(p => $1)' ); # NOK, does not > find toto... > > =item add_id ($optional_coderef) > > @@ -12564,7 +12564,7 @@ table for example. > Optionally each tag can be followed by a hashref of attributes, that > will be > set on the wrapping element: > > - $elt->wrap_in( p => { class => "advisory" }, div => { class => > "intro", id => "div_intro }); > + $elt->wrap_in( p => { class => "advisory" }, div => { class => > "intro", id => "div_intro" }); > > =item insert_new_elt ($opt_position, $tag, $opt_atts_hashref, > @opt_content) > > -->8--- >
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-26069-1360665663-251.83264-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: API
References: <RT-Ticket-83264 [...] rt.cpan.org> <rt-3.8.HEAD-1267-1360594414-1097.83264-4-0 [...] rt.cpan.org> <511A1C1B.7020502 [...] gmail.com> <rt-3.8.HEAD-26069-1360665663-251.83264-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.16-30440-1375705689-1034.0-0-0 [...] rt.cpan.org>
Message-ID: <rt-4.0.16-30440-1375705689-1770.83264-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
From: dsteinbrunner [...] pobox.com
Content-Length: 141
Download (untitled) / with headers
text/plain 141b
On Tue Feb 12 05:41:03 2013, xmltwig@gmail.com wrote: Show quoted text
> Thanks, applied to the development version.
It appears this ticket can be closed now


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.