in reply to Can perl be anything like Java?

Has anyone sucessfully walked accross the line of midsize (tens of thousands of lines of code) application into the domain of huge business to business corporation while keeping perl's flexibility intact?
well... i'm presently up to around 30,000 lines of perl for a bioinformatics website i am working on. as is my fashion, it is heavily object-oriented and this has paid off signficantly in managing the way the project has grown in response to my personal whims and user requests.

while i do not pretend to be any kind of 133t perl haXor, i would say that the most difficult/frustrating thing about perl and perl OO is the lack of strong typing and possibly the lack of a full-featured, typed exception system, such as in java. it is simply too onerous to write code to catch every bug and/or foreseeable misuse of a given method or object -- especially when large and complex objects are extending and using other objects. i'm not saying it's impossible by any means -- just much more difficult than java because of the strong typing plus the compiler.

call it heresy if you will, but i sure wish perl had strong typing (and method prototypes)... loaded via a compile-time pragma... without adversely affecting execution speed...

it is very difficult indeed to have 30,000+ lines of accurately-documented OO perl code. but i am trying very hard to make it so. freeform text marked up as pod embedded in code sure has its place, but there is no comparison in perl for the javadoc utility, which again is made possible through java's (obsession with) typing and objects.

it seems very likely that OOP in perl6 will be more-or-less made a part off the core language (if you want it), instead of being tacked 'on-the-side'. hopefully there will also be some more OO 'syntactic sugar' keywords like 'class', 'extends', 'method', 'private', 'this' etc.. - even if these are just aliases to the more familiar 'package', '@ISA', 'sub', 'my', 'my $this = shift;' etc.

it would give me a nice warm feeling to be able to write...

use very_strict; class PerlModule extends SomeModule { our $Class_Data; method set_something ( int $something ) { this->_update_something( $something ); this->something = $something; } private method _update_something ( int $raw_something ) { # ... } }
...in perl. the lack of prototypes and typing in perl is the only reason i even know java.

j.a.dirty.p.h.

Replies are listed 'Best First'.
RE: RE: Can perl be anything like Java?
by merlyn (Sage) on Sep 21, 2000 at 10:01 UTC
      ...and we are both australian... i wonder what that means? ;-)

      indeed, i had seen Class::Contract, and while in the desired direction, syntactically, it's a little ugly and deviates too much from my colleague's styles for me to force them to submit to the same style when they use some of my code.

      i don't think i'll be completely satisfied until we see what comes of the RFC's for perl6. the repeated calls for more and tighter OO support is sure encouraging... combine this with an OOP-tailored enhanced version of pod a la javadoc for the ultimate in perl API auto-documentation and the world is ours.

      it would be a massive victory for the Perl way if one will be able to code OOP in perl as strictly as java (ie with strong typing, exceptions and so forth) with the simple addition of some object pragma -- and then to turn around and write a 10 line text filter to clean up some windows-turkey's excel spreadsheet....... ;-)

      thanks for the reply,
      j.a.dirty.p.h