![]() |
|
"be consistent" | |
PerlMonks |
Rhysby Rhys (Pilgrim) |
on Jan 10, 2001 at 03:05 UTC ( #50802=user: print w/replies, xml ) | Need Help?? |
TutorialCheck out the Net-SNMP Tutorial I wrote and tell me if there's anything hideous in it. It's here: Using the SNMP module from the Net-SNMP libraryLatest Perl ConundrumSome of these are simple, some quite complex. All of them are real problems I'm trying to solve for one reason or another. (Usually, I'm trying to tighten code from N lines to N/5 lines.)So here's the latest one. In many of my applications using SNMP, I have to use the structure below over and over, almost verbatim. The general structure is always the same, but certain parts - that I hope are clearly marked below - change to suit the particular task. Anyway, here goes:
So the conundrum is whether or not there's a shorter way of doing this. Perhaps with $vb->tag eq $mib in the while test, but that creates other issues. Another way of doing this that is successful, but actually duplicates code (though is still a bit more succint and doesn't have the dreaded 'while 1') is like this:
Please /msg if you have any ideas. If they're big, post to your scratchpad? I'm mostly looking for style/efficiency opinions and insight, although if you come up with some genius method that eliminates four lines, I'll engrave your PM home node URL into the credits of all scripts that use your method. :-)
General Stuff About RhysNet admin, net security guy, sys admin, Perl hacker, jack of all trades. Perl hacker means 'Perl hacker'. I usually try to just figure it out rather than look it up.Fortunately, that's just the code, not the algorithm. Design once, code five or six times is the idea. :-) I'm a Linux fan, a Dead Zone fan, and hope these guys and these other guys are out of business by 2010. Oh, yeah. I highly recommend this to anybody still looking, although you can't put too much faith in a Web site on the topic. Like anything else, there's a lot of (ahem) discussion on most of the more interesting topics. All I can say is there's way too much arguing. And it's often worth watching these, if only because every now and then, you learn something about yourself. By the way, I'm boycotting any store that already has freakin' Christmas decorations up. (Posted 11/3/2003.) That includes Target and JC Penney. Starting early is how the accountants boost their 'Christmas Sales' figures. It's all crap, so I'm not playing.
Picture ExplanationThis fat cat is Josephine ('Jo the Cat'). We don't really know much about Jo, except that she's a typical, sorta-neurotic, very opinionated female cat. I picked her up in the mosque parking lot one day last January and have been taking care of her ever since. Jo likes fighting with Snowplow (picture pending), waking everyone up at 4:00am, and generally forcing her way onto my lap. Laptops, books, food, etc. are not obstacles. I'm convinced she has created and fixed several Perl bugs with her keyboard dancing. The picture above is Jo in full catness: napping in the warm spot on the carpet on a cold Missouri March afternoon. What's amazing is that she wasn't in the laundry basket off to the bottom right...
Nodes I Think Are HandyHundreds of monks have 'handy nodes' sections! This is one of them!
Matching against list of patterns |
|