| makepp documentation | Contained in the makepp distribution. |
ActionParser::Specific - Makepp scanner class for a specified command scanner
use ActionParser::Specific;
my $scanner=ActionParser::Specific->new("CommandParser::Vcs");
ActionParser::Specific is a class of type ActionParser that always
chooses the specified command parser.
my $rp = ActionParser::Specific->new($command_parser_class_name);
Returns a new ActionParser object that always uses a default-constructed object of class $command_parser_class_name as its command parser.
my $cp = $rp->find_command_parser($command, $rule, $dir, \$found);
Construct the predefined CommandParser class object with $rule and $dir.
| makepp documentation | Contained in the makepp distribution. |
use strict; package ActionParser::Specific; use ActionParser; our @ISA = qw/ActionParser/;
sub new { my ($self, $cp_class)=@_; my $class=ref($self)||$self; $cp_class = "CommandParser::$cp_class" unless $cp_class =~ /^CommandParser::/; eval "require $cp_class"; unless($cp_class->can("new")) { warn $@ if $@; die "Unable to find `new' method via class $cp_class\n"; } bless { COMMAND_PARSER_CLASS => $cp_class }, $class; }
sub find_command_parser { ${$_[4]}++; $_[0]->{COMMAND_PARSER_CLASS}->new(@_[2..3]); # skip command text $_[0] } 1;