perl - Attribute::Handler's behaviors with use vs require -


I have applied a Perl module using the attribute :: handler

  package fu has gone; Strict use; Use warnings; Use attribute :: handler; Use base 'exporter'; Our @EXPORT = qw (__RETRY); Sub __RETRY: ATTR (CODE) {my ($ pkg, $ sym, $ code) = @_; No warning 'redefined'; * {$ Sym} = Sub {my $ self = $ _ [0]; My $ result; Print ("Perform sub-routine \ n"); $ Result = $ code- & gt; (); If ($ result) {print "you pass \ n"; } Other {print "you failed \ n"; }}} Subfoo: __RETRY {print "execution of fu \ n"; Return 1; } 1;   

Now when I call using this module, and call the function Fu (), it only implements the print statement of Foo.

  is required "FOO.pm"; FOO-& gt; Import (); FOO :: foo ();   

Output:

  is executing foo   

but then I do this using it , It works right. Use FOO; FOO :: foo ();

Output:

  to execute the sub-method executed by Foo you pass   

Actually, my code I am calling it using it and it is not working, your help will be appreciated!

pedal property :



Comments