Author: bernhard
Date: Sat Mar  4 12:17:22 2006
New Revision: 11790

Modified:
   trunk/lib/Parrot/Distribution.pm
   trunk/lib/Parrot/Docs/POD2HTML.pm
   trunk/lib/Parrot/IO/Directory.pm
   trunk/lib/Parrot/IO/File.pm
   trunk/lib/Parrot/IO/Path.pm

Log:
Remove some explicit returns of 'undef'
Detabify some Perl5 modules.


Modified: trunk/lib/Parrot/Distribution.pm
==============================================================================
--- trunk/lib/Parrot/Distribution.pm    (original)
+++ trunk/lib/Parrot/Distribution.pm    Sat Mar  4 12:17:22 2006
@@ -1,4 +1,4 @@
-# Copyright: 2004-2005 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2004-2006 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -8,7 +8,8 @@
 =head1 SYNOPSIS
 
     use Parrot::Distribution;
-    $dist = Parrot::Distribution->new();
+
+    my $dist = Parrot::Distribution->new();
 
 =head1 DESCRIPTION
 
@@ -29,6 +30,7 @@
 package Parrot::Distribution;
 
 use strict;
+use warnings;
 
 use Data::Dumper;
 use ExtUtils::Manifest;
@@ -37,7 +39,7 @@
 use Parrot::Configure::Step qw(capture_output);
 
 use Parrot::Docs::Directory;
[EMAIL PROTECTED]::Distribution::ISA = qw(Parrot::Docs::Directory);
+our @ISA = qw(Parrot::Docs::Directory);
 
 =item C<new()>
 
@@ -114,7 +116,7 @@
 sub c_source_file_with_name
 {
     my $self = shift;
-    my $name = shift || return undef;
+    my $name = shift || return;
     
     $name .= '.c' unless $name =~ /\.[Cc]$/o;
     
@@ -125,7 +127,7 @@
     }
     
     print 'WARNING: ' . __FILE__ . ':' . __LINE__ . ' File not found:' . $name 
."\n";
-    return undef;
+    return;
 }
 
 =item C<c_header_file_directories()>
@@ -156,7 +158,7 @@
 sub c_header_file_with_name
 {
     my $self = shift;
-    my $name = shift || return undef;
+    my $name = shift || return;
     
     $name .= '.h' unless $name =~ /\.[Hh]$/o;
     
@@ -166,7 +168,7 @@
             if $dir->file_exists_with_name($name);
     }
     
-    return undef;
+    return;
 }
 
 =item C<file_for_perl_module($module)>
@@ -178,7 +180,7 @@
 sub file_for_perl_module
 {
     my $self = shift;
-    my $module = shift || return undef;
+    my $module = shift || return;
 
     my @path = split '::', $module;
     
@@ -189,7 +191,7 @@
     
     foreach my $name (@path)
     {
-        return undef unless $dir = $dir->existing_directory_with_name($name);
+        return unless $dir = $dir->existing_directory_with_name($name);
     }
     
     return $dir->existing_file_with_name($module);

Modified: trunk/lib/Parrot/Docs/POD2HTML.pm
==============================================================================
--- trunk/lib/Parrot/Docs/POD2HTML.pm   (original)
+++ trunk/lib/Parrot/Docs/POD2HTML.pm   Sat Mar  4 12:17:22 2006
@@ -1,4 +1,4 @@
-# Copyright: 2004 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2004-2006 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -25,11 +25,13 @@
 package Parrot::Docs::POD2HTML;
 
 use strict;
+use warnings;
 
 use Pod::Simple::HTML;
[EMAIL PROTECTED]::Docs::POD2HTML::ISA = qw(Pod::Simple::HTML);
+our @ISA = qw(Pod::Simple::HTML);
+
 # This is just here to keep Pod::Simple::HTML's version_tag_comment() happy.
-$Parrot::Docs::POD2HTML::VERSION = '1.0';
+our $VERSION = '1.0';
 
 use Parrot::Docs::HTMLPage;
 
@@ -455,7 +457,7 @@
     my $to = $link->attr('to');
     my $section = $link->attr('section');
     
-    return undef unless
+    return unless
         ( defined $to and length $to ) or
         ( defined $section and length $section );
     
@@ -463,7 +465,7 @@
     {
         $to = $self->resolve_pod_page_link($to, $section);
         
-        return undef unless defined $to and length $to;
+        return unless defined $to and length $to;
     }
     
     if ( defined $section and length($section .= '') ) 
@@ -493,7 +495,7 @@
     $out = $to if defined $to and length $to;
     $out .= "#" . $section if defined $section and length $section;
     
-    return undef unless length $out;
+    return unless length $out;
     
     return $out;  
 }
@@ -549,7 +551,7 @@
     my $dist = Parrot::Distribution->new;
     my $file = $dist->file_for_perl_module($module);
     
-    return undef if not $file or not $file->contains_pod;
+    return if not $file or not $file->contains_pod;
     
     my $path = $self->append_html_suffix($dist->relative_path($file));
     
@@ -557,7 +559,7 @@
     $file = $self->{TARGET}->file_with_relative_path($path);
     
     # There's no point in linking to the file you are already in.
-    return undef if $file == $self->{DOCS_FILE};
+    return if $file == $self->{DOCS_FILE};
     
     return $self->href_path($self->{DOCS_FILE}->parent->relative_path($file));
 }
@@ -747,4 +749,4 @@
 
 =cut
 
-1;
\ No newline at end of file
+1;

Modified: trunk/lib/Parrot/IO/Directory.pm
==============================================================================
--- trunk/lib/Parrot/IO/Directory.pm    (original)
+++ trunk/lib/Parrot/IO/Directory.pm    Sat Mar  4 12:17:22 2006
@@ -1,4 +1,4 @@
-# Copyright: 2004 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2004-2006 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -7,7 +7,7 @@
 
 =head1 SYNOPSIS
 
-       use Parrot::IO::Directory;
+    use Parrot::IO::Directory;
 
 =head1 DESCRIPTION
 
@@ -40,7 +40,7 @@
 
 sub directory_class
 {
-       return 'Parrot::IO::Directory';
+    return 'Parrot::IO::Directory';
 }
 
 =item C<file_class()>
@@ -52,7 +52,7 @@
 
 sub file_class
 {
-       return 'Parrot::IO::File';
+    return 'Parrot::IO::File';
 }
 
 =item C<directory_with_path($path)>
@@ -67,9 +67,9 @@
 
 sub directory_with_path
 {
-       my $self = shift;
-       
-       return $self->directory_class->new(@_);
+    my $self = shift;
+    
+    return $self->directory_class->new(@_);
 }
 
 =item C<file_with_path($path)>
@@ -82,9 +82,9 @@
 
 sub file_with_path
 {
-       my $self = shift;
-       
-       return $self->file_class->new(@_);
+    my $self = shift;
+    
+    return $self->file_class->new(@_);
 }
 
 =item C<tmp_directory($path)>
@@ -96,9 +96,9 @@
 
 sub tmp_directory
 {
-       my $self = shift;
-       
-       return 
$self->directory_with_path(File::Spec->catdir(File::Spec->tmpdir, @_));
+    my $self = shift;
+    
+    return $self->directory_with_path(File::Spec->catdir(File::Spec->tmpdir, 
@_));
 }
 
 =item C<new($path)>
@@ -109,12 +109,12 @@
 
 sub new
 {
-       my $self = shift;
-       my $path = shift;
-       
-       return undef unless defined $path and ! -f $path;
-       
-       return $self->SUPER::new($path);
+    my $self = shift;
+    my $path = shift;
+    
+    return unless defined $path and ! -f $path;
+    
+    return $self->SUPER::new($path);
 }
 
 =back
@@ -131,17 +131,17 @@
 
 sub create_path
 {
-       my $self = shift;
-       
-       return undef unless $self->SUPER::create_path;
-       
-       unless ( -e $self->path )
-       {
-               # This dies if it fails.
-               mkpath($self->path);
-       }
-       
-       return -d $self->path;
+    my $self = shift;
+    
+    return unless $self->SUPER::create_path;
+    
+    unless ( -e $self->path )
+    {
+        # This dies if it fails.
+        mkpath($self->path);
+    }
+    
+    return -d $self->path;
 }
 
 =item C<relative_path($directory)>
@@ -150,18 +150,18 @@
 
 =item C<relative_path($path)>
 
-Returns the specified path relative to the directory.  
+Returns the specified path relative to the directory.    
 
 =cut
 
 sub relative_path
 {
-       my $self = shift;
-       my $path = shift || return undef;
-       
-       $path = $path->path if ref $path;
-       
-       my $rel_path = File::Spec->abs2rel($path, $self->path);
+    my $self = shift;
+    my $path = shift || return;
+    
+    $path = $path->path if ref $path;
+    
+    my $rel_path = File::Spec->abs2rel($path, $self->path);
 
     # some (all?) versions of File::Spec->abs2rel() prior to 3.13 return ''
     # instead of '.' to indicate the current working directory.  In order to be
@@ -179,11 +179,11 @@
 
 sub parent
 {
-       my $self = shift;
-       
-       return undef unless $self->parent_path;
-       
-       return $self->directory_with_path($self->parent_path);
+    my $self = shift;
+    
+    return unless $self->parent_path;
+    
+    return $self->directory_with_path($self->parent_path);
 }
 
 =item C<file_and_directory_names()>
@@ -195,9 +195,9 @@
 
 sub file_and_directory_names()
 {
-       my $self = shift;
+    my $self = shift;
     my $dh = DirHandle->new($self->path) or 
-       die "can't opendir $self->{PATH}: $!";
+        die "can't opendir $self->{PATH}: $!";
     
     return sort grep {$_ ne '.' and $_ ne '..'} $dh->read();
 }
@@ -210,11 +210,11 @@
 
 sub file_and_directory_paths()
 {
-       my $self = shift;
-       
-       return map  {
-               File::Spec->catfile($self->{PATH}, $_)
-       } $self->file_and_directory_names;
+    my $self = shift;
+    
+    return map  {
+        File::Spec->catfile($self->{PATH}, $_)
+    } $self->file_and_directory_names;
 }
 
 =item C<file_paths()>
@@ -225,7 +225,7 @@
 
 sub file_paths()
 {
-       my $self = shift;
+    my $self = shift;
 
     return sort grep {-f} $self->file_and_directory_paths;
 }
@@ -238,7 +238,7 @@
 
 sub directory_paths
 {
-       my $self = shift;
+    my $self = shift;
 
     return sort grep {-d} $self->file_and_directory_paths;
 }
@@ -251,10 +251,10 @@
 
 sub file_exists_with_name
 {
-       my $self = shift;
-       my $name = shift;
-       
-       return -f File::Spec->catfile($self->path, $name);
+    my $self = shift;
+    my $name = shift;
+    
+    return -f File::Spec->catfile($self->path, $name);
 }
 
 =item C<directory_exists_with_name($name)>
@@ -266,10 +266,10 @@
 
 sub directory_exists_with_name
 {
-       my $self = shift;
-       my $name = shift;
-       
-       return -d File::Spec->catdir($self->path, $name);
+    my $self = shift;
+    my $name = shift;
+    
+    return -d File::Spec->catdir($self->path, $name);
 }
 
 =item C<files($recursive, $ignore)>
@@ -284,22 +284,22 @@
 
 sub files
 {
-       my $self = shift;
-       my $recursive = shift;
-       my $ignore = shift;
-       my @files = map {$self->file_with_path($_)} $self->file_paths;
-       
-       if ( $recursive )
-       {
-               foreach my $dir ($self->directories)
-               {
-                       next if defined $ignore and $dir->name =~ /$ignore/;
-                       
-                       push @files, $dir->files(1, $ignore);
-               }
-       }
-       
-       return @files;
+    my $self = shift;
+    my $recursive = shift;
+    my $ignore = shift;
+    my @files = map {$self->file_with_path($_)} $self->file_paths;
+    
+    if ( $recursive )
+    {
+        foreach my $dir ($self->directories)
+        {
+            next if defined $ignore and $dir->name =~ /$ignore/;
+            
+            push @files, $dir->files(1, $ignore);
+        }
+    }
+    
+    return @files;
 }
 
 =item C<directories()>
@@ -311,9 +311,9 @@
 
 sub directories
 {
-       my $self = shift;
+    my $self = shift;
 
-       return map {$self->directory_with_path($_)} $self->directory_paths;
+    return map {$self->directory_with_path($_)} $self->directory_paths;
 }
 
 =item C<file_suffixes($recursive, $ignore)>
@@ -337,17 +337,17 @@
 
 sub file_suffixes
 {
-       my $self = shift;
-       my $recursive = shift;
-       my $ignore = shift;
-       my %suffixes = ();
-       
-       foreach my $file ($self->files($recursive, $ignore))
-       {
-               $suffixes{$file->suffix} = 1;
-       }
-       
-       return sort keys %suffixes;
+    my $self = shift;
+    my $recursive = shift;
+    my $ignore = shift;
+    my %suffixes = ();
+    
+    foreach my $file ($self->files($recursive, $ignore))
+    {
+        $suffixes{$file->suffix} = 1;
+    }
+    
+    return sort keys %suffixes;
 }
 
 =item C<files_with_suffix($suffix, $recursive, $ignore)>
@@ -363,22 +363,22 @@
 
 sub files_with_suffix
 {
-       my $self = shift;
-       my $suffix = shift;
-       
-       return () unless defined $suffix;
-       
-       my $recursive = shift;
-       my $ignore = shift;
-       my @files = ();
-       
-       foreach my $file ($self->files($recursive, $ignore))
-       {
-               next unless $file->has_suffix($suffix);
-               push @files, $file;
-       }
-       
-       return @files;
+    my $self = shift;
+    my $suffix = shift;
+    
+    return unless defined $suffix;
+    
+    my $recursive = shift;
+    my $ignore = shift;
+    my @files = ();
+    
+    foreach my $file ($self->files($recursive, $ignore))
+    {
+        next unless $file->has_suffix($suffix);
+        push @files, $file;
+    }
+    
+    return @files;
 }
 
 =item C<path_for_directory_with_name($name)>
@@ -390,10 +390,10 @@
 
 sub path_for_directory_with_name
 {
-       my $self = shift;
-       my $name = shift || return undef;
-       
-       return File::Spec->catdir($self->path, $name);
+    my $self = shift;
+    my $name = shift || return;
+    
+    return File::Spec->catdir($self->path, $name);
 }
 
 =item C<path_for_file_with_name($name)>
@@ -404,10 +404,10 @@
 
 sub path_for_file_with_name
 {
-       my $self = shift;
-       my $name = shift || return undef;
-       
-       return File::Spec->catfile($self->path, $name);
+    my $self = shift;
+    my $name = shift || return;
+    
+    return File::Spec->catfile($self->path, $name);
 }
 
 =item C<directory_with_name($name)>
@@ -418,10 +418,10 @@
 
 sub directory_with_name
 {
-       my $self = shift;
-       my $path = $self->path_for_directory_with_name(shift) || return undef;
-       
-       return $self->directory_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_directory_with_name(shift) || return;
+    
+    return $self->directory_with_path($path);
 }
 
 =item C<file_with_name($name)>
@@ -432,10 +432,10 @@
 
 sub file_with_name
 {
-       my $self = shift;
-       my $path = $self->path_for_file_with_name(shift) || return undef;
-       
-       return $self->file_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_file_with_name(shift) || return;
+    
+    return $self->file_with_path($path);
 }
 
 =item C<existing_directory_with_name($name)>
@@ -446,12 +446,12 @@
 
 sub existing_directory_with_name
 {
-       my $self = shift;
-       my $path = $self->path_for_directory_with_name(shift) || return undef;
-       
-       return undef unless -d $path;
-       
-       return $self->directory_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_directory_with_name(shift) || return;
+    
+    return unless -d $path;
+    
+    return $self->directory_with_path($path);
 }
 
 =item C<existing_file_with_name($name)>
@@ -462,12 +462,12 @@
 
 sub existing_file_with_name
 {
-       my $self = shift;
-       my $path = $self->path_for_file_with_name(shift) || return undef;
-       
-       return undef unless -f $path;
-       
-       return $self->file_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_file_with_name(shift) || return;
+    
+    return unless -f $path;
+    
+    return $self->file_with_path($path);
 }
 
 =item C<path_for_directory_with_relative_path($path)>
@@ -479,11 +479,11 @@
 
 sub path_for_directory_with_relative_path
 {
-       my $self = shift;
-       my $path = shift || return undef;
-       my ($volume, $directories, $name) = File::Spec->splitpath($path);
-       
-       return File::Spec->catdir($self->path, $directories, $name);
+    my $self = shift;
+    my $path = shift || return;
+    my ($volume, $directories, $name) = File::Spec->splitpath($path);
+    
+    return File::Spec->catdir($self->path, $directories, $name);
 }
 
 =item C<path_for_file_with_relative_path($path)>
@@ -495,14 +495,14 @@
 
 sub path_for_file_with_relative_path
 {
-       my $self = shift;
-       my $path = shift || return undef;
-       my ($volume, $directories, $name) = File::Spec->splitpath($path);
-       
-       $path = File::Spec->catdir($self->path, $directories);
-       $path = File::Spec->catfile($path, $name);
-       
-       return $path;
+    my $self = shift;
+    my $path = shift || return;
+    my ($volume, $directories, $name) = File::Spec->splitpath($path);
+    
+    $path = File::Spec->catdir($self->path, $directories);
+    $path = File::Spec->catfile($path, $name);
+    
+    return $path;
 }
 
 =item C<relative_path_is_directory($path)>
@@ -513,12 +513,12 @@
 
 sub relative_path_is_directory
 {
-       my $self = shift;
-       my $path = $self->path_for_directory_with_relative_path(shift);
-       
-       return undef unless $path;
-       
-       return -d $path;
+    my $self = shift;
+    my $path = $self->path_for_directory_with_relative_path(shift);
+    
+    return unless $path;
+    
+    return -d $path;
 }
 
 =item C<relative_path_is_file($path)>
@@ -529,12 +529,12 @@
 
 sub relative_path_is_file
 {
-       my $self = shift;
-       my $path = $self->path_for_file_with_relative_path(shift);
-       
-       return undef unless $path;
-       
-       return -f $path;
+    my $self = shift;
+    my $path = $self->path_for_file_with_relative_path(shift);
+    
+    return unless $path;
+    
+    return -f $path;
 }
 
 =item C<directory_with_relative_path($path)>
@@ -545,12 +545,12 @@
 
 sub directory_with_relative_path
 {
-       my $self = shift;
-       my $path = $self->path_for_directory_with_relative_path(shift);
-       
-       return undef unless $path;
-       
-       return $self->directory_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_directory_with_relative_path(shift);
+    
+    return unless $path;
+    
+    return $self->directory_with_path($path);
 }
 
 =item C<file_with_relative_path($path)>
@@ -561,10 +561,10 @@
 
 sub file_with_relative_path
 {
-       my $self = shift;
-       my $path = $self->path_for_file_with_relative_path(shift) || return 
undef;
-       
-       return $self->file_with_path($path);
+    my $self = shift;
+    my $path = $self->path_for_file_with_relative_path(shift) || return;
+    
+    return $self->file_with_path($path);
 }
 
 =item C<delete()>
@@ -578,12 +578,12 @@
 
 sub delete
 {
-       # Use $_[0] so that we can undef the instance in SUPER::delete().
-       
-       $_[0]->delete_contents;
-       rmdir($_[0]->path) or die 'Failed to rmdir ' . $_[0]->path . ": $!";
-       
-       $_[0]->SUPER::delete;
+    # Use $_[0] so that we can undef the instance in SUPER::delete().
+    
+    $_[0]->delete_contents;
+    rmdir($_[0]->path) or die 'Failed to rmdir ' . $_[0]->path . ": $!";
+    
+    $_[0]->SUPER::delete;
 }
 
 =item C<delete_contents()>
@@ -596,17 +596,17 @@
 
 sub delete_contents
 {
-       my $self = shift;
+    my $self = shift;
 
-       foreach my $file ($self->files)
-       {
-               $file->delete;
-       }
-       
-       foreach my $dir ($self->directories)
-       {
-               $dir->delete;
-       }
+    foreach my $file ($self->files)
+    {
+        $file->delete;
+    }
+    
+    foreach my $dir ($self->directories)
+    {
+        $dir->delete;
+    }
 }
 
 =back

Modified: trunk/lib/Parrot/IO/File.pm
==============================================================================
--- trunk/lib/Parrot/IO/File.pm (original)
+++ trunk/lib/Parrot/IO/File.pm Sat Mar  4 12:17:22 2006
@@ -1,4 +1,4 @@
-# Copyright: 2004 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2004-2006 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -7,7 +7,7 @@
 
 =head1 SYNOPSIS
 
-       use Parrot::IO::File;
+    use Parrot::IO::File;
 
 =head1 DESCRIPTION
 
@@ -22,9 +22,10 @@
 package Parrot::IO::File;
 
 use strict;
+use warnings;
 
 use Parrot::IO::Path;
[EMAIL PROTECTED]::IO::File::ISA = qw(Parrot::IO::Path);
+our @ISA = qw(Parrot::IO::Path);
 
 use FileHandle;
 use Parrot::IO::Directory;
@@ -38,9 +39,9 @@
 
 sub tmp_file
 {
-       my $self = shift;
-       
-       return $self->new(File::Spec->catfile(File::Spec->tmpdir, @_));
+    my $self = shift;
+    
+    return $self->new(File::Spec->catfile(File::Spec->tmpdir, @_));
 }
 
 =item C<new($path)>
@@ -51,12 +52,12 @@
 
 sub new
 {
-       my $self = shift;
-       my $path = shift;
-       
-       return undef unless defined $path and ! -d $path;
-       
-       return $self->SUPER::new($path);
+    my $self = shift;
+    my $path = shift;
+    
+    return unless defined $path and ! -d $path;
+    
+    return $self->SUPER::new($path);
 }
 
 =back
@@ -73,29 +74,29 @@
 
 sub create_path
 {
-       my $self = shift;
-       
-       return undef unless $self->SUPER::create_path;
-       
-       # Just to touch the file.
-       # Make sure write() doesn't dismiss this as a noop.
-       $self->write('') unless -e $self->path;
-       
-       return -f $self->path;
+    my $self = shift;
+    
+    return unless $self->SUPER::create_path;
+    
+    # Just to touch the file.
+    # Make sure write() doesn't dismiss this as a noop.
+    $self->write('') unless -e $self->path;
+    
+    return -f $self->path;
 }
 
 =item C<parent($path)>
 
-Returns the file's parent directory.   
+Returns the file's parent directory.    
 
 =cut
 
 sub parent
 {
-       my $self = shift;
-       my $path = shift;
-       
-       return Parrot::IO::Directory->new($self->parent_path);
+    my $self = shift;
+    my $path = shift;
+    
+    return Parrot::IO::Directory->new($self->parent_path);
 }
 
 =item C<read()>
@@ -110,14 +111,14 @@
 
 sub read
 {
-       my $self = shift;
-       my $fh = FileHandle->new($self->path) or 
-               die 'Failed to open ' . $self->path . ": $!";
-       my @lines = <$fh>;
-       
-       $fh->close;
-       
-       return wantarray ? @lines : join '', @lines;
+    my $self = shift;
+    my $fh = FileHandle->new($self->path) or 
+        die 'Failed to open ' . $self->path . ": $!";
+    my @lines = <$fh>;
+    
+    $fh->close;
+    
+    return wantarray ? @lines : join '', @lines;
 }
 
 =item C<write(@lines)>
@@ -128,16 +129,16 @@
 
 sub write
 {
-       my $self = shift;
-       
-       return unless @_;
-       
-       my $fh = FileHandle->new('>' . $self->path) or 
-               die 'Failed to open ' . $self->path . ": $!";
-       
-       print $fh @_;
-       
-       $fh->close;
+    my $self = shift;
+    
+    return unless @_;
+    
+    my $fh = FileHandle->new('>' . $self->path) or 
+        die 'Failed to open ' . $self->path . ": $!";
+    
+    print $fh @_;
+    
+    $fh->close;
 }
 
 =item C<append(@lines)>
@@ -148,16 +149,16 @@
 
 sub append
 {
-       my $self = shift;
-       
-       return unless @_;
-       
-       my $fh = FileHandle->new('>>' . $self->path) or 
-               die 'Failed to open ' . $self->path . ": $!";
-       
-       print $fh @_;
-       
-       $fh->close;
+    my $self = shift;
+    
+    return unless @_;
+    
+    my $fh = FileHandle->new('>>' . $self->path) or 
+        die 'Failed to open ' . $self->path . ": $!";
+    
+    print $fh @_;
+    
+    $fh->close;
 }
 
 =item C<is_executable()>
@@ -168,9 +169,9 @@
 
 sub is_executable
 {
-       my $self = shift;
-       
-       return $self->stat->mode & 0111;
+    my $self = shift;
+    
+    return $self->stat->mode & 0111;
 }
 
 =item C<modified_since($time)>
@@ -183,10 +184,10 @@
 
 sub modified_since
 {
-       my $self = shift;
-       my $time = shift;
-       
-       return $self->stat->mtime > $time;
+    my $self = shift;
+    my $time = shift;
+    
+    return $self->stat->mtime > $time;
 }
 
 =item C<cvs_id()>
@@ -197,12 +198,12 @@
 
 sub cvs_id
 {
-       my $self = shift;
-       my $content = $self->read;
-       # Break up the $Id to prevent CVS messing with it.
-       my ($id) = $content =~ /((?:\$)Id:[^\$]+\$)/so;
-       
-       return $id;
+    my $self = shift;
+    my $content = $self->read;
+    # Break up the $Id to prevent CVS messing with it.
+    my ($id) = $content =~ /((?:\$)Id:[^\$]+\$)/so;
+    
+    return $id;
 }
 
 =item C<has_cvs_id()>
@@ -213,12 +214,12 @@
 
 sub has_cvs_id
 {
-       my $self = shift;
-       my $content = $self->read;
-       # Break up the $Id to prevent CVS messing with it.
-       my $has_id = $content =~ /(?:\$)Id:[^\$]+\$/so;
-       
-       return $has_id;
+    my $self = shift;
+    my $content = $self->read;
+    # Break up the $Id to prevent CVS messing with it.
+    my $has_id = $content =~ /(?:\$)Id:[^\$]+\$/so;
+    
+    return $has_id;
 }
 
 =item C<cvs_version()>
@@ -229,11 +230,11 @@
 
 sub cvs_version
 {
-       my $self = shift;
-       my $id = $self->cvs_id;
-       my ($version) = $id =~ /,v\s+(\S+)/s;
-       
-       return $version;
+    my $self = shift;
+    my $id = $self->cvs_id;
+    my ($version) = $id =~ /,v\s+(\S+)/s;
+    
+    return $version;
 }
 
 =item C<is_hidden()>
@@ -244,9 +245,9 @@
 
 sub is_hidden
 {
-       my $self = shift;
+    my $self = shift;
 
-       return $self->parent eq 'CVS' or $self->name =~ /^\./o;
+    return $self->parent eq 'CVS' or $self->name =~ /^\./o;
 }
 
 =item C<is_generated()>
@@ -257,27 +258,27 @@
 
 sub is_generated
 {
-       my $self = shift;
-       
-       # CFLAGS
-       # libparrot.def
-       # Makefile
-       # myconfig
-       
-       # include/parrot/config.h
-       # include/parrot/core_pmcs.h
-       # include/parrot/feature.h
-       # include/parrot/platform.h
-       
-       # runtime/parrot/include/* (all?)
-
-       # lib/Parrot/Config.pm
-       
-       return 1 if $self->suffix =~ /^(?:dump|html|flag|o)$/o
-               or $self->name =~ 
/^(?:perl6-config|libparrot.def|CFLAGS|myconfig|(?:core_pmcs|exec_(?:cpu|dep)|fingerprint|jit_(?:cpu|emit)|nci|platform(?:_interface)?)\.[ch]|(?:charclass|feature)\.h)$/o
-               or $self->parent->name eq 'ops' and $self->suffix =~ 
/^(?:c|pod)$/;
-       
-       return 0;
+    my $self = shift;
+    
+    # CFLAGS
+    # libparrot.def
+    # Makefile
+    # myconfig
+    
+    # include/parrot/config.h
+    # include/parrot/core_pmcs.h
+    # include/parrot/feature.h
+    # include/parrot/platform.h
+    
+    # runtime/parrot/include/* (all?)
+
+    # lib/Parrot/Config.pm
+    
+    return 1 if $self->suffix =~ /^(?:dump|html|flag|o)$/o
+        or $self->name =~ 
/^(?:perl6-config|libparrot.def|CFLAGS|myconfig|(?:core_pmcs|exec_(?:cpu|dep)|fingerprint|jit_(?:cpu|emit)|nci|platform(?:_interface)?)\.[ch]|(?:charclass|feature)\.h)$/o
+        or $self->parent->name eq 'ops' and $self->suffix =~ /^(?:c|pod)$/;
+    
+    return 0;
 }
 
 =item C<delete()>
@@ -290,11 +291,11 @@
 
 sub delete
 {
-       # Use $_[0] so that we can undef the instance in SUPER::delete().
-       
-       unlink($_[0]->path) or die 'Failed to unlink ' . $_[0]->path . ": $!";
-       
-       $_[0]->SUPER::delete;
+    # Use $_[0] so that we can undef the instance in SUPER::delete().
+    
+    unlink($_[0]->path) or die 'Failed to unlink ' . $_[0]->path . ": $!";
+    
+    $_[0]->SUPER::delete;
 }
 
 =back

Modified: trunk/lib/Parrot/IO/Path.pm
==============================================================================
--- trunk/lib/Parrot/IO/Path.pm (original)
+++ trunk/lib/Parrot/IO/Path.pm Sat Mar  4 12:17:22 2006
@@ -1,4 +1,4 @@
-# Copyright: 2004 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2004-2006 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -23,6 +23,7 @@
 
 use strict;
 use warnings;
+
 use File::Path;
 use File::Spec;
 # qw() to avoid the export because we have a stat() method.
@@ -39,46 +40,46 @@
 
 sub new
 {
-       my $self = ref $_[0] ? ref shift : shift;
-       my $path = shift;
-       
-       return undef unless defined $path;
-       
-       $path = File::Spec->rel2abs($path);
-       
-       # Clean up any /foo/../ stuff.
-       while ( $path =~ s|/[^/]+/\.\.|| ) {}
-
-       if ( exists $instance_for_path{$path} )
-       {
-               if ( ref($instance_for_path{$path}) ne $self )
-               {
-                       bless $instance_for_path{$path}, $self;
-               }
-               
-               return $instance_for_path{$path};
-       }
-       
-       my ($volume, $directories, $name) = File::Spec->splitpath($path);
-       
-       # Needs '' to avoid a warning.
-       my $parent_path = File::Spec->catpath($volume, $directories, '');
-       
-       # To remove the trailing slash.
-       $parent_path = File::Spec->canonpath($parent_path);
-       
-       # If we are root then the above will make parent the same as path.
-       undef $parent_path if $parent_path eq $path;
-       
-       $self = bless {
-               PATH => $path,
-               NAME => $name,
-               PARENT_PATH => $parent_path,
-       }, $self;
-       
-       return undef unless $self->create_path;
-       
-       return $instance_for_path{$path} = $self;
+    my $self = ref $_[0] ? ref shift : shift;
+    my $path = shift;
+    
+    return unless defined $path;
+    
+    $path = File::Spec->rel2abs($path);
+    
+    # Clean up any /foo/../ stuff.
+    while ( $path =~ s|/[^/]+/\.\.|| ) {}
+
+    if ( exists $instance_for_path{$path} )
+    {
+        if ( ref($instance_for_path{$path}) ne $self )
+        {
+            bless $instance_for_path{$path}, $self;
+        }
+        
+        return $instance_for_path{$path};
+    }
+    
+    my ($volume, $directories, $name) = File::Spec->splitpath($path);
+    
+    # Needs '' to avoid a warning.
+    my $parent_path = File::Spec->catpath($volume, $directories, '');
+    
+    # To remove the trailing slash.
+    $parent_path = File::Spec->canonpath($parent_path);
+    
+    # If we are root then the above will make parent the same as path.
+    undef $parent_path if $parent_path eq $path;
+    
+    $self = bless {
+        PATH => $path,
+        NAME => $name,
+        PARENT_PATH => $parent_path,
+    }, $self;
+    
+    return unless $self->create_path;
+    
+    return $instance_for_path{$path} = $self;
 }
 
 =back
@@ -96,17 +97,17 @@
 
 sub create_path
 {
-       my $self = shift;
-       
-       return 1 unless $self->parent_path;
-       
-       unless ( -e $self->parent_path )
-       {
-               # This dies if it fails.
-               mkpath($self->parent_path);
-       }
-       
-       return -e $self->parent_path;
+    my $self = shift;
+    
+    return 1 unless $self->parent_path;
+    
+    unless ( -e $self->parent_path )
+    {
+        # This dies if it fails.
+        mkpath($self->parent_path);
+    }
+    
+    return -e $self->parent_path;
 }
 
 =item C<path()>
@@ -117,9 +118,9 @@
 
 sub path
 {
-       my $self = shift;
-       
-       return $self->{PATH};
+    my $self = shift;
+    
+    return $self->{PATH};
 }
 
 =item C<name()>
@@ -130,9 +131,9 @@
 
 sub name
 {
-       my $self = shift;
-       
-       return $self->{NAME};
+    my $self = shift;
+    
+    return $self->{NAME};
 }
 
 =item C<name_without_suffix()>
@@ -143,12 +144,12 @@
 
 sub name_without_suffix
 {
-       my $self = shift;
-       my $name = $self->name;
-       
+    my $self = shift;
+    my $name = $self->name;
+    
     $name =~ s/\.[^\.]*$//o;
     
-    return $name;      
+    return $name;    
 }
 
 =item C<suffix()>
@@ -160,15 +161,15 @@
 
 sub suffix
 {
-       my $self = shift;
-       
-       return $self->{SUFFIX} if exists $self->{SUFFIX};
-       
-       my ($suffix) = $self->name =~ /\.([^.]+)$/;
-       
-       $self->{SUFFIX} = defined $suffix ? $suffix : '';
-       
-       return $self->{SUFFIX};
+    my $self = shift;
+    
+    return $self->{SUFFIX} if exists $self->{SUFFIX};
+    
+    my ($suffix) = $self->name =~ /\.([^.]+)$/;
+    
+    $self->{SUFFIX} = defined $suffix ? $suffix : '';
+    
+    return $self->{SUFFIX};
 }
 
 =item C<has_suffix()>
@@ -186,16 +187,16 @@
 
 sub has_suffix
 {
-       my $self = shift;
-       my $suffix = $self->suffix;
-       
-       if ( @_ > 0 )
-       {
-               return 0 unless defined $_[0];
-               return $_[0] eq $suffix;
-       }
-       
-       return $suffix ne '';
+    my $self = shift;
+    my $suffix = $self->suffix;
+    
+    if ( @_ > 0 )
+    {
+        return 0 unless defined $_[0];
+        return $_[0] eq $suffix;
+    }
+    
+    return $suffix ne '';
 }
 
 =item C<parent_path()>
@@ -206,9 +207,9 @@
 
 sub parent_path
 {
-       my $self = shift;
-       
-       return $self->{PARENT_PATH};
+    my $self = shift;
+    
+    return $self->{PARENT_PATH};
 }
 
 =item C<stat()>
@@ -220,9 +221,9 @@
 
 sub stat
 {
-       my $self = shift;
-       
-       return File::stat::stat($self->path);
+    my $self = shift;
+    
+    return File::stat::stat($self->path);
 }
 
 =item C<delete()>
@@ -233,11 +234,11 @@
 
 sub delete
 {
-       # Use $_[0] so that we can undef the instance.
+    # Use $_[0] so that we can undef the instance.
 
-       delete($instance_for_path{$_[0]->path});
-       
-       undef $_[0];
+    delete($instance_for_path{$_[0]->path});
+    
+    undef $_[0];
 }
 
 =back
@@ -254,4 +255,4 @@
 
 =cut
 
-1;
\ No newline at end of file
+1;

Reply via email to