Skip Menu |

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

Report information
The Basics
Id: 68932
Status: resolved
Priority: 0/
Queue: XML-XPath

People
Owner: MANWAR [...] cpan.org
Requestors: 1983-01-06 [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.33
Fixed in: 1.36



Subject: /usr/bin/xpath outputs unwanted text when quiet mode ist set
Date: Sun, 19 Jun 2011 14:28:41 +0200
To: bug-XML-XPath [...] rt.cpan.org
From: Michael-O <1983-01-06 [...] gmx.net>
If I perform a non nodset action it simply outputs: Query didn't return a nodeset. Value: <value> Even if I set -q and still prints that line on stderr. This is annoying. In quiet mode it should spit out the value only. A small patch fixes the issue: --- /usr/bin/xpath 2004-10-29 00:51:18.000000000 +0200 +++ /usr/bin/xpath.new 2011-06-19 14:23:07.000000000 +0200 @@ -98,7 +98,7 @@ } } else { - print STDERR "Query didn't return a nodeset. Value: "; + print STDERR "Query didn't return a nodeset. Value: " unless $quiet; print $nodes->value, "\n"; } Mike
I had to add a few lines to make Mike's patch work. It's a trivial change that requires the -q option to come first if at all. On Sun Jun 19 08:28:52 2011, 1983-01-06@gmx.net wrote: Show quoted text
> If I perform a non nodset action it simply outputs: > Query didn't return a nodeset. Value: <value> > > Even if I set -q and still prints that line on stderr. This is annoying. > In quiet mode it should spit out the value only. > > A small patch fixes the issue: > --- /usr/bin/xpath 2004-10-29 00:51:18.000000000 +0200 > +++ /usr/bin/xpath.new 2011-06-19 14:23:07.000000000 +0200 > @@ -98,7 +98,7 @@ > } > } > else { > - print STDERR "Query didn't return a nodeset. Value: "; > + print STDERR "Query didn't return a nodeset. Value: " > unless $quiet; > print $nodes->value, "\n"; > } > > > Mike > >
Subject: xpath.patch
--- xpath 2013-11-22 13:37:31.000000000 +0100 +++ xpath.new 2013-11-22 13:37:21.000000000 +0100 @@ -20,12 +20,18 @@ my $xpath; my $pipeline; +my $quiet; +if ($ARGV[0] eq '-q') { + # quiet mode + $quiet = 1; + shift @ARGV; +} if ($ARGV[0] eq '-p') { # pipeline mode $pipeline = 1; shift @ARGV; } if (@ARGV >= 2) { $xpath = XML::XPath->new(filename => shift(@ARGV)); } @@ -37,7 +43,8 @@ unless ($nodes->isa('XML::XPath::NodeSet')) { NOTNODES: - print STDERR "Query didn't return a nodeset. Value: "; + print STDERR "Query didn't return a nodeset. Value: " + unless $quiet; print $nodes->value, "\n"; exit; }
On Fri Nov 22 07:46:57 2013, BWAGNER wrote: Show quoted text
> I had to add a few lines to make Mike's patch work. > It's a trivial change that requires the -q option to come first if at all. > > On Sun Jun 19 08:28:52 2011, 1983-01-06@gmx.net wrote:
> > If I perform a non nodset action it simply outputs: > > Query didn't return a nodeset. Value: <value> > > > > Even if I set -q and still prints that line on stderr. This is annoying. > > In quiet mode it should spit out the value only. > > > > A small patch fixes the issue: > > --- /usr/bin/xpath 2004-10-29 00:51:18.000000000 +0200 > > +++ /usr/bin/xpath.new 2011-06-19 14:23:07.000000000 +0200 > > @@ -98,7 +98,7 @@ > > } > > } > > else { > > - print STDERR "Query didn't return a nodeset. Value: "; > > + print STDERR "Query didn't return a nodeset. Value: " > > unless $quiet; > > print $nodes->value, "\n"; > > } > > > > > > Mike > > > >
> >
Hi, Thanks for reporting the issue and patch. Much appreciated. I will try my best to patch it asap. Best Regards, Mohammad S Anwar
Resolved.