problems with modules
Anonymous Monk
created: 2006-05-02 06:38:48
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.
Re: problems with modules
created: 2006-05-02 06:49:02

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 " called\n";
    second();
}

sub second {
    print " called\n";
}

1;


__END__
$ perl -MOwnmodule -e first
 called
 called
Re: problems with modules
created: 2006-05-02 06:58:55
Please show your code and especially the error message you are getting.

perlmonks.org content © perlmonks.org and Anonymous Monk, blazar, cdarke

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03