Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id:
87441
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
TIMB [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: ProhibitAugmentedAssignmentInDeclaration should (optionally) allow the: our $foo ||= ...; idiom
Using our $some_unique_variable_name ||= some_expensive_init(); is a common idiom in perl code that needs to be portable to perl versions before the 'state' operator was added. perl -wle 'sub foo { our $x ||= rand; print $x } foo(); foo(); foo()' Also, some of the examples given in the docs are misleading. For example the "our $foo *= 2; # same as our $foo = 0;" is only the same as "$foo=0" if $foo had no previous value. Here's an example: perl -wle 'sub foo { our $call_count += 1; print $call_count } foo(); foo(); foo()' The same applies to the 'state' example. It's perfectly valid and reasonable behaviour. Ideally I'd like to see 'our' and 'state' removed from this policy as they are different to 'my' and 'local', but I'd be happy if they were made optional.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.