|Just another Perl shrine|
Wrapping the open() built-inby almut (Canon)
|on Oct 26, 2006 at 21:18 UTC||Need Help??|
almut has asked for the
wisdom of the Perl Monks concerning the following question:
I need to replace Perl's built-in open() function. The reason I want to do this is described in detail in another recent post of mine. In a nutshell, I have to do encoding conversions on filename arguments (unicode -> CP932).
Actually, it's not only open() I need to wrap, but open() appears to be the most flexible beast of those, and I'd very much appreciate if some of you wise monks could take a look at what I currently have, and let me know if I've overlooked something...
_____ I18N/Japanese.pm (the 'compatibility' module) _____
_____ using the replaced open() _____
I believe this code is able to handle all various usages of open() ... but please don't hesitate to prove me wrong ;) Otherwise, well, I'd be glad to share this snippet with whoever in need might google this up in the future.
(Note: the encoding conversion aspect is not what I'm worried about at the moment, but rather whether the replaced open() is still behaving like the built-in one, interface-wise)