Goh, Yong Kwang wrote:
> contemplating FTP upload feature. Hence it has grown from a 100 lines
> script to 700+ lines file. In a way, it has outgrown Perl, which seems
> to be getting less suitable for it. Making it object-oriented seems to
> be the solution to the overly long and complex program.
OO is a good solution, yes. But, in what way does that preclude the use
of Perl?
> But Perl's approach to OO is making the program messy and hard to read
> as well
Some developers choose to make their code messy and hard to read. Others
choose to make it clear and easy to read. Perl leaves that choice up to you.
> using a lot of arcane manipulation of @ISA
Arcane? "our @ISA=qw(SuperClass);" is "arcane"? News to me...
> and shift and unshift for methods' parameters
Unshift for parameters? That's a new one. If you don't like shift(),
don't use it.
my ($self, $foo, $bar) = @_;
> clever but hard-to-read references for class variables.
Why would you need references to use class variables? They're just
ordinary variables scoped to the package with "our".
Or are you speaking of instance variables? If so, I don't agree - how is
"$self->{foo}" difficult to read? Is it the braces? If so, write an
accessor method and use that instead - "$self->foo". Accessors are a
good idea anyway.
If you don't like writing accessor methods by hand, have a look through
CPAN - there are modules to automate the process.
> It's support for OO looks more of clever hack and
> a temporary ugly workaround rather than a consistent, clean and
> elegant syntax for OO. I know this sounds offensive to Perl fans out
> there but just my personal opinion, I may be wrong.
I don't find it offensive, although I do think you're wrong. You're free
to write consistent, clean, and elegant OO in Perl if you want. If
there's something stopping you from doing so, it's not the language.
> syntax is its strength. But for larger program which demands code to
> be easily comprehensible and clean, Perl's flexibility becomes its
> liability.
I disagree. Perl is perfectly capable of parsing clean, comprehensible
code - the question is whether you are capable of writing such code.
> Therefore, I'm contemplating learning a new language, either Python or
> Ruby, which promise cleaner and consistent syntax. So just seeking
> opinion from experienced Perl programmers and developers here on which
> would be a better choice for an existing Perl programmer and program
> and why.
All of 'em. Seriously, why limit yourself? Learn as many langauges as
you can - the more you know, the better equipped you'll be to choose the
right one for any given task.
If you look at learning new languages as an unpleasant chore, perhaps
you should seriously consider whether you've chosen the right
profession. Keeping your skills up to date and learning new languages is
part of the territory. Programming is a *perfect* example of the "Red
Queen Dilemma" - you have to run as hard as you can, just to stay in the
same place.
One last thing - have a look at Bricolage, at <http://bricolage.cc> for
your content management. It's huge - 'wc -l' on .pm files reports over
164000 lines of Perl, and that's not even counting the dozens of CPAN
modules it uses. You're entitled to your opinion that Perl is unsuitable
for large applications, but it's a fact that people are quite
successfully using it for exactly that.
sherm--
--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
Hire me! My resume:
http://www.dot-app.org