Note that XM::Parser->new() only sets up handlers. It does not parse anything. That means that probably "dumper 1" should never give you any useful information.

I also note that you appear to be using references to methods as the handlers, while XML::Parser expects non-method subroutines. The only reason this might sortof work (as in - not break immediately) is that you declare $self in the same scope as the methods. I might be mislead here, since I can't read the code you left out.

In any case, the real problem is somewhere in the lines you left out.

as a side note: using new ClassName has it's problems. If you want to be sure you call a class method instead of any random new() subroutine that happens to be in scope, use ClassName->new() instead.

update: are you using use warnings or the -w switch? that should warn on sharing lexial context in named subroutines. In other words, you will have the $self from the first call to new() in the later calls. This is a known problem in perl, but it's also debatable what the correct solution should be. (since named subroutines are global objects). See this part of the mod-perl docs for more info


In reply to Re: Objects, callbacks and XML::Parser by Joost
in thread Objects, callbacks and XML::Parser by ixl

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.