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

Hello all,

I am writing some modules (some of my first ones) for RPG (role playing game) systems. I have created a library of RPG and started adding modules under it. I grabed a module template off the net as the basis.

The first module (included below) I created was a basic dice roller and works great on my local system. But when I move it up to my provider it gives the following error message when run from the command line:

Array found where operator expected at RPG/Dice.pm line 11, at end of +line (Do you need to predeclare our?) Operator or semicolon missing before %EXPORT_TAGS at RPG/Dice.pm line +20. Ambiguous use of % resolved as operator % at RPG/Dice.pm line 20. Array found where operator expected at RPG/Dice.pm line 25, at end of +line (Do you need to predeclare our?) syntax error at RPG/Dice.pm line 11, near "our @ISA " syntax error at RPG/Dice.pm line 25, near "our @EXPORT_OK " BEGIN failed--compilation aborted at test.pl line 5.

The version of perl from the provider is 5.005_2. And I'm only calling it from a simple test program:

Lengthy code moved to HTML comments. "View Source" to see the code.

Edit 2001-04-19 by tye

Replies are listed 'Best First'.
Re: Writing Modules - problem
by busunsl (Vicar) on Apr 19, 2001 at 17:24 UTC
    You cannot use our in version 5.005_2, it is available in 5.6
Re: Writing Modules - problem
by davorg (Chancellor) on Apr 19, 2001 at 17:25 UTC

    our was added in Perl 5.6. For earlier versions you can get a similar effect with use vars.

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

Re: Writing Modules - problem
by Asim (Hermit) on Apr 19, 2001 at 17:29 UTC

    our started with Perl 5.6, so it seems that you are using one version to develop, and deploying on a older version. Look at pre-5.6 module documentation for how to create modules w/o using our

    ----Asim, known to some as Woodrow.

Re: Writing Modules - problem
by MrNobo1024 (Hermit) on Apr 19, 2001 at 19:17 UTC
    our declarations are only availiable in perl v5.005_62 and higher. If you're using an older version, you should use the vars pragma instead.