App-Pod

 view release on metacpan or  search on metacpan

t/cpan/Mojo2/File.pm  view on Meta::CPAN

        }
        $all{$File::Find::name}++ if $options->{dir} || !-d $File::Find::name;
    };
    find { wanted => $wanted, no_chdir => 1 }, $$self if -d $$self;
    delete $all{$$self};

    return Mojo::Collection->new( map { $self->new( canonpath $_) }
          sort keys %all );
}

sub lstat { File::stat::lstat( ${ shift() } ) }

sub make_path {
    my $self = shift;
    File::Path::make_path $$self, @_;
    return $self;
}

sub move_to {
    my ( $self, $to ) = @_;
    move( $$self, $to ) or croak qq{Can't move file "$$self" to "$to": $!};

t/cpan/Mojo2/File.pm  view on Meta::CPAN

}

sub spurt {
    my ( $self, $content ) = ( shift, join '', @_ );
    CORE::open my $file, '>', $$self or croak qq{Can't open file "$$self": $!};
    ( $file->syswrite( $content ) // -1 ) == length $content
      or croak qq{Can't write to file "$$self": $!};
    return $self;
}

sub stat { File::stat::stat( ${ shift() } ) }

sub tap { shift->Mojo::Base::tap( @_ ) }

sub tempdir { __PACKAGE__->new( File::Temp->newdir( @_ ) ) }

sub tempfile { __PACKAGE__->new( File::Temp->new( @_ ) ) }

sub to_abs { $_[0]->new( rel2abs ${ $_[0] } ) }

sub to_array { [ splitdir ${ shift() } ] }



( run in 1.019 second using v1.01-cache-2.11-cpan-49f99fa48dc )