in reply to Re^5: OOP first-timer seeks feedback; likes long walks on the beach.
in thread OOP first-timer seeks feedback; likes long walks on the beach.

use inheritance to create a brand new package, and in that package, you'll name certain methods the names that I expect, and I'll call those as object methods at the appropriate places.

Wow... this is getting too deep; I think I'll go your closure way on Monday:
my @files = ( ... ); my $count; my %data; IterateOver::files({ pre => sub { print "Starting on file $_.\n"; $count = 0; }, loop => sub { if (/^[^#]/ and /^(.*?)\s*=\s*(.*?)\s*(?:#.*)$/) { $data{$1} = $2; ++$count; } }, post => sub { print "Found $count keys in $_.\n"; print "Total unique keys so far: ", scalar keys %data, "\n"; }, @files );
  • Comment on Re^6: OOP first-timer seeks feedback; likes long walks on the beach.
  • Download Code