Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick

Pain with perl's method dispatch

Update: I think it turned out to be my bug, but Perl 5.8.4 and Perl 5.8.7 handled it differently, which still freaks me out.

Is it safe in Perl to cast references up and down the class hierarchy at runtime? It always appeared to work (on perl 5.8.7), but it doesn't seem to work on perl 5.8.4. I see nothing in the changelogs about this.

Look at this:

ok 1 - web servers started
beginning run
ok 2 - perlbal started
ok 3 - status response ok
ok 4 - one done
upgrading Perlbal::ClientHTTPBase=ARRAY(0x8839950) to Perlbal::ClientHTTP=ARRAY(0x8839950).
event_read_put for Perlbal::ClientHTTPBase=ARRAY(0x8839950). content_length_remain = 0
-- what? It was just convered down the tree to a ClientHTTP!
ok 5 - Good PUT
ok 6 - two done
ok 7 - file good via disk
crash log: wrong class for Perlbal::ClientHTTPBase=ARRAY(0x8839950) at blib/lib/Perlbal/ line 543
-- my assertion that the ref is wrong. should be ref $foo eq "Perlbal::ClientHTTP"
crash log: Perlbal::ClientHTTPBase::put_writeout('Perlbal::ClientHTTPBase=ARRAY(0x8839950)') called at blib/lib/Perlbal/ line 2
crash log: Perlbal::ClientHTTP::event_read_put('Perlbal::ClientHTTPBase=ARRAY(0x8839950)') called at blib/lib/Perlbal/ line 80
crash log: Perlbal::ClientHTTP::event_read('Perlbal::ClientHTTPBase=ARRAY(0x8839950)') called at /usr/share/perl5/Danga/ line 629

--- look at ite bounce around between ClientHTTP and ClientHTTPBase. ??
crash log: Danga::Socket::PostEventLoop() called at /usr/share/perl5/Danga/ line 474
crash log: Danga::Socket::EpollEventLoop('Perlbal::Socket') called at blib/lib/ line 999
crash log: eval {...} called at blib/lib/ line 997
crash log: Perlbal::run() called at blib/lib/Perlbal/ line 124
crash log: Perlbal::Test::start_server('\x{a}LOAD vhosts\x{a}CREATE POOL a\x{a}\x{a}CREATE SERVICE ss\x{a} SET ss.listen...') called at t/3
2-selector.t line 56
ending run
So I'm confused. Is perl's method dispatch cache not being cleared?
Tags: perl, tech

  • Ukraine

    Nobody reads my LiveJournal anymore, but thank you to everybody in Russia protesting Putin's insane war against Ukraine. (I know it's risky…

  • Happy Birthday!

    Happy 20th Birthday, LiveJournal! 🐐🎂🎉

  • hi

    Posting from the iPhone app. Maybe I'm unblocked now.

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.