Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^5: Can I please have *simple* modules?

by Perl Mouse (Chaplain)
on Nov 23, 2005 at 21:56 UTC ( #511267=note: print w/replies, xml ) Need Help??

in reply to Re^4: Can I please have *simple* modules?
in thread Can I please have *simple* modules?

That means more code I or a maintenance programmer has to wade through to understand what's going on
That's exactly why I like to spell out the accessors in my code. No other module to understand to know what the code is doing.
Additionally, your method assumes a particular implementation (in this case, a blessed hashref)
Uhm, no. Look again.
Not only does it make it easy for another programmer to violate encapsulation (even if it's only by accident), it also means that it's more work to switch your object to a blessed array ref or inside out objects.
Actually, the accessors are for inside-out objects, and if you want to switch to blessed array refs, you can leave the accessors I wrote them just they way they are. They will keep working.
use Class::BuildMethods qw/foo bar baz/;

With that, I get three accessors/mutators without code duplication or reliance on the internals.

And a dependency on another module, who's internals are more complicated than one-liner accessors.

I'd love to see the code of Class::BuildMethods that works independently of how the class using it is implemented, without denying the using class direct access to its data.

Perl --((8:>*

Replies are listed 'Best First'.
Re^6: Can I please have *simple* modules?
by Ovid (Cardinal) on Nov 23, 2005 at 22:19 UTC

    You're right that I misread your code. I still think my points stand but feel free to disagree. You can check the CPAN for my code soon (it has just been uploaded).


    New address of my CGI Course.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://511267]
[LanX]: before digging into deep debugging ... I have a strange UTF8 problem, probably it rings a bell:
[LanX]: two utf8 strings from different sources are base64 encoded, but after joining both the umlauts in teh second get deleted
[Corion]: LanX: You can't just join two base64 strings together
[LanX]: (not a high priority bug because I can use some HTML entities in the second string)
[Corion]: base64 is padded to a multiple of 4 chars (or something)
[LanX]: misunderstanding, I joined them before converting to base64
[Corion]: Also, I would be wary of encodings and try to make really sure that both input strings are UTF-8. Maybe join the input strings from one source together to see whether they decode as bad or not
[Corion]: LanX: Then the problem should persist without encoding to base64 too ;)
[LanX]: I think it's a flag problem ... I'll produce a reprodocable example for SOPW

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2017-01-16 13:53 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (150 votes). Check out past polls.