For some reason XML::Parser::Lite doesn't like the regexp you are using (the parser is regexp-based, and there is some really scary regexp stuff going on inside).

This works on my 5.8.1 (which otherwise gives me yet a different error, a SegFault):

my $name= join '/', split /::/, $Names{$pkg};

If it doesn't work for you, try something else, like having the file name built outside of the parser loop:

#!/usr/bin/perl -w use strict; use XML::Parser::Lite; my $doc = "<foo/>\n"; print "'$doc'\n"; # you could of course build the file name from the package name here # instead of just having it hard-coded my %Names = ( foo => { file => 'Foo/Bar.pm', package => 'Foo::Bar'}, ); my @stack; my $parser = XML::Parser::Lite->new( Handlers => { Start => sub { shift; print "Start: @_\n"; my $pkg = shift; eval { require $Names{$pkg}->{file}; }; if ($@) { die "Cannot require ' $Names{$pkg}->{f +ile}' ($pkg)\n"; } my $x = $Names{$pkg}->{package}->new(@_); push @stack, $x; }, End => sub { shift; print "End: @_\n"; pop @stack if @stack; }, }, ); $parser->parse($doc); print "Finally done\n";

In reply to Re: XML::Parser::Lite coredumping by mirod
in thread XML::Parser::Lite coredumping by dragonchild

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.