the documentation for HTML::Mason::Interp->set_globals <http:// masonhq.com/docs/manual/Interp.html#item_set_global> shows the usage:

        set_global ($varname, [values...])

which suggests that the values are optional.

however, the code disagrees:

        sub set_global
        {
            my ($self, $decl, @values) = @_;
param_error "Interp->set_global: expects a variable name and one or more values"
                unless @values;
        [..snip..]

this makes it difficult to assign an empty list to a global array:

        $interp->set_global( '@foo' => @foo );

i have had to resort to:

        undef @HTML::Mason::Commands::foo;
        $interp->set_global( '@foo' => @foo) if @foo;

        undef %HTML::Mason::Commands::foo;
        $interp->set_global( '%bar' => %bar) if keys %bar;

which works but is not ideal. i could probably skip the set_global altogether here, and just

  @HTML::Mason::Commands::foo = @foo;

but i would prefer to stick to the provided interface as much as possible.

either way, either the documentation or the code needs a patch!

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to