[Chicago-talk] logging in and out files

tiger peng tigerpeng2001 at yahoo.com
Wed Oct 27 07:46:15 PDT 2010


I use the "@EXPORT_OK   = qw (open);" to export the function as I expect more 
functions should be overridden.

I tried your alias approach, but it does not work for me. 

My temporary solution is adding "no strict 'subs'".

use myLog 'open'; no strict 'subs';


From: Alexander Danel <danel at speakeasy.net>
To: Chicago.pm chatter <chicago-talk at pm.org>
Sent: Tue, October 26, 2010 12:59:37 PM
Subject: Re: [Chicago-talk] logging in and out files

Given what you are trying to do, I suppose you want to force export somehow.  
(In other words, I assume you have many program files that you want to just add 
one line “use MyLogs;” and be done, and not have to add the aliasing line into 
each individual code file.) You might try the following, which is probably a 
little controversial, but might suit your purposes. 

In the module file “MyLog.pm”, try ending it with a reset to “pachage main”, and 
then do the export (or “alias”) operation.  So the module file would end like 
# . . . ending of “MyLog.pm” module forces export.
package main;
# Alias
*open = \&myLog::open;
Any comments about this idea are welcomed.
Alexander Danel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20101027/04b72b5e/attachment.html>

More information about the Chicago-talk mailing list