GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEXT::MICROMASON::ALLOWGLOBALS (3)

.ds Aq ’

NAME

Text::MicroMason::AllowGlobals - Share package vars between templates

CONTENTS

SYNOPSIS

Instead of using this class directly, pass its name to be mixed in:



    use Text::MicroMason;
    my $mason = Text::MicroMason->new( -AllowGlobals );



Share package variables:



    $mason->set_globals( $name => Bob );



Use the standard compile and execute methods to parse and evalute templates:



  print $mason->compile( text=>$template )->();
  print $mason->execute( text=>$template );



Then, in a template, you can refer to those globals:



    Welcome, <% $name %>!



DESCRIPTION

    Public Methods

set_globals() Accepts a list of pairs of global variable names and corresponding values.

Adds each variable name to the allowed list and sets it to the initial value.

allow_globals() Gets or sets the variables names to be allowed.

If called with arguments, adds them to the list.

Returns the variables to be allowed as a list, or as a space-separated string in scalar context.

    Supported Attributes

allow_globals Optional array or space-separated string of global variable names to be allowed.

    Private Methods

assemble() Adds the allow_globals_statement to each token stream before assembling it.
allow_globals_statement() This method prepends the use vars statement needed for the template subroutines to compile.

SEE ALSO

For an overview of this templating framework, see Text::MicroMason.

This is a mixin class intended for use with Text::MicroMason::HTMLMason.

For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MICROMASON::ALLOWGLOBALS (3) 2007-01-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.