I used to be a C++/Java man. So naturally when I first started with OOPerl it looked horrible to me. I thought it was just a badly written patch. I mean, what is all this $self = shift; stuff? Why is there no proper 'this'? And where are all the private variables? So at first, I used perl for just functional programming.

But as I worked more with perl, I started missing the OO design for all its good at. Ever since I moved from Basic (GW/Quick/Visual) to C++ I was an OO thinker. So I finally decided I'll give OOPerl a chance.

Now, after doing some work, and even releasing my first CPAN module, I find that I like OOPerl better than Java/C++. That's because -

I used all of this features, and felt a sense of freedom that you only get with perl.

However, there is one downside that I bothers me, and I'd like to read your opinion on it. I think there is an issue of security: You can't trust your class to be used the way you want it to. To demonstrate why this is important sometimes, think of Java's SecurityManager class: It controlls all activities in the JVM including file and inter-thread actions. If one could add and override functions in that class freely, that class would be useless. I don't know of any perlish way to totally encapsulate your classes to be unpenetrateable..

Is there such a way? Are there any other downsides (and upsides) that I am not aware of?


In reply to OOPerl isn't that bad after all... by yosefm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.