in reply to subroutine calls

The use command, the way you're using it, is the same as the following snippet:

BEGIN { require DIVISION; import DIVISION qw/divideInteger printer/; } # Assuming the subs you're describing are actually imported into # package main's namespace.

The mechanism at work is described in much better detail in perlmod, and use.


Dave

Replies are listed 'Best First'.
Re^2: subroutine calls
by Anonymous Monk on Apr 14, 2006 at 10:05 UTC
    hi monks,
    package DIVISION; require Exporter; @local::ISA=(Exporter); @local::EXPORT=qw(divideInteger printer);
    Can you explain in detail what does the 3rd and 4th lines mean??
    Is that making two subroutines local to the package DIVISION.

      No, that's making two arrays (@ISA and @EXPORT) in the package local. You want

      package DIVISION; require Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( divideInteger printer );

      And to re-read the docs for Exporter.

      Not at all. It makes the package DIVISION an "Exporter", and it actually exports the two subs to the caller's namespace. If you don't use Exporter, you'll have to call the subs this way :
      my $number = DIVISION::divideInterger(5,42); DIVISION::printer();