Skip Menu |
 

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

Report information
The Basics
Id: 42486
Status: new
Priority: 0/
Queue: Perl-Critic-StricterSubs

People
Owner: Nobody in particular
Requestors: thaljef [...] cpan.org
wolfman.ncsu2000 [...] gmail.com
Cc:
AdminCc:

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



Subject: Readonly issues: documentation doesn't match binary
Download (untitled) / with headers
text/plain 319b
This is bare minimum code for how Readonly is supposed to be used for constants. However, running perlcritic -4 (down to -1) FILE reports this: Subroutine "Readonly" is neither declared nor explicitly imported at line 3, column 1. This might be a major bug. (Severity: 4) Please confirm I'm using the syntax right.
Subject: read.pl
Download read.pl
text/x-perl 56b
use 5.010; use Readonly; Readonly my $HI => 50; say $HI;
Subject: Re: [rt.cpan.org #41858] Readonly issues: documentation doesn't match binary
Date: Sun, 21 Dec 2008 22:09:30 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Download (untitled) / with headers
text/plain 1.6k
Wolfman via RT wrote: Show quoted text
> This is bare minimum code for how Readonly is supposed to be used for > constants. However, running perlcritic -4 (down to -1) FILE reports this: > > Subroutine "Readonly" is neither declared nor explicitly imported at > line 3, column 1. This might be a major bug. (Severity: 4) > > Please confirm I'm using the syntax right.
Ooh. You're using P::C::StricterSubs. You're really going in for the serious stuff. :] One hint: put "verbose = %f: %m at line %l, column %c. %e. (Severity: %s, %p)\n" (yes, the characters "\" and "n" in there) into your perlcriticrc. The "%p" will give you the short name of the policy in question. Anyway, Perl::Critic::Policy::Subroutines::ProhibitCallsToUndeclaredSubs doesn't take Readonly into account, unfortunately. However, it does have an exempt_subs option. So, in your perlcriticrc, you can put something like this: [Subroutines::ProhibitCallsToUndeclaredSubs] exempt_subs = Readonly::Readonly On the other hand, you may just want to disable this policy altogether; it was written for some people who have some very strict requirements for their code. (I personally don't use any of StricterSubs.) [-Subroutines::ProhibitCallsToUndeclaredSubs] Ignoring P::C, if you're using Readonly, you might want to consider using Readonly::XS; it's a /lot/ faster for scalars. It doesn't compile on 5.10 out of the box, but the fix is really simple if you look at the code. However, for R::XS to take effect, you've got to use the full Scalar() subroutine name, you can't just use "Readonly": Readonly::Scalar my $HI => 50; You don't need to look at Readonly::Array() or Readonly::Hash(), R::XS does nothing in terms of optimizing those.
Subject: Re: [rt.cpan.org #41858] Readonly issues: documentation doesn't match binary
Date: Sun, 21 Dec 2008 23:20:33 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Wolfman2000 <wolfman.ncsu2000 [...] gmail.com>
Download (untitled) / with headers
text/plain 2.3k
Readonly::XS's tests do not pass on my machine. I prefer to not install anything where tests don't pass. As far as P::C::StricterSubs goes...if it's not the use strict, I don't recall what it's for. Also, Perl::Critic complains if I use Readonly::Scalar due to not defining the exported Scalar function...something like that. Hope that helps. Wolfman2000 PS: This bug is also in the development version. On Dec 21, 2008, at 11:09 PM, Elliot Shank via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=41858 > > > Wolfman via RT wrote:
>> This is bare minimum code for how Readonly is supposed to be used for >> constants. However, running perlcritic -4 (down to -1) FILE >> reports this: >> >> Subroutine "Readonly" is neither declared nor explicitly imported at >> line 3, column 1. This might be a major bug. (Severity: 4) >> >> Please confirm I'm using the syntax right.
> > Ooh. You're using P::C::StricterSubs. You're really going in for > the serious stuff. :] > > One hint: put "verbose = %f: %m at line %l, column %c. %e. > (Severity: %s, %p)\n" (yes, the characters "\" and "n" in there) > into your perlcriticrc. The "%p" will give you the short name of > the policy in question. > > Anyway, > Perl::Critic::Policy::Subroutines::ProhibitCallsToUndeclaredSubs > doesn't take Readonly into account, unfortunately. However, it does > have an exempt_subs option. So, in your perlcriticrc, you can put > something like this: > > [Subroutines::ProhibitCallsToUndeclaredSubs] > exempt_subs = Readonly::Readonly > > On the other hand, you may just want to disable this policy > altogether; it was written for some people who have some very strict > requirements for their code. (I personally don't use any of > StricterSubs.) > > [-Subroutines::ProhibitCallsToUndeclaredSubs] > > > Ignoring P::C, if you're using Readonly, you might want to consider > using Readonly::XS; it's a /lot/ faster for scalars. It doesn't > compile on 5.10 out of the box, but the fix is really simple if you > look at the code. However, for R::XS to take effect, you've got to > use the full Scalar() subroutine name, you can't just use "Readonly": > > Readonly::Scalar my $HI => 50; > > You don't need to look at Readonly::Array() or Readonly::Hash(), > R::XS does nothing in terms of optimizing those. >
Subject: Re: [rt.cpan.org #41858] Readonly issues: documentation doesn't match binary
Date: Sun, 21 Dec 2008 22:42:27 -0600
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Download (untitled) / with headers
text/plain 581b
Wolfman via RT wrote: Show quoted text
> As far as P::C::StricterSubs goes...if it's not the use strict, I > don't recall what it's for. > > Also, Perl::Critic complains if I use Readonly::Scalar due to not > defining the exported Scalar function...something like that.
P::C::StricterSubs is not part of Perl::Critic proper. It is a separate distribution of add-on policies: http://search.cpan.org/dist/Perl-Critic-StricterSubs/. If you want the full range of Readonly while this policy is in effect, set exempt_subs to "Readonly::Readonly Readonly::Scalar Readonly::Array Readonly::Hash".
Subject: Problems with Readonly
Download (untitled) / with headers
text/plain 112b
Some problems with ProhibitUndeclaredSubs where reported here: https://rt.cpan.org/Ticket/Display.html?id=41858


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.