Changeset 219

Show
Ignore:
Timestamp:
04/06/07 20:39:30 (2 years ago)
Author:
ingy
Message:
 r3767@dhcp199:  ingy | 2007-04-07 12:36:08 +0900
 Fixes to IO::All
 
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/core/IO-All/Changes

    r45 r219  
     1--- 
     2version: 0.37 
     3date:    Fri Apr  6 18:04:27 JST 2007 
     4changes: 
     5- make catdir work with current dir in addition to other args. 
     6- make catfile work with current dir in addition to other args. 
     7--- 
    18version: 0.36 
    29date:    Mon Oct 16 14:48:58 PDT 2006 
  • trunk/src/core/IO-All/META.yml

    r45 r219  
    55generated_by: hand 
    66distribution_type: module 
    7 version: 0.36 
     7version: 0.37 
    88name: IO-All 
    99author: Ingy döt Net <ingy@cpan.org> 
  • trunk/src/core/IO-All/lib/IO/All.pm

    r45 r219  
    77sub Carp::carp; 
    88use IO::All::Base -base; 
    9 our $VERSION = '0.36'; 
     9our $VERSION = '0.37'; 
    1010use File::Spec(); 
    1111use Symbol(); 
     
    413413#=============================================================================== 
    414414sub canonpath {my $self = shift; File::Spec->canonpath($self->pathname) }  
    415 sub catdir {my $self = shift; $self->new->dir(File::Spec->catdir(@_)) }  
    416 sub catfile {my $self = shift; $self->new->file(File::Spec->catfile(@_)) }  
     415sub catdir { 
     416    my $self = shift; 
     417    my @args = grep defined, $self->name, @_; 
     418    io->dir(File::Spec->catdir(@args)); 
     419}  
     420sub catfile { 
     421    my $self = shift; 
     422    my @args = grep defined, $self->name, @_; 
     423    io->file(File::Spec->catfile(@args)); 
     424}  
    417425sub join {my $self = shift; $self->catfile(@_) }  
    418426sub curdir {my $self = shift; $self->new->dir(File::Spec->curdir) }  
  • trunk/src/core/IO-All/t/file_spec.t

    r45 r219  
    22use strict; 
    33use warnings; 
    4 use Test::More tests => 22
     4use Test::More tests => 28
    55use IO::All; 
    66use IO_All_Test; 
     
    3535is(io('/foo/bar/baz')->abs2rel('/foo'), f 'bar/baz'); 
    3636is(io('foo/bar/baz')->rel2abs('/moo'), f '/moo/foo/bar/baz'); 
     37 
     38is(io->dir('doo/foo')->catdir('goo', 'hoo'), f 'doo/foo/goo/hoo'); 
     39is(io->dir->catdir('goo', 'hoo'), f 'goo/hoo'); 
     40is(io->catdir('goo', 'hoo'), f 'goo/hoo'); 
     41 
     42is(io->file('doo/foo')->catfile('goo', 'hoo'), f 'doo/foo/goo/hoo'); 
     43is(io->file->catfile('goo', 'hoo'), f 'goo/hoo'); 
     44is(io->catfile('goo', 'hoo'), f 'goo/hoo');