Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: sean [...] blanton.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 3.41
Fixed in: (no value)



Subject: Paste operation in twig_handlers apparently broken in 3.40
A simple paste operation I was using for years is broken in 3.40 but works in 3.39. Maybe I'm doing it wrong, of course, but here is the code. Rolling back to 3.39, ceteris paribus, MODIFIED TWIG is identical to NEW XML. In 3.40, they are identical for a ->cut operation, but for the - Show quoted text
>paste shown below, NEW XML does not show the pasted element. Behavior
is different between cut and paste. Performing a ->cut and then a - Show quoted text
>paste in the same handler will result in the ->cut op expressed in NEW
XML, but not the ->paste. I had the same problem when I created an ::Elt from scratch and used that - shouldn't matter I suppose. In real life the tag I want to paste is more complicated so I use the method below. #!/usr/bin/perl use common::sense; use XML::Twig; my $t = XML::Twig->new( twig_handlers => { '//plant/fruit' => \&h_paste } ); $t->parse(\*DATA); print "NEW XML:\n" . $t->sprint() . "\n"; sub h_paste { my ( $twig, $elt ) = @_; my $tag = '<berry>Tomato</berry>'; my $new_twig = XML::Twig->new( pretty_print => 'indented' )- Show quoted text
>parse($tag);
$new_twig->root->paste($elt); print "MODIFIED TWIG:\n" . $twig->sprint() . "\n"; } __DATA__ <plant> <flower>Rose</flower> <fruit> <berry>Blackberry</berry> </fruit> <veggie>Carrot</veggie> </plant>
Subject: Re: [rt.cpan.org #77244] Paste operation in twig_handlers apparently broken in 3.40
Date: Thu, 17 May 2012 12:22:26 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <xmltwig [...] gmail.com>
On 05/16/2012 07:39 PM, Sean Blanton via RT wrote: Show quoted text
> Wed May 16 13:39:01 2012: Request 77244 was acted upon. > Transaction: Ticket created by sblanton > Queue: XML-Twig > Subject: Paste operation in twig_handlers apparently broken in 3.40 > Broken in: 3.40 > Severity: Critical > Owner: Nobody > Requestors: sean@blanton.com > Status: new > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77244> > > > A simple paste operation I was using for years is broken in 3.40 but > works in 3.39. Maybe I'm doing it wrong, of course, but here is the > code. > > Rolling back to 3.39, ceteris paribus, MODIFIED TWIG is identical to NEW > XML. In 3.40, they are identical for a ->cut operation, but for the -
>> paste shown below, NEW XML does not show the pasted element. Behavior
> is different between cut and paste. Performing a ->cut and then a -
>> paste in the same handler will result in the ->cut op expressed in NEW
> XML, but not the ->paste. > > I had the same problem when I created an ::Elt from scratch and used > that - shouldn't matter I suppose. In real life the tag I want to paste > is more complicated so I use the method below.
This is a weird one. I can reproduce it, but I can't figure out which change triggers this. I have to go back through the git history to see what's going on. It is indeed critical so I'll release a new version as soon as I find a fix. Thanks -- mirod
On Thu May 17 06:22:49 2012, xmltwig@gmail.com wrote: Show quoted text
> On 05/16/2012 07:39 PM, Sean Blanton via RT wrote:
> > Wed May 16 13:39:01 2012: Request 77244 was acted upon. > > Transaction: Ticket created by sblanton > > Queue: XML-Twig > > Subject: Paste operation in twig_handlers apparently broken in
3.40 Show quoted text
> > Broken in: 3.40 > > Severity: Critical > > Owner: Nobody > > Requestors: sean@blanton.com > > Status: new > > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77244> > > > > > > A simple paste operation I was using for years is broken in 3.40 but > > works in 3.39. Maybe I'm doing it wrong, of course, but here is the > > code. > > > > Rolling back to 3.39, ceteris paribus, MODIFIED TWIG is identical to
NEW Show quoted text
> > XML. In 3.40, they are identical for a ->cut operation, but for the
- Show quoted text
> >> paste shown below, NEW XML does not show the pasted element.
Behavior Show quoted text
> > is different between cut and paste. Performing a ->cut and then a -
> >> paste in the same handler will result in the ->cut op expressed in
NEW Show quoted text
> > XML, but not the ->paste. > > > > I had the same problem when I created an ::Elt from scratch and used > > that - shouldn't matter I suppose. In real life the tag I want to
paste Show quoted text
> > is more complicated so I use the method below.
> > This is a weird one. I can reproduce it, but I can't figure out which > change triggers this. I have to go back through the git history to see > what's going on. > > It is indeed critical so I'll release a new version as soon as I find
a fix. Show quoted text
> > Thanks >
Any luck on this one? Maybe I can help. I found and old Git repository on github - must be a new one somewhere? Cheers, Sean
Subject: Re: [rt.cpan.org #77244] Paste operation in twig_handlers apparently broken in 3.40
Date: Wed, 22 Aug 2012 15:15:49 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: Michel Rodriguez <xmltwig [...] gmail.com>
Have you tried it in 3.41? In the end, I don't think it was a bug: you pasted the root of new_twig without cutting it. But you can do this anyway in 3.41. On 8/21/12, Sean Blanton via RT <bug-XML-Twig@rt.cpan.org> wrote: Show quoted text
> Queue: XML-Twig > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=77244 > > > On Thu May 17 06:22:49 2012, xmltwig@gmail.com wrote:
>> On 05/16/2012 07:39 PM, Sean Blanton via RT wrote:
>> > Wed May 16 13:39:01 2012: Request 77244 was acted upon. >> > Transaction: Ticket created by sblanton >> > Queue: XML-Twig >> > Subject: Paste operation in twig_handlers apparently broken in
> 3.40
>> > Broken in: 3.40 >> > Severity: Critical >> > Owner: Nobody >> > Requestors: sean@blanton.com >> > Status: new >> > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=77244> >> > >> > >> > A simple paste operation I was using for years is broken in 3.40 but >> > works in 3.39. Maybe I'm doing it wrong, of course, but here is the >> > code. >> > >> > Rolling back to 3.39, ceteris paribus, MODIFIED TWIG is identical to
> NEW
>> > XML. In 3.40, they are identical for a ->cut operation, but for the
> -
>> >> paste shown below, NEW XML does not show the pasted element.
> Behavior
>> > is different between cut and paste. Performing a ->cut and then a -
>> >> paste in the same handler will result in the ->cut op expressed in
> NEW
>> > XML, but not the ->paste. >> > >> > I had the same problem when I created an ::Elt from scratch and used >> > that - shouldn't matter I suppose. In real life the tag I want to
> paste
>> > is more complicated so I use the method below.
>> >> This is a weird one. I can reproduce it, but I can't figure out which >> change triggers this. I have to go back through the git history to see >> what's going on. >> >> It is indeed critical so I'll release a new version as soon as I find
> a fix.
>> >> Thanks >>
> Any luck on this one? Maybe I can help. I found and old Git repository > on github - must be a new one somewhere? > > Cheers, > Sean > > >
-- mirod
On Wed Aug 22 09:16:11 2012, xmltwig@gmail.com wrote: Show quoted text
> Have you tried it in 3.41? In the end, I don't think it was a bug: you > pasted the root of new_twig without cutting it. But you can do this > anyway in 3.41.
I see the same behavior in 3.41, but I got it to work in both 3.39 and 3.41 by changing: $new_twig->root->paste($elt) to $new_twig->root->copy->paste($elt) I couldn't find a way to incorporate a 'cut' that worked, and I don't fully understand why this new way works (I haven't looked much at the internals), but it works, so I'm good. Thanks Again, Sean