ngoc <> wrote:
> Hi
> Now I have a perl program with 5000 lines of code in a file. I want to
> divide it to many files, so that it is easy to maintain.
Why does that make it easier to maintain? I *hate* maintaining code in
which I have to keep hunting through a bunch of other files to find the
particular sub definition I need, just because someone wanted to keep their
line count under a certain number. Unless there is (or will be) some
inherent modularity, or other programs need to use the same set of code, I
wouldn't bother dividing it into several files just to meet some arbitrary
line count.
> But I face a
> lot of trouble with many subroutines using class variables.
Do you mean file-scoped variables? If so, then cleaning that up would
probably improve your code regardless if whether you split it up or leave
it all in one file.
> I do not
> want to use our. I remember 'NOT SURE' that two programs running with
> two our variables with same name, it modifies each other values.
Two separate programs (running in separare perl interpretors) don't
interact with each other, unless they are specifically coded to do that.
It is more a problem of reentrance or repeatability within one program.
(Are you using mod_perl?) But you generally shouldn't use package
variables anyway. If you were going to do that, just leave it all in file
instead.
>
> Is a 5000 lines of code in one file perl program normal in perl's world?
I can't speak for the rest of the perl world, but it is pretty unusual for
me. I don't think it has ever taken me more than 1500 lines (not counting
__DATA__ sections or the code of used of CPAN modules) to accomplish any
single task I wanted to accomplish in Perl.
> Or I have to change it as soon as possible if I do not want my current
> and future colleagues will complain me as unexperience?
If you colleagues are competent, you should be asking them. They probably
know far more about the specific situation (the likelihood of needing some
of those routines from other code, the level of maintenance likely to be
needed, the culter of the organization, etc.) than we do. And if they
aren't competent, then there is no telling what they will choose to
complain about.
Xho
--
--------------------
http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB