After testing a few serialization options including Data::Dumper, Storable and YAML. (Found an interesting article on these and others here:
http://www252.pair.com/comdog/mastering_perl/Chapters/14.persistence.html)
I came to the conclusion that the complexity of storing my connection data is not worth the effort ( ran into segmentation faults and other oddities).
In the end I decided to implement Elisheva's suggestion and run the test cases in a unified form as a single file. That way caching an object became a breeze. Also, I found a way to keep the files separated by making them Perl modules with a single exportable sub that run all tests in that module. A separated file "uses" all the modules and keeps the "memory" of previous tests, and I pass that file to TAP::Parser. Something like this:
# Main Program ... my $test_file = "MetaTester.pm"; my %args = ( source => $test_file ); my $parser = TAP::Parser->new( \%args ); while ( my $result = $parser->next ) { ... # Then in MetaTester.pm use Test1.pm; use Test2.pm; Test1::run_tests(); Test2::run_tests();
Thanks again to all that responded.

In reply to Re^3: How to share an object between test cases using Test::Harness by psantann
in thread How to share an object between test cases using Test::Harness by psantann

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.