NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Friday March 14, 2003
In writing tests for some production code that I am working on, I have found myself wanting to independently test 'internal' object methods without using the object constructor. The reason for this is because of some of the sorting and queuing methods used within the object are quite extensive with much internal black magic, warranting their own test suite.
In order to solve this problem, I incorporated the following into a test script:
# The code braces here are designed to limit
# variable scope for some nasty, internal object
# method testing - Overt your eyes children before
# it takes on its devil form!
my $obj = bless [ undef, 0,  ], 'My::Class';
Where the blessed array reference is the same as that blessed in the class constructor. This alternate constructor subsequently allowed the desired testing of internal methods using the
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.