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

Hi there
I'm trying to familise myself with some perl modules at the moment and although I can call a sub routine from a particular module (and it works).
example
use ownmodule; my $result = ownmodule::GetResult($query);
If by calling that sub routine in the ownmodule.pm I call another subroutine in the same module. I get an error.
Could anyone tell me why? All advice much appreciated.

Replies are listed 'Best First'.
Re: problems with modules
by blazar (Canon) on May 02, 2006 at 10:49 UTC

    Without seeing the code in ownmodule.pm and the error message, it's hard to tell. Incidentally all lowecase modules are reserved for pragmas, so even for an experiment you should use e.g. Ownmodule.

    $ cat Ownmodule.pm # -*- Perl -*- use strict; use warnings; package Ownmodule; use base 'Exporter'; our @EXPORT=qw/first/; sub first { print "<first> called\n"; second(); } sub second { print "<second> called\n"; } 1; __END__ $ perl -MOwnmodule -e first <first> called <second> called
Re: problems with modules
by cdarke (Prior) on May 02, 2006 at 10:58 UTC
    Please show your code and especially the error message you are getting.