App-FatPacker

 view release on metacpan or  search on metacpan

lib/App/FatPacker.pm  view on Meta::CPAN

  my $self = shift;
  my ($args, $options) = @_;

  local *ARGV = [ @{$args} ];
  $self->{option_parser}->getoptions(@$options);

  return [ @ARGV ];
}

sub lines_of {
  map +(chomp,$_)[1], do { local @ARGV = ($_[0]); <> };
}

sub stripspace {
  my ($text) = @_;
  $text =~ /^(\s+)/ && $text =~ s/^$1//mg;
  $text;
}

sub import {
  $_[1] && $_[1] eq '-run_script'

lib/App/FatPacker.pm  view on Meta::CPAN

  $self->collect_files($_, \%files) for @dirs;

  return join "\n", $shebang, $self->fatpack_code(\%files), $script;
}

# This method can be overload in sub classes
# For example to skip POD
sub load_file {
  my ($self, $file) = @_;
  my $content = do {
    local (@ARGV, $/) = ($file);
    <>
  };
  close ARGV;
  return $content;
}

sub collect_dirs {
  my ($self) = @_;
  my $cwd = cwd;
  return grep -d, map rel2abs($_, $cwd), ('lib','fatlib');



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