I dont think so.
Look at my example in previous reply. In SuperClass, attributes are stored in blessed hash, that means in object itself.
But now I want to write a 'persistent' object, and I want attributes to be stored in some kind of persistent storage (database) instead of hash.
I suppose SuperClass has many methods, all of them deal with $self->foo like a lvalue, using
$self->foo = 123;.
And now, how to write SubClass that will store foo attribute in database?
If I have 'traditional' $self->foo(123) method, solution is trivial. But with lvalue methods I cannot do such a thing.
It is never a good practice to make any assumption about storage of object attributes in strict OOP.
For this reason we use $self->foo instead of $self->{foo}.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.