Public feed #893251

the parser

public text v1 · immutable
Raw Edit
·published 2008-02-06 00:12 UTC
rendered paste body
sub parse_path {
  my $to_parse = shift;
  opendir(HERE,$to_parse) or omen(0,"wasn't able to open $to_parse for parsing",$!);
    omen(1,0,"`$to_parse' opened for parsing");

  my @path = readdir(HERE);
  closedir(HERE) ? omen(1,0,"`$to_parse' read and closed")
                 : omen(1,0,"`$to_parse' read, but was not closed properly",$!);

  my @file;
  foreach my $c_path (@path) {
    # skip that crap
    next if $c_path =~ /(?:\\|\/)?\.{1,2}$/o;

    # check if we're to parse a directory
    if (-d $c_path) {
      omen(1,"attempting to sub-parse `$c_path'");
      push(@path,parse_path($c_path));
    }

    push(@file,"$to_parse\\$c_path");
  }

  return @file;
}