Wagner, David --- Senior Programmer Analyst --- WGO wrote:
> Dave Gray wrote:
>> On 6/27/05, Wagner, David --- Senior Programmer Analyst --- WGO
>> <[EMAIL PROTECTED]> wrote:
>>>         Sorry, but I have two subroutines with the same name which
>>> is fine because I have not had a need to use the hashes which these
>>> two similar subroutines created.
>>> 
>>>         How do I run the subroutine and generate my set of hashes,
>>> then replace the sub with the other and run again, but into
>>> different hashes. 
>>> 
>>>         What I have is:  a) use termareg and b) use termregall
>>> 
>>>         which is called by termareg( ... ); # where ... are the
>>> hashes passed
>> 
>> Does 'use'-ing the modules call the subroutines that generate the
>> hashes? If so, you could 'use' the first one and then 'require' the
>> second one, so you can control when the second subroutine gets
>> declared (runtime as opposed to compile time). You'll get a
>> 'subroutine redefined' warning, but it should work fine.
> 
>       I must be missing something because the code is not doing what I
> expected but then I may have wrong expectations. 
> 
>       Code is something like:
> 
>       use sub1;
>       ....  # other code
> 
>       my ( %MH1, %MH2 ) = ();
>       sub1( \%MH1, \%MH2);
> 
>       if ( true ) {
>          require sub1a;    # called as sub1
>          my ( %MH3, %MH4, %MH5 ) = ();
>          sub1( \%MH3, \%MH4, \%MH5 );
>        }
> 
>       What I see is require overlaying sub1 before the the first call of
> sub1. 
> 
>       What am I doing wrong or what am I not understanding as to how to
> overlay a subroutine, but when I want it overlaid and not just when
> Perl says it should be.  
> 
>       Thanks.
        
        As we say, "I have found the enemy and he is me!!"  Sorry, but when I 
initially was doing the work I had two use statements at the front because I 
thoguht they had different sub names.  I inadvertently left both in. Reason not 
working.  I found when I had commented out the section of code ( between a 
=head1 and =cut) and it still said that the subroutine had been renamed. At 
that point, I knew something was out of wack and it was!!! ;))

        Thanks for listening and now back to our regular programming.

Wags ;)


*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to