Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I thought that if we got away from using the refaddr, we would solve the problem. Won't the following methodology work? Here is my attempt to create an alternate ID. I don't want to post the whole program inline; here are the changes.
11c11,15 < *ID = \&Scalar::Util::refaddr; --- > sub ID ($) { > my ($self) = @_; > > return ref($self) ? $$self : ''; > } 28c32 < *{ $caller . '::ident' } = \&Scalar::Util::refaddr; --- > *{ $caller . '::ident' } = \&Class::Std::ID; 360a365,366 > my $count = 0; > 370a377 > $$new_obj = $count++; 512c519,523 < *ID = \&Scalar::Util::refaddr; --- > sub ID ($) { > my ($self) = @_; > > return ref($self) ? $$self : ''; > } 519a531 > $$new_obj = $count++;
We won't care if the address of the anonymous hash changes; that is not the key. We have an alternate key that stays in tact. This is my first stab at it. When I made tried this on my Mac, I barfed on the coercions test.
% make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/00.load.........# Testing Class::Std v0.0.4 t/00.load.........ok + t/access..........ok + t/automethod......ok + t/coercions.......Deep recursion on anonymous subroutine at /Users/esh +arris/.cpan/build/Class-Std-0.0.4/blib/lib/Class/Std.pm line 14. Deep recursion on subroutine "Class::Std::ID" at (eval 26) line 3. t/coercions.......dubious + Test returned status 0 (wstat 11, 0xb) t/cumulative......ok + t/dump............ok + t/pod-coverage....skipped all skipped: Test::Pod::Coverage 1.04 required for testing POD + coverage t/pod.............skipped all skipped: Test::Pod 1.14 required for testing POD t/simple..........ok + Failed Test Stat Wstat Total Fail Failed List of Failed ---------------------------------------------------------------------- +--------- t/coercions.t 0 11 ?? ?? % ?? 2 tests skipped. Failed 1/9 test scripts, 88.89% okay. 0/152 subtests failed, 100.00% o +kay. make: *** [test_dynamic] Error 2

In reply to Re^4: Threads and fork and CLONE, oh my! by esharris
in thread Threads and fork and CLONE, oh my! by xdg

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-04-25 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found