[guest - Fri Sep 30 16:26:19 2005]:
Show quoted text> I'm getting an error of "Integer with leading zeros" on the following:
>
> chmod 0755, $path;
>
> Do I really have to use "oct" here? The Perl manpage on "chmod" shows
> using the leading zero, so it would be nice not to complain about
> it at least in this one context.
>
> Other than seconding a few other bugs already posted ($1 seen as
> punctuation var, 1900 seen as a long number), and my other bug,
> this is a TOTALLY ROCKIN' MODULE. Thank you so much for writing
> it!
>
> ky
This seems to fix my problems:
$ diff -c ProhibitLeadingZeros.pm.orig ProhibitLeadingZeros.pm
*** ProhibitLeadingZeros.pm.orig 2005-09-30 18:04:28.000000000 -0400
--- ProhibitLeadingZeros.pm 2005-09-30 18:04:41.000000000 -0400
***************
*** 13,19 ****
my $expl = [55];
my $desc = q{Integer with leading zeros};
my $nodes_ref = $doc->find('PPI::Token::Number') || return;
! my @matches = grep { $_ =~ m{\A -? 0+ \d+ \z }x } @{$nodes_ref};
return map { Perl::Critic::Violation->new( $desc, $expl,
$_->location() ) }
@matches;
--- 13,23 ----
my $expl = [55];
my $desc = q{Integer with leading zeros};
my $nodes_ref = $doc->find('PPI::Token::Number') || return;
! my @matches = grep {
! $_ =~ m{\A -? 0+ \d+ \z }x
! &&
! $_->statement !~ m{ \A chmod }x
! } @{$nodes_ref};
return map { Perl::Critic::Violation->new( $desc, $expl,
$_->location() ) }
@matches;
ky