Path::Extended::Class::File - Path::Extended::Class::File documentation


Path-Extended documentation Contained in the Path-Extended distribution.

Index


Code Index:

NAME

Top

Path::Extended::Class::File

DESCRIPTION

Top

Path::Extended::Class::File behaves pretty much like Path::Class::File and can do some extra things. See appropriate pods for details. =head1 COMPATIBLE METHODS

dir

returns a parent Path::Extended::Class::Dir object of the file.

absolute, relative

change how to stringify internally and return the file object (instead of the path itself).

volume

returns a volume of the path (if any).

INCOMPATIBLE METHODS

Top

cleanup

does nothing but returns the object to chain. Path::Extended::Class should always return a canonical path.

as_foreign

does nothing but returns the object to chain. Path::Extended::Class doesn't support foreign path expressions.

new_foreign

returns a new Path::Extended::Class::File object whatever the type is specified.

SEE ALSO

Top

Path::Extended::Class, Path::Extended::File, Path::Class::File

AUTHOR

Top

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Top


Path-Extended documentation Contained in the Path-Extended distribution.

package Path::Extended::Class::File;

use strict;
use warnings;
use base qw( Path::Extended::File );

sub _initialize {
  my ($self, @args) = @_;

  my $file = File::Spec->catfile( @args );
  $self->{path}      = $self->_unixify( File::Spec->rel2abs($file) );
  $self->{is_dir}    = 0;
  $self->{_compat}   = 1;
  $self->{_absolute} = File::Spec->file_name_is_absolute( $file );

  $self;
}

sub new_foreign {
  my ($class, $type, @args) = @_;
  $class->new(@args);
}

sub absolute {
  my $self = shift;
  $self->{_base} = undef;
  $self;
}

sub relative {
  my $self = shift;
  my $base = @_ % 2 ? shift : undef;
  my %options = @_;
  $self->{_base} = $base || $options{$base} || File::Spec->curdir;
  $self;
}

sub dir        { shift->parent }
sub volume     { shift->parent->volume }
sub cleanup    { shift } # is always clean
sub as_foreign { shift } # does nothing

1;

__END__