Skip to content

Commit bf14a66

Browse files
committed
apply dzil perltidy
1 parent 5781b88 commit bf14a66

File tree

154 files changed

+6172
-6087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+6172
-6087
lines changed

README.pod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
=pod
23

34
=head1 NAME

lib/PPI.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use strict;
88
# Set the version for CPAN
99
our $VERSION = '1.282';
1010

11-
our ( $XS_COMPATIBLE, @XS_EXCLUDE ) = ( '0.845' );
11+
our ( $XS_COMPATIBLE, @XS_EXCLUDE ) = ('0.845');
1212

1313
# Load everything
1414
use PPI::Util ();
@@ -29,7 +29,7 @@ use PPI::Lexer ();
2929
die
3030
if !$PPI::XS_DISABLE
3131
and !eval { require PPI::XS; 1 }
32-
and $@ !~ /^Can't locate .*? at /; # ignore failure to load if not installed
32+
and $@ !~ /^Can't locate .*? at /; # ignore failure to load if not installed
3333

3434
1;
3535

lib/PPI/Cache.pm

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use PPI::Document ();
5656

5757
our $VERSION = '1.282';
5858

59-
use constant VMS => !! ( $^O eq 'VMS' );
59+
use constant VMS => !!( $^O eq 'VMS' );
6060

6161
sub import {
6262
my $class = ref $_[0] ? ref shift : shift;
@@ -66,17 +66,13 @@ sub import {
6666
my $cache = $class->new(@_);
6767

6868
# Make PPI::Document use it
69-
unless ( PPI::Document->set_cache( $cache ) ) {
69+
unless ( PPI::Document->set_cache($cache) ) {
7070
Carp::croak("Failed to set cache in PPI::Document");
7171
}
7272

7373
1;
7474
}
7575

76-
77-
78-
79-
8076
#####################################################################
8177
# Constructor and Accessors
8278

@@ -115,21 +111,21 @@ sub new {
115111

116112
# Path should exist and be usable
117113
my $path = $params{path}
118-
or Carp::croak("Cannot create PPI::Cache, no path provided");
114+
or Carp::croak("Cannot create PPI::Cache, no path provided");
119115
unless ( -d $path ) {
120116
Carp::croak("Cannot create PPI::Cache, path does not exist");
121117
}
122118
unless ( -r $path and -x $path ) {
123119
Carp::croak("Cannot create PPI::Cache, no read permissions for path");
124120
}
125-
if ( ! $params{readonly} and ! -w $path ) {
121+
if ( !$params{readonly} and !-w $path ) {
126122
Carp::croak("Cannot create PPI::Cache, no write permissions for path");
127123
}
128124

129125
# Create the basic object
130126
my $self = bless {
131127
path => $path,
132-
readonly => !! $params{readonly},
128+
readonly => !!$params{readonly},
133129
}, $class;
134130

135131
$self;
@@ -157,10 +153,6 @@ to the cache.
157153

158154
sub readonly { $_[0]->{readonly} }
159155

160-
161-
162-
163-
164156
#####################################################################
165157
# PPI::Cache Methods
166158

@@ -174,9 +166,10 @@ cache and retrieves it if so.
174166
=cut
175167

176168
sub get_document {
177-
my $self = ref $_[0]
178-
? shift
179-
: Carp::croak('PPI::Cache::get_document called as static method');
169+
my $self =
170+
ref $_[0]
171+
? shift
172+
: Carp::croak('PPI::Cache::get_document called as static method');
180173
my $md5hex = $self->_md5hex(shift) or return undef;
181174
$self->_load($md5hex);
182175
}
@@ -196,7 +189,7 @@ FIXME (make this return either one or the other, not both)
196189

197190
sub store_document {
198191
my $self = shift;
199-
my $Document = _INSTANCE(shift, 'PPI::Document') or return undef;
192+
my $Document = _INSTANCE( shift, 'PPI::Document' ) or return undef;
200193

201194
# Shortcut if we are readonly
202195
return 1 if $self->readonly;
@@ -208,43 +201,42 @@ sub store_document {
208201
$self->_store( $md5hex, $Document );
209202
}
210203

211-
212-
213-
214-
215204
#####################################################################
216205
# Support Methods
217206

218207
# Store an arbitrary PPI::Document object (using Storable) to a particular
219208
# path within the cache filesystem.
220209
sub _store {
221-
my ($self, $md5hex, $object) = @_;
222-
my ($dir, $file) = $self->_paths($md5hex);
210+
my ( $self, $md5hex, $object ) = @_;
211+
my ( $dir, $file ) = $self->_paths($md5hex);
223212

224213
# Save the file
225214
File::Path::mkpath( $dir, 0, 0755 ) unless -d $dir;
226-
if ( VMS ) {
215+
if (VMS) {
227216
Storable::lock_nstore( $object, $file );
228-
} else {
217+
}
218+
else {
229219
Storable::nstore( $object, $file );
230220
}
231221
}
232222

233223
# Load an arbitrary object (using Storable) from a particular
234224
# path within the cache filesystem.
235225
sub _load {
236-
my ($self, $md5hex) = @_;
237-
my (undef, $file) = $self->_paths($md5hex);
226+
my ( $self, $md5hex ) = @_;
227+
my ( undef, $file ) = $self->_paths($md5hex);
238228

239229
# Load the file
240230
return '' unless -f $file;
241-
my $object = VMS
242-
? Storable::retrieve( $file )
243-
: Storable::lock_retrieve( $file );
231+
my $object =
232+
VMS
233+
? Storable::retrieve($file)
234+
: Storable::lock_retrieve($file);
244235

245236
# Security check
246-
unless ( _INSTANCE($object, 'PPI::Document') ) {
247-
Carp::croak("Security Violation: Object in '$file' is not a PPI::Document");
237+
unless ( _INSTANCE( $object, 'PPI::Document' ) ) {
238+
Carp::croak(
239+
"Security Violation: Object in '$file' is not a PPI::Document");
248240
}
249241

250242
$object;
@@ -254,20 +246,25 @@ sub _load {
254246
sub _paths {
255247
my $self = shift;
256248
my $md5hex = lc shift;
257-
my $dir = File::Spec->catdir( $self->path, substr($md5hex, 0, 1), substr($md5hex, 0, 2) );
258-
my $file = File::Spec->catfile( $dir, $md5hex . '.ppi' );
259-
return ($dir, $file);
249+
my $dir = File::Spec->catdir(
250+
$self->path,
251+
substr( $md5hex, 0, 1 ),
252+
substr( $md5hex, 0, 2 )
253+
);
254+
my $file = File::Spec->catfile( $dir, $md5hex . '.ppi' );
255+
return ( $dir, $file );
260256
}
261257

262258
# Check a md5hex param
263259
sub _md5hex {
264260
my $either = shift;
265-
my $it = _SCALAR($_[0])
266-
? PPI::Util::md5hex(${$_[0]})
267-
: $_[0];
268-
return (defined $it and ! ref $it and $it =~ /^[[:xdigit:]]{32}\z/s)
269-
? lc $it
270-
: undef;
261+
my $it =
262+
_SCALAR( $_[0] )
263+
? PPI::Util::md5hex( ${ $_[0] } )
264+
: $_[0];
265+
return ( defined $it and !ref $it and $it =~ /^[[:xdigit:]]{32}\z/s )
266+
? lc $it
267+
: undef;
271268
}
272269

273270
1;

0 commit comments

Comments
 (0)