Skip Menu |

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

Report information
The Basics
Id: 83161
Status: resolved
Priority: 0/
Queue: XML-Bare

People
Owner: cpan [...] codechild.com
Requestors: gkpect [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.50



Subject: find_by_perl doesn't work
Hi, find_by_perl method doesn't work. From documentation: --- $object->find_by_perl( $root->{xml}->{ob}, "-key eq '1'" )->[0]->{val}->{value} = 'test'; --- From source: --- sub find_by_perl { my $arr = shift; my $cond = shift; $cond =~ s/-([a-z]+)/\$ob->\{'$1'\}->\{'value'\}/g; my @res; foreach my $ob ( @$arr ) { push( @res, $ob ) if( eval( $cond ) ); } return \@res; } --- Issues: 1) $self argument is missed; 2) [a-z]+ regexp doesn't match uppercase letters.
Subject: find_by_perl cannot be used via object; also find_by_perl does not work properly with uppercase node names
find_by_perl is meant to be used by being exported, or directly in the namespace. eg: XML::Bare::find_by_perl( ... ); It does not work via the object somewhat intentionally. The module will soon be updated to work both ways to reduce the confusion here. You are write that it will only let you match lowercase keys. Underscores would not work either. This will be updated. Thanks for your input. On Wed Feb 06 08:53:22 2013, sbond wrote: Show quoted text
> Hi, > > find_by_perl method doesn't work. > > From documentation: > --- > $object->find_by_perl( $root->{xml}->{ob}, "-key eq '1'" > )->[0]->{val}->{value} = 'test'; > --- > > From source: > --- > sub find_by_perl { > my $arr = shift; > my $cond = shift; > $cond =~ s/-([a-z]+)/\$ob->\{'$1'\}->\{'value'\}/g; > my @res; > foreach my $ob ( @$arr ) { push( @res, $ob ) if( eval( $cond ) ); } > return \@res; > } > --- > > Issues: > 1) $self argument is missed; > 2) [a-z]+ regexp doesn't match uppercase letters.
The way the module works has been altered so that find_by_perl can be accessed directly or via an object. Uppercase and underscore handling is now done also.