Thanks for the tip on creating a simpler iterator. I had just been re-reviewing Damian Conway's old OO Perl book and I had closures and class variables on the brain and so reached for the shiny new hammer I had just learned about.

My new sub is actually spread out over several classes with FileCollector as my base class:

package FileCollector ; sub new { my $class = shift; my $s = bless { _files => {}, _target_repo => '', _selected_file => '', _common_dir => ''}, $class; $s->add_resources(@_); return $s; } sub add_resources { my $s = shift; ... does stuff, basically like an init subroutine ... } package FileParser ; use parent qw ( FileCollector ); sub new { my $class = shift; return $class->SUPER::new(shift); } sub add_resources { my $s = shift; $s->SUPER::add_resources(@_); $s->{_nonparseable_files} = $s->{_nonparseable_files} || []; $s->{_parseable_files} = $s->{_parseable_files} || []; $s->_test_parsability; } package HeaderAnalyzer ; use parent qw ( FileParser ); sub new { my $class = shift; return $class->SUPER::new(shift); } sub add_resources { my $s = shift; $s->SUPER::add_resources(@_); $s->{_bad_header_files} = $s->{_bad_header_files} || []; $s->{_blank_header_files} = $s->{_blank_header_files} || []; $s->{_no_header_files} = $s->{_no_header_files} || []; $s->{_good_header_files} = $s->{_good_header_files} || []; $s->{_unrec_header_files} = $s->{_unrec_header_files} || []; $s->_analyze_headers; } ...MORE PACKAGES THAT BUILD THE CHILD-PARENT CLASS CHAIN FURTHER...

I'm not sure how orthodox this design pattern is with the chained SUPER calls like this but it works really well. I'm not sure if this complexity might be part of my problem. I'm just cutting my teeth on old school OO. Have mostly used Moose and Moo up until now.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to Re^2: How to completely destroy class attributes with Test::Most? by nysus
in thread How to completely destroy class attributes with Test::Most? by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.