Skip Menu |

This queue is for tickets about the P CPAN distribution.

Report information
The Basics
Id: 89053
Status: rejected
Priority: 0/
Queue: P

People
Owner: pause [...] tlinx.org
Requestors: l.mai [...] web.de
Cc:
AdminCc:

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



Subject: useless use of prototypes
P uses prototypes in several places but only where they're ignored (with the exception of Pe). Example 1: sub ($$) { $_[1] && q{%s} }, sub ($$) { 1==length($_[0]) && q{'%s'}}, sub ($$) { $_[0] =~ /^[+-]?\d*\.\d*$/ && q{%.2f}}, sub ($$) { 1 && q{"%s"}} ]; These are all anonymous coderefs dispatched at runtime. The ($$) prototypes have no effect. Example 2: GLOB => \&{sub(){'<*='.<$p>.'>'}}, IO => \&{sub(){ '<='.<$p>.'>'}}, SCALAR=> \&{sub(){ $pkg.'\\' . Px($$_, $lvl).' ' }}, ARRAY => \&{sub(){ $pkg."[". (join ', ', map{ Px($_, $lvl) } @$p ) ."]" }}, HASH => \&{sub(){ $pkg.'{' . ( join ', ', @{[ map { Px($_, $lvl, 1) . '=>'. Px($p->{$_}, $lvl,0) } keys %$p]} ) . '}' }},); Same problem as above but with additional weirdness: Why is there \&{ ... } wrapped around all of these? It does effectively nothing and it's not even consistent with the block of subs further up. Example 3: sub P(@) { sub Pa(@) { sub Pea(@) { sub Pae(@) { Subroutines take lists by default. The (@) prototype is equivalent to no prototype at all. Example 4: sub ops($) { According to the documentation this is a method (i.e. dispatched at runtime), so the prototype is ignored. (If it wasn't ignored, the code wouldn't work because ops takes 2 arguments.)
This causes no bug that I can tell. I *did* add a comment to the code: # prototypes are documentary (rt#89053)