Skip to content

Instantly share code, notes, and snippets.

@larsen
Created September 2, 2011 07:10
Show Gist options
  • Save larsen/1188085 to your computer and use it in GitHub Desktop.
Save larsen/1188085 to your computer and use it in GitHub Desktop.
# siamo in un contesto in cui nello
# scope c'e` $self
my $sh = sub {
$self->... # $self e` usabile
# il resto come solito
my ($p, $el, %atts) = @_;
$p->setHandlers('Char' => \&spec)
if ($el eq 'special');
...
}
$parser = XML::Parser::Expat->new;
$parser->setHandlers('Start' => $sh );
open(FOO, '<', 'info.xml') or die "Couldn't open";
$parser->parse(*FOO);
close(FOO);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment