neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

Using Mason I call a subcomponent:

<& nostep.pl &>

I've seen examples of <& nostep.pl, $length => "2" &> but in my test that doesn't seem to work well when $length is numeric. How would one pass something like <& nostep.pl, my $length = 2 &> ?

Also, which parts of my code should contain use strict;?

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Mason and components
by aturner (Initiate) on Mar 24, 2003 at 17:05 UTC
    I think what you're looking for is:
    <& nostep.pl, length => 2 &>
    Ie: don't put a '$' infront of varnames and you need to use the '=>' operator rather then the '=' operator to seperate varnames and values.

    -Aaron

Re: Mason and components
by valdez (Monsignor) on Mar 24, 2003 at 18:48 UTC

    According to the Mason Book:

    By default, all components will be run under Perl's strict pragma, which forces you to declare any Perl variables you use in your components.

    So, unless you set use_strict => 0, this check is already in place and can be disabled locally using no strict.

    HTH, Valerio

Re: Mason and components
by Tomte (Priest) on Mar 24, 2003 at 17:00 UTC

    Though one monk or the other definitly will help you, I suggest joining, reading, posting this question to the very helpfull mason-users mailing-list:

    mason-users@lists.sourceforge.net

    The usual sf.net list-procedures apply, if you're unfamiliar with these, go to this page where you can become a member via a simple web-formular.

    kind regards,
    tomte