Skip Menu |
 

This queue is for tickets about the Perl-MinimumVersion CPAN distribution.

Report information
The Basics
Id: 56609
Status: resolved
Priority: 0/
Queue: Perl-MinimumVersion

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 1.29



Subject: exists(&subr) new in 5.6.0
Date: Thu, 15 Apr 2010 11:08:54 +1000
To: bug-Perl-MinimumVersion [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 953b
Perl::MinimumVersion might report on the new exists(&subr) support. I've been using the few lines below # exists(&subr) new in 5.6.0 # sub _exists_subr { my ($pmv) = @_; $pmv->Document->find_first (sub { my ($document, $elem) = @_; if ($elem->isa('PPI::Token::Word') && $elem eq 'exists' && is_function_call($elem) && ($elem = _symbol_or_list_symbol($elem->snext_sibling)) && $elem->symbol_type eq '&') { return 1; } else { return 0; } }); } # if $elem is a symbol or a List of a symbol then return that symbol elem, # otherwise return an empty list # sub _symbol_or_list_symbol { my ($elem) = @_; if ($elem->isa('PPI::Structure::List')) { $elem = $elem->schild(0) || return; $elem->isa('PPI::Statement::Expression') || return; $elem = $elem->schild(0) || return; } $elem->isa('PPI::Token::Symbol') || return; return $elem; }
Download (untitled) / with headers
text/plain 260b
On Wed Apr 14 21:09:58 2010, user42@zip.com.au wrote: Show quoted text
> Perl::MinimumVersion might report on the new exists(&subr) support. > I've been using the few lines below
Added in 1.29 with changes to also work on "exists &$a" -- Alexandr Ciornii, http://chorny.net


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.