Text::Snippet::TabStop::Parser - Parses an individual tab stop


Text-Snippet documentation Contained in the Text-Snippet distribution.

Index


Code Index:

NAME

Top

Text::Snippet::TabStop::Parser - Parses an individual tab stop

VERSION

Top

version 0.04

CLASS METHODS

Top

parse

AUTHOR

Top

  Brian Phillips <bphillips@cpan.org>

COPYRIGHT AND LICENSE

Top


Text-Snippet documentation Contained in the Text-Snippet distribution.

package Text::Snippet::TabStop::Parser;
BEGIN {
  $Text::Snippet::TabStop::Parser::VERSION = '0.04';
}

# ABSTRACT: Parses an individual tab stop

use strict;
use warnings;
use List::Util qw(first);
use Carp qw(croak);

my @types;
BEGIN {
	@types = map { "Text::Snippet::TabStop::$_" } qw( Basic WithDefault WithTransformer );
	for(@types){
		eval "require $_";
		croak $@ if $@;
	}
}


sub parse {
    my $class = shift;
    my $src = shift;
	foreach my $t(@types){
		my $p = $t->parse($src);
		return $p if defined $p;
	}
	croak "unable to find parser for tab stop source: [$src]";
}

1;

__END__