Subject: | Net::MAC - un-obfuscate the class data? |
Date: | Tue, 16 Nov 2010 15:23:35 +1100 |
To: | bug-Net-MAC [...] rt.cpan.org |
From: | Alex Satrapa <grail [...] goldweb.com.au> |
I've been trying to extend the Net::MAC class to cater for some different formats (SNMP and weird vendor-specific strings). This has proven to be harder than I'd like, due to the use of a closure to hide the "class data and methods" outside of any namespace.
For my purposes, I'd have been able to achieve my desired result by simply adding a new format spec to the "%_format_for" hash. As it stands, I've had to define my own "as_X" methods, and override the _discover method to handle the parsing of my specific formats, then pass everything on to the Net::MAC version of _discover - this makes my code longer than necessary, introduces more avenues for bugs (since I'm basically duplicating code), and makes my code look messy.
Is there any possibility of removing that closure and just leave the Net::MAC class variables in the Net::MAC namespace where they can be modified by programmers who understand the risks?