<?xml version="1.0" encoding="windows-1252"?>
<node id="1000101" title="Core module: Attribute::Handlers behaviour" created="2012-10-20 02:24:10" updated="2012-10-20 02:24:10">
<type id="115">
perlquestion</type>
<author id="1000094">
enigma</author>
<data>
<field name="doctext">
&lt;p&gt;
Hello perlmonks,
&lt;/p&gt;
&lt;p&gt;
Aim: To start tracing of the module flow in my project once execution started based on user choice.
&lt;/p&gt;
&lt;p&gt;
Description: When user wants to see the trace of the module file he/she enable the traceing just by setting the trace parameter to TRUE in project configuration file (before starting the execution).
&lt;/p&gt;
&lt;p&gt;
Solution: Tried Core module: 
&lt;code&gt;use Attribute::Handlers;&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Flow: Once the execution started it first check the trace parameter value and if it is TRUE then it reads the module file and changes the subroutine with 
&lt;code&gt;sub foo: TRACE {...}&lt;/code&gt;
and adds the Core module "Attribute::Handlers" as shown above.
&lt;/p&gt;
&lt;p&gt;
Once the new module is generated, then we try to load it dynamically -
&lt;code&gt;eval "use module_name;";&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Result: module_name module gets loaded successfully and i can call its subroutines, but those subroutines shows normal behaviour i.e. it is not using
&lt;code&gt;sub TRACE: ATTR {...}&lt;/code&gt; present in the module.
&lt;/p&gt;
&lt;p&gt;
Validated: I tried to load the new modifiled module using static loading,like ...
&lt;code&gt;use module_name;&lt;/code&gt;
It is loading successfully and using the TRACE sub for ATTR.&lt;/p&gt;
&lt;p&gt;
I need your help here to understand this behaviour change in core module when using with eval i.e. loading dynamically. Please let me know how i can make it correct without changing the design of the code.&lt;/p&gt;
&lt;p&gt;
Thanks.
&lt;/p&gt;</field>
</data>
</node>
