Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My first module

Status
Not open for further replies.

rvBasic

Programmer
Oct 22, 2000
414
BE
Having written some general subs, I thought it useful to put them in a module myUtil.pm. It was structured as follows:
Code:
use strict;
sub AAA {xxx;}
sub BBB {yyy;}
The module was put in the same library as the following main (rvBasic.pl)program:
Code:
use qw(AAA);
$zz=&AAA($a1,$a2);
The program aborted with the following messages
myUtil.pm did not return a true value at rvBasic.pl line 2
BEGIN failed compilation - aborted rvBasic.pl at line 2

After some trial and error, I modified the module as follows:
Code:
use strict;
return(1);
sub AAA {xxx;}
sub BBB {yyy;}
And everything worked smooth.

So, I should be happy. But I don't really understand why it works now. I read in the documentation the use is used at "compile" time, but obviously it does some execution as it asked for a true value?

Can somebody clarify this?


_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top