Budgie::Interpolator - a simple templating engine for Parrot.


        .sub _main @MAIN
                .local pmc cons  # the constructor sub
                .local pmc tmpl  # the template instance                
                load_bytecode 'Budgie.pbc'
                load_bytecode 'Budgie/Interpolator.pbc'
                cons = find_global 'Budgie::Interpolator', 'new_'
                tmpl = cons()
                tmpl.for_string("Hello ${a}\n")
                tmpl.set_param("a", "World")

using alternative delimiters

The default syntax interpolates a variable marked up like this

        My name is ${name}

You can change the delimiter for example to

        My name is <%= name %>

or even

        My name is <tmpl_var name >

with the alternative constructor

        cons = find_global 'Budgie::Interpolator', 'new_with_delimiters'
        tmpl = cons( '<%=', '%>' )


Thilo Planz


Budgie is Copyright (c) 2005 Thilo Planz. All Rights Reserved.

This code is distributed under the GNU General Public License found in the file LICENSE

This program 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 GNU General Public License for more details.