Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mason::compilation(3pm) [debian man page]

Mason::Compilation(3pm) 				User Contributed Perl Documentation				   Mason::Compilation(3pm)

NAME
Mason::Compilation - Performs compilation of a single component DESCRIPTION
A new "Mason::Compilation" object is created by Mason::Interp to compile each component. This class has no public API at this time. MODIFIABLE METHODS
These methods are not intended to be called externally, but may be useful to modify with method modifiers in plugins and subclasses. Their APIs will be kept as stable as possible. bad_attribute_names () A list of attribute names that should not be used because they are reserved for built-in attributes or methods: "args", "m", "cmeta", "render", "main", etc. bad_method_names () A list of method names that should not be used because they are reserved for built-in attributes: "args", "m", "cmeta", etc. Not as extensive as bad_attribute_names above because methods like "render" and "main" can be overridden but make no sense as attributes. compile () The top-level method called to compile the component. Returns the generated component class. named_block_types () An arrayref of valid named block types: "after", "filter", "method", etc. Add to this list if you want to create your own named blocks (i.e. blocks that take a name argument). output_class_footer () Perl code to be added at the bottom of the class. Empty by default. output_class_header () Perl code to be added at the top of the class, just after initialization of Moose, $m and other required pieces. Empty by default. # Add to the top of every component class: # use Foo; # use Bar qw(baz); # override 'output_class_header' => sub { return join(" ", super(), 'use Foo;', 'use Bar qw(baz);'); }; process_perl_code ($coderef) This method is called on each distinct piece of Perl code in the component. $coderef is a reference to a string containing the code; the method can modify the code as desired. See Mason::Plugin::DollarDot for a sample usage. unnamed_block_types () An arrayref of valid unnamed block types: "args", "class", "init", etc. Add to this list if you want to create your own unnamed blocks. valid_flags () An arrayref of valid flags: contains only "extends" at time of writing. Add to this list if you want to create your own flags. SEE ALSO
Mason AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-02 Mason::Compilation(3pm)

Check Out this Related Man Page

Poet::Manual::Subclassing(3pm)				User Contributed Perl Documentation			    Poet::Manual::Subclassing(3pm)

NAME
Poet::Manual::Subclassing - Customizing Poet with subclasses DESCRIPTION
You can subclass the following Poet classes for your application: Poet::Cache Poet::Conf Poet::Log Poet::Mason Poet::Import and arrange things so that Poet always uses your subclass instead of its default class. Place Poet subclasses under "lib/MyApp/Class.pm" in your environment, where "MyApp" is your app name and "Class" is the class you are subclassing minus the "Poet" prefix. A few of these subclasses are generated for you by "poet new". For example, to subclass "Poet::Cache": package MyApp::Cache; use Poet::Moose; extends 'Poet::Cache'; # put your modifications here 1; (Note: Poet::Moose is Moose plus a few Poet standards. You could also use plain "Moose" here.) Poet will automatically detect, load and use any such subclasses. Internally it uses the app_class environment method whenever it needs a classname, e.g. # Do something with MyApp::Cache or Poet::Cache $poet->app_class('Cache')->... Subclassing Mason As long as you have even a bare-bones "Poet::Mason" subclass, e.g. package MyApp::Mason; use Poet::Moose; extends 'Poet::Mason'; 1; then your Mason subclasses will be autodetected as well, e.g. package MyApp::Mason::Interp; use Moose; extends 'Mason::Interp'; # put your modifications here 1; "poet new" will create the bare-bones subclass for you; it is otherwise harmless. See Mason::Manual::Subclasses for more information. EXAMPLES
Use INI instead of YAML for config files package MyApp::Conf; use Config::INI; use Moose; extends 'Poet::Conf'; override 'read_conf_file' => sub { my ($self, $file) = @_; return Config::INI::Reader->read_file($file); }; Perform tasks before and after each Mason request package MyApp::Mason::Request; use Moose; extends 'Mason::Request'; override 'run' => sub { my $self = shift; # Perform tasks before request my $result = super(); # Perform tasks after request return $result; }; Add Perl code to the top of every compiled component package MyApp::Mason::Compilation; use Moose; extends 'Mason::Compilation'; override 'output_class_header' => sub { return join(" ", super(), 'use Foo;', 'use Bar qw(baz);'); }; Use Log::Dispatch instead of Log4perl for logging package MyApp::Log; use Log::Any::Adapter; use Log::Dispatch; use Moose; extends 'Poet::Log'; override 'initialize_logging' => sub { my $log = Log::Dispatch->new( ... ); Log::Any::Adapter->set('Dispatch', dispatcher => $log); }; Add your own $dbh quick var package MyApp::Import use DBI; use Poet::Moose; extends 'Poet::Import'; method provide_dbh ($caller, $poet) { $dbh = DBI->connect(...); } SEE ALSO
Poet AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-05 Poet::Manual::Subclassing(3pm)
Man Page