Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Exporting

by cwest (Friar)
on Dec 13, 2000 at 02:37 UTC ( #46339=note: print w/replies, xml ) Need Help??


in reply to Exporting
in thread Module Submission for CPAN

Read the Exporter manpage... here's a simple example:
package Ctweten::Export; use Exporter; our @ISA = qw(Exporter); # we now inherit from Exporter, namely the im +port() method our @EXPORT_OK = qw(this that); # you must ask for these: use Ctweten: +:Export 'this'; our @EXPORT = qw(other); # exporter by default sub this { print "Hello\n" } *that = *other = *this;
In a program, if you want to use this() and other(), you do the following: <code> #!/usr/local/bin/perl -w use strict; $|++; use Ctweten::Export qw(this); other; this; that; # this would die under these circumstances.
--
Casey
   I am a superhero.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46339]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2023-02-06 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (37 votes). Check out past polls.

    Notices?