[oak perl] ?? Include.H in PERL??
Stephen Kolupaev
skolupae at sonic.net
Mon Jul 25 13:46:03 PDT 2005
Hi Paul,
> In Perl, what is the equivalent of the C/C++
> #include <zzzz.h>
I'd say the 'use' statement is probably the
most appropriate.
use Xxx;
means go find the file Xxx.pm and load it (i.e. execute it) before executing any
statements in your main program.
> When using the Class::Struct module,
> should all of the Struct-s be placed in a "zzzzh.pm" program?
> Or should the Struct-s be put in the creating program?
I'd start with the Structs in the main program. Check the example in
http://search.cpan.org/~nwclark/perl-5.8.7/lib/Class/Struct.pm,
near the string "had two kittens". If the number of Structs
increases greatly, or they become old hat,
then figure out how to put their definitions into an external modules.
Start small!
> I envisage 4-5-6 programs in this project suite which I am
> doing for my own edification of Perl.
> e.g. Main.pm, File.pm, Table.pm, Data.pm, Catalog.pm, ...
> Should there also be a Structs.pm?
Paul, not knowing what you have in mind,
you might consider leaving out Main.pm, File.pm, Data.pm.
That would keep things simpler in the beginning. I've written
a lot of OO-Perl and read classes written by real experts, and
don't remember seeing a Main.pm, File.pm, or Data.pm.
In my work, "main code" goes in the top level, outermost .pl
file of an application. I often use class IO::File to get
file handles for read and write, but never create a File class per se.
Occasionally I'll write an object which reads and parses a file,
and then answers method calls according to the content of the file.
In such a case, I'll name the class
after what the data in the file means to the application.
Hope this helps,
Steve Kolupaev
More information about the Oakland
mailing list