The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#! /usr/bin/perl -w

package Foo;
use base Parse::RecDescent;

sub print_cat {
	print "Found ", @_[1..$#_], "\n";
}

package main;


$parse = new Parse::RecDescent(<<'EOG');
	input	 :	"cat"
				{ $thisparser->print_cat($item[1]); }
		 |	"dog"
				{ $thisparser->print_cat($item[1]); }
EOG

$parse = bless $parse, "Foo";

$parse->input("cat");
$parse->input("doggone");