App-Pod

 view release on metacpan or  search on metacpan

t/01-usage-simple.t  view on Meta::CPAN

        expected_output => [
            q(),
            q(Package: Mojo2::File),
            q(Path:    <PATH>),
            q(),
            q(Mojo::File - File system paths),
            q(),
            q(Methods (32):),
            q( basename    - Return the last level of the path wi ...),
            q( child       - Return a new Mojo::File object relat ...),
            q( chmod       - Change file permissions.),
            q( copy_to     - Copy file with File::Copy and return ...),
            q( curfile     - Construct a new scalar-based Mojo::F ...),
            q( dirname     - Return all but the last level of the ...),
            q( extname     - Return file extension of the path.),
            q( is_abs      - Check if the path is absolute.),
            q( list        - List all files in the directory and  ...),
            q( list_tree   - List all files recursively in the di ...),
            q( lstat       - Return a File::stat object for the s ...),
            q( make_path   - Create the directories if they don't ...),
            q( move_to     - Move file with File::Copy and return ...),

t/01-usage-simple.t  view on Meta::CPAN

            q( EXPORT),
            q( EXPORT_OK),
            q( ISA),
            q( VERSION),
            q( __ANON__),
            q( abs2rel),
            q( basename              - Return the last level of t ...),
            q( canonpath),
            q( catfile),
            q( child                 - Return a new Mojo::File ob ...),
            q( chmod                 - Change file permissions.),
            q( copy),
            q( copy_to               - Copy file with File::Copy  ...),
            q( croak),
            q( curfile               - Construct a new scalar-bas ...),
            q( dirname               - Return all but the last le ...),
            q( extname               - Return file extension of t ...),
            q( file_name_is_absolute),
            q( find),
            q( getcwd),
            q( import),

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

use File::Temp ();
use IO::File   ();
use Mojo::Collection;

our @EXPORT_OK = ( 'curfile', 'path', 'tempdir', 'tempfile' );

sub basename { File::Basename::basename ${ shift() }, @_ }

sub child { $_[0]->new( ${ shift() }, @_ ) }

sub chmod {
    my ( $self, $mode ) = @_;
    chmod $mode, $$self or croak qq{Can't chmod file "$$self": $!};
    return $self;
}

sub copy_to {
    my ( $self, $to ) = @_;
    copy( $$self, $to ) or croak qq{Can't copy file "$$self" to "$to": $!};
    return $self->new( -d $to ? ( $to, File::Basename::basename $self) : $to );
}

sub curfile { __PACKAGE__->new( Cwd::realpath( ( caller )[1] ) ) }

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


=head2 child

  my $child = $path->child('.vimrc');

Return a new L<Mojo::File> object relative to the path.

  # "/home/sri/.vimrc" (on UNIX)
  path('/home')->child('sri', '.vimrc');

=head2 chmod

  $path = $path->chmod(0644);

Change file permissions.

=head2 copy_to

  my $destination = $path->copy_to('/home/sri');
  my $destination = $path->copy_to('/home/sri/.vimrc.backup');

Copy file with L<File::Copy> and return the destination as a L<Mojo::File> object.



( run in 0.546 second using v1.01-cache-2.11-cpan-496ff517765 )