Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 18415
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: mlockner [...] iowatelecom.net
Cc:
AdminCc:

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



Subject: PPI::Node::find returning empty string?
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 662
Download (untitled) / with headers
text/plain 662b
This is borderline wishlist, but... Although I can see the virtue in having PPI::Node::find's value being a valid boolean when used in such a context, it was not my first expectation. I had to look up the function documentation to find out why it was returning an empty string. My expectation was that it would instead return a reference to the empty list if there were no results matching the search criteria; I think that would be a more common intuitive expectation. I realize it probably isn't something that can be changed at this point, and that you might not want to anyway, but that it was at least worth speaking up about.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-10303-1158848083-1193.18415-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 906
Download (untitled) / with headers
text/plain 906b
On Tue Mar 28 14:00:22 2006, guest wrote: Show quoted text
> This is borderline wishlist, but... > > Although I can see the virtue in having PPI::Node::find's value being > a valid boolean when used in such a context, it was not my first > expectation. I had to look up the function documentation to find out > why it was returning an empty string. > > My expectation was that it would instead return a reference to the > empty list if there were no results matching the search criteria; I > think that would be a more common intuitive expectation. > > I realize it probably isn't something that can be changed at this > point, and that you might not want to anyway, but that it was at least > worth speaking up about.
While I have also found that behavior confusing, I think it's too late to change this behavior. Perl::Critic relies on it. I suggest that this bug be rejected. -- Chris
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-10319-1158898396-115.18415-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 228
Download (untitled) / with headers
text/plain 228b
Well, when I added it in the first place, it was done to allow expressions like. my $things = $document->find(...) or die "Failed to find expected whatever"; And I agree it's probably too late to fix it now. Resolving WONTFIX


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.