[ale] programming languages

Fletch fletch at phydeaux.org
Fri Jul 9 08:36:32 EDT 2004


>>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:

    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



More information about the Ale mailing list