Scroll to navigation

Devel::Declare::Interface(3pm) User Contributed Perl Documentation Devel::Declare::Interface(3pm)
 

NAME

Devel::Declare::Interface - Interface to Devel-Declare parsers.

DESCRIPTION

A higher level interface to Devel-Declare. This is the package you will interact with the most when using Devel::Declare::Parser.

SYNOPSIS

    package My::Keyword::Method;
    use strict;
    use warnings;
    use Devel::Declare::Parser;
    # Look at Exporter-Declare to have most of this done for you.
    sub import {
        my $class = shift;
        my $destination = caller;
        enhance( $destination, "make_method", "method" );
        no strict 'refs';
        *{ $destination . '::make_method' } = \&my_keyword;
    }
    sub make_method {
        my ( $name, $code ) = @_;
        my $dest = caller;
        no strict 'refs';
        *{ $destination . '::' . $name } = $code;
    }
    1;

API

The following functions are all exported by default.
register_parser( $name )
register_parser( $name, $class )
Register a parser under a short name. If $class is not provided caller will be used.
get_parser( $name );
Get the parser class by short name.
enhance( $dest_class, $name, $parser );
enhance( $dest_class, $name, $parser, $type );
Make $name a keyword in $dest_class that uses $parser. $parser can be a short name or class name. $type defaults to 'const'.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum
Devel-Declare-Interface is free software; Standard perl licence.
Devel-Declare-Parser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
2012-12-16 perl v5.14.2