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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |