in reply to Re: REALLY Private Methods in perl: Is Perl Flexible enough to be made Inflexible?
in thread REALLY Private Methods in perl: Is Perl Flexible enough to be made Inflexible?

Great idea! Care to share your script?

-sam

  • Comment on Re: Re: REALLY Private Methods in perl: Is Perl Flexible enough to be made Inflexible?

Replies are listed 'Best First'.
Re: Re: Re: REALLY Private Methods in perl: Is Perl Flexible enough to be made Inflexible?
by dws (Chancellor) on Sep 23, 2002 at 19:31 UTC
    Care to share your script?

    My ex-employers own the last ones I wrote, but they're pretty simple. Use File::Find to traverse a hierarchy, then ignore file types that aren't interesting (like .doc or .exe), and finally processing files that are. Stripped of extraneous detail, they look something like:

    use File::Find; my $ignore = '(?:\.exe|\.doc)$'; find(\&consider, $root); emit_report(); sub consider { my $path = $File::Find::path; return if $path =~ m/$ignore/o; process($path); }
    Processing consists of slurping the file into memory and running a set of regexs against it, recording which files match which regex. Then sort the hashes and spit out HTML. It's just bookkeeping at this poing. Being a potential memory pig isn't a serious issue for a script that runs once a day at 2am.

      Sure, the basic structure is simple. The good bits are those helpful regexes that spot naughty coding. That's the hard part. Still, probably worth doing. Thanks for the tip.

      -sam