Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: module w/ object-oriented and functional interfaces: best practices?

by temporal (Pilgrim)
on Sep 21, 2012 at 19:33 UTC ( #994983=note: print w/replies, xml ) Need Help??


in reply to Re: module w/ object-oriented and functional interfaces: best practices?
in thread module w/ object-oriented and functional interfaces: best practices?

Okay, you've got me there chromatic. I am definitely not any sort of an authority on what constitutes a "great" CPAN module ;)

But I do see this sort of thing a lot... most recently when I was fiddling with upgrading my config file loading with Config::General:

# the OOP way use Config::General; $conf = new Config::General("rcfile"); my %config = $conf->getall; # the procedural way use Config::General qw(ParseConfig SaveConfig SaveConfigString); my %config = ParseConfig("rcfile");

I'd like my modules to be able to do this in the most intelligent way possible! Which, as it turns out, requires intelligently considering how your module is being used and your own requirements. Curses, I hate intelligently considering things.

Anyway, as for going about it 'backwards', you're probably right. I take a learn-first, apply-later approach to things. Admittedly not that efficient (I could just use Moose and forget about all the small stuff involved in Perl OO). But I'd rather investigate what's really going on with the small pieces first and then jump up to using the feature-rich tools other people have built from them.

I'm here to enjoy myself tinkering with the ins and outs, the pieces and possibilities first and get work done (close) second. Don't tell my boss =P

But I think I come out ahead in the long run in terms of getting things done. We're getting to that old 'bottom-up' vs 'top-down' learning style argument, haha.

Strange things are afoot at the Circle-K.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994983]
help
Chatterbox?
[Corion]: choroba: No, I don't remember that story, but yes, it matches my experience ;))
[ambrus]: Hopefull the object isn't kept alive, the events are processed immediately, but you'd have to read a lot of source code to be sure about that.
[Corion]: ambrus: I think both of AnyEvent and Prima are pretty tight in their memory management because they both are cooperative multitasking and (I think) both use the Perl memory management for managing things
[Corion]: ambrus: And for Windows, I don't think that Prima knows if there still are messages queued for an object (in the Windows message loop). Finding that out would take lots of effort for little gain
[ambrus]: And even if this works, I'm still not sure you can't get double timeouts from a Timer.
[ambrus]: Corion: well Prima::Object says something like that the cleanup method will send an onDestory message and that you can't get more messages after cleanup, or something.
[Corion]: ambrus: Yeah - I don't think the deep source dive will be necessary if things are implemented as simple as they could be :)) And hopefully I won't need (more) timely object destruction. I can update the screen at 60Hz and hopefully even do HTTP ...
[Corion]: ... transfers in the background. Now that I think about it, this maybe even means that I can run the OpenGL filters on Youtube input :)
[ambrus]: Corion: I mentioned that the unix event loop of Prima always wakes up at least once every 0.2 seconds. Have you found out whether the win32 event loop of Prima does that too?
[Corion]: ambrus: Hmm - I would assume that the onDestroy message is sent from the destructor and doesn't go through the messageloop, but maybe it is sent when a window gets destroyed but all components are still alive...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2016-12-09 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.