Re: Classes as modules?

2006-01-12 Thread Lyle Kopnicky
Foo Ji-Haw wrote: Well, the two files in question are not huge. They each have one class. What's the difference between require-ing them later, and use-ing them later? Why is it more difficult to require them? I don't think it's more difficult to call a require(), use() helps in the

Re: Classes as modules?

2006-01-12 Thread Lyle Kopnicky
Foo Ji-Haw wrote: I don't think it's more difficult to call a require(), use() helps in the bigger scheme of things, like determining the scope of your variables and methods, and making sure you package similar functions together. use() also makes sure at compile time that the libraries are

Re: Classes as modules?

2006-01-12 Thread Chris Wagner
At 11:13 AM 1/12/2006 -0800, Lyle Kopnicky wrote: * use() requires that you use a bareword for the module name (might be nice, if I could solve the @INC path problem) I don't know why u think u have a @INC problem. There's lots of ways to do it. use lib path, push @INC, path, perl

Re: Classes as modules?

2006-01-12 Thread Lyle Kopnicky
Chris Wagner wrote: At 11:13 AM 1/12/2006 -0800, Lyle Kopnicky wrote: * use() requires that you use a bareword for the module name (might be nice, if I could solve the @INC path problem) I don't know why u think u have a @INC problem. There's lots of ways to do it. use lib

Re: Classes as modules?

2006-01-12 Thread Lyle Kopnicky
Chris Wagner wrote: At 01:44 PM 1/12/2006 -0800, Lyle Kopnicky wrote: If I put a relative path in @INC, I guess it would be relative to the current directory. Which is whatever the directory the console is in when it runs the script. Not very useful for finding modules. Instead I want

Re: Classes as modules?

2006-01-12 Thread Lyle Kopnicky
Dirk Bremer wrote: I have all of the modules that I have created either in the same single directory that contains the scripts or in sub-directories of the script directory. I use this in every script: use FindBin qw($Bin); use lib $Bin; I never have any problems no matter where the script is

Re: Classes as modules?

2006-01-11 Thread Chris Wagner
At 11:56 AM 1/10/2006 -0800, Lyle Kopnicky wrote: OK, looking at 'perlnewmod', it has a section called 'What should I make into a module?', which states: You should make a module out of any code that you think is going to be useful to others. Here's my philosophy on modules. If ur using

Re: Classes as modules?

2006-01-11 Thread Lyle Kopnicky
DZ-Jay wrote: On Jan 7, 2006, at 03:49, Lyle Kopnicky wrote: Doesn't that just let me import the methods of the class into my own namespace, from another file? That would be weird - they're supposed to be methods of a class. They belong in the class' namespace, not mine. They won't be

Re: Classes as modules?

2006-01-11 Thread Chris Wagner
At 03:19 PM 1/11/2006 -0800, Lyle Kopnicky wrote: Well, that's what I have right now. Two packages, each in their own file. Each one is a class. But they are '.pl' files. Is there any reason to make them '.pm' files? I don't see why I would want to export anything from them. Then I guess

Re: Classes as modules?

2006-01-11 Thread Foo Ji-Haw
Well, the two files in question are not huge. They each have one class. What's the difference between require-ing them later, and use-ing them later? Why is it more difficult to require them? I don't think it's more difficult to call a require(), use() helps in the bigger scheme of

Re: Classes as modules?

2006-01-10 Thread Lyle Kopnicky
$Bill Luebkert wrote: Lyle Kopnicky wrote: Thanks for your reply. But supposing I'm going to keep each class in it's own file, what is the advantage of making that file a module? Have you read the man pages on modules ? perlmod Perl modules:

Re: Classes as modules?

2006-01-10 Thread $Bill Luebkert
Lyle Kopnicky wrote: OK, looking at 'perlnewmod', it has a section called 'What should I make into a module?', which states: You should make a module out of any code that you think is going to be useful to others. That settles my question. The classes I have written for this project

Re: Classes as modules?

2006-01-10 Thread Foo Ji-Haw
OK, looking at 'perlnewmod', it has a section called 'What should I make into a module?', which states: You should make a module out of any code that you think is going to be useful to others. That settles my question. The classes I have written for this project are specific to this

RE: Classes as modules?

2006-01-10 Thread Suresh Govindachar
Studying Damian Conway's Object Oriented Perl http://www.manning.com/books/conway will help in getting an understanding of Object Oriented Programming in general (as an abstract concept and as it is implemented in a few languages) and as it applies to programming in perl.

Re: Classes as modules?

2006-01-09 Thread DZ-Jay
On Jan 7, 2006, at 03:49, Lyle Kopnicky wrote: Doesn't that just let me import the methods of the class into my own namespace, from another file? That would be weird - they're supposed to be methods of a class. They belong in the class' namespace, not mine. They won't be imported unless

Re: Classes as modules?

2006-01-08 Thread Foo Ji-Haw
Thanks for your reply. But supposing I'm going to keep each class in it's own file, what is the advantage of making that file a module? Doesn't that just let me import the methods of the class into my own namespace, from another file? That would be weird - they're supposed to be methods

Re: Classes as modules?

2006-01-07 Thread Lyle Kopnicky
$Bill Luebkert wrote: Lyle Kopnicky wrote: Hi folks, This is just a straight-up Perl question: Is there any advantage to turning a class into a module? Or does it make more sense to put multiple classes in one file? Thanks. It's easier to keep track of them if they have their

Re: Classes as modules?

2006-01-07 Thread $Bill Luebkert
Lyle Kopnicky wrote: Thanks for your reply. But supposing I'm going to keep each class in it's own file, what is the advantage of making that file a module? Have you read the man pages on modules ? perlmod Perl modules: how they work perlmodlib Perl

Re: Classes as modules?

2006-01-06 Thread $Bill Luebkert
Lyle Kopnicky wrote: Hi folks, This is just a straight-up Perl question: Is there any advantage to turning a class into a module? Or does it make more sense to put multiple classes in one file? Thanks. It's easier to keep track of them if they have their own modules. You can obviously