NAME
Exporter::Declare::Recipe - Devel-Declare recipe's for Exporter-Declare
DESCRIPTION
Recipe is a module with a parser that provides hooks to alter behavior in several predictably useful ways. Recipies should subclass this class.
INTERNALS
Recipe objects are blessed arrays, not hashrefs.
ACCESSORS
- name()
-
Name of the function that is magical
- declarator()
-
Usually same as name
- offset()
-
Current position on the line (for internal use)
- at_end()
-
True if we have parsed to the end of the declaration (will be false, '{' or ';')
- parsed_names()
-
Get the array of names that were parsed off the declaration.
mydec a b { ... }
In the above 'a', and 'b' would be the parsed names.
- parsed_specs()
-
if has_specs() returns true than this will be the hashref parsed from:
mydec a ( THIS => 'STUFF' ) { ... }
- proto_string()
-
if has_proto() returns true then this will be the raw string from:
mydec a ( THIS STUFF ) { ... }
BEHAVIOR MODIFIERS
- sub names {()}
-
Each name will be injected into the codeblock when your defining your exported function.
export my_func recipe_with_name_arga { is( $arga, 'my_func' ); } export my_func arg_b recipe_with_name_arga_and_argb { is( $arga, 'my_func' ); is( $argb, 'arg_b' ); }
- sub hook {};
-
Method called after parsing before outputing the expanded code. This is useful if you want to munge anything in the accessors.
- sub type { 'const' }
-
Type of export. See Devel::Declare (sorry)
- sub skip { 0 }
-
Will skip the current declaration and leave it unaltered if this returns true.
- sub has_proto { 0 }
-
Override this to return true if you want to specify a proto (raw string in '()' prior to the codeblock)
Not compatible with has_specs.
- sub has_specs { 0 }
-
Override this to return true if you want to specify a specs hash which will be read in and eval'd, then placed into parsed_proto().
Not compatible with has_proto.
- sub has_code { 0 }
-
Override this to return true if you want the functions defined with your recipe to have codeblocks.
- sub run_at_compile { 0 }
-
Override if you want the method to run in a begin block (not compatible with any other option)
- sub recipe_inject {}
-
Return a list of stringsw to inject into the codeblock (after other injections).
PARSING TOOLS
TODO
AUTHORS
Chad Granum exodist7@gmail.com
COPYRIGHT
Copyright (C) 2010 Chad Granum
Exporter-Declare is free software; Standard perl licence.
Exporter-Declare 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.