[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



    Christopher> I like to break up each of my C functions or group of
    Christopher> functions into files.  With Perl I have a hard time
    Christopher> doing this.  I guess I just do not know how.  I could
    Christopher> treat perl like a full OOP approach then every piece
    Christopher> of code must be in a class.

In "Package1.pm":

package Package1;

sub foo { ... }

1;


Then "Package2.pm":

package Package2;

sub bar { ... }
sub baz { ... }

1;


Make sure the directory containing those .pms is in PERL5LIB (or add
an appropriate 'use lib "whereever"' line, or use -I on the command
line) and just 'use Package1;' and call Package1::foo( ... ).  If you
don't want to fully qualify names every time, read perldoc Exporter
(and see perldoc perlmod for more details on writing modules OOP or
no).

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00240" href="msg00240.html">[ale] programming languages</a></strong>
<ul><li><em>From:</em> ryan at jimmyether.com (Ryan Williams)</li></ul></li>
<li><strong><a name="00241" href="msg00241.html">[ale] programming languages</a></strong>
<ul><li><em>From:</em> rsowen at speedfactory.net (Bob Owen)</li></ul></li>
<li><strong><a name="00242" href="msg00242.html">[ale] programming languages</a></strong>
<ul><li><em>From:</em> ryan at jimmyether.com (Ryan Williams)</li></ul></li>
<li><strong><a name="00248" href="msg00248.html">[ale] programming languages</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00276.html">[ale] Perl + Semaphores</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00278.html">[ale] Bogus Email From Earthlink Billing</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00248.html">[ale] programming languages</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00243.html">[ale] programming languages</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00277"><strong>Date</strong></a></li>
<li><a href="threads.html#00277"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>