Monday, November 19, 2001, 4:41:21 PM, Bruce Ferrell wrote:

BF> #begin example 2
BF> use packagename();
BF> sub1();
BF> sub2();
BF> #end example 2

BF> No can someone explain to me what, if anything is incorrect about the
BF> second example?  What I'm looking for is how sub-routines are used from
BF> a used module without the module name prefix.

you want to look at the Exporter module. there's full details here [1],
but what it basically comes down to is:

  package packagename;
  require Exporter;
  @ISA = qw(Exporter);

  @EXPORT_OK = qw(sub1 sub2);

  sub sub1 {
     perl code here
  }

  sub sub2 {
     perl code here
  }

  1;
  
and then in your script:

  use packagename qw(sub1 sub2);

  sub1();
  sub2();


[1] http://www.perldoc.com/perl5.6.1/lib/Exporter.html

-- 
Best regards,
 Daniel


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to