App-PRT

 view release on metacpan or  search on metacpan

lib/App/PRT/Command/ListFiles.pm  view on Meta::CPAN

package App::PRT::Command::ListFiles;
# Created by CXW based on App::PRT::Command::RenameClass

use strict;
use warnings;
use Path::Class;

sub new {
    my ($class) = @_;
    bless {eol => "\n"}, $class;
}

# parse arguments from CLI.  The only argument is `-0`, to output
# filenames separated by "\0" instead of "\n".
# arguments:
#   @arguments
# returns:
#   @rest_arguments
sub parse_arguments {
    my ($self, @arguments) = @_;

    if(@arguments && $arguments[0] eq '-0') {
        shift @arguments;
        $self->{eol} = "\0";
    }

    @arguments;
}

# Output the filename.
# arguments:
#   $file: filename
sub execute {
    my ($self, $file) = @_;
    print file($file), $self->{eol};
        # Extra file() call to canonicalize
}

1;



( run in 1.774 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )