[Rt-devel] Problem redefining hashes in Tickets_Local.pm

Michael Gilbert mdgilb at u.washington.edu
Mon Mar 6 14:33:09 EST 2006


I still seem to be having some problems with this..  How would I go 
about redefining the FIELDS and dispatch subroutines with the extra 
values, exactly?  I still can't seem to add the values to the hashes 
without modifying Tickets_Overlay.
Thanks,
Michael

Ruslan Zakirov wrote:
> Reproduced problem, this hashes are defined with 'my' scope so you
> can't redefine them from other file even if package is the same, but
> you can redefine or tie hook on functions FIELDS, dispatch and
> can_bundle.
>
> On 3/4/06, Michael Gilbert <mdgilb at u.washington.edu> wrote:
>   
>> Yes, I am setting the package name in Tickets_Local.  I should mention
>> that all previous changes have worked fine in Tickets_Local and all the
>> other _Locals, but all those changes were to existing  or new
>> subroutines, not hash definitions.
>>
>> For example, the &_TagLimit routine mentioned below is read without any
>> problems, and it only exists in the _Local, not the _Overlay.  It's only
>> the hash definitions that I can't seem to add to.
>>
>> Thanks,
>> Michael
>>
>> Todd Chapman wrote:
>>     
>>> On Fri, Mar 03, 2006 at 01:12:14PM -0800, Michael Gilbert wrote:
>>>
>>>       
>>>> Hello,
>>>> I'm having what is likely a simple problem, but I haven't been able to
>>>> come up with the answer on my own yet and was hoping for some advice.
>>>>
>>>> What I'm trying to do is add keys to the %FIELDS and %dispatch hashes in
>>>> Tickets_Local in order to handle searches on a custom Tags table,
>>>> however the new keys are never properly added to the hashes.  I've
>>>> attempted including them directly in the hash declarations:
>>>> %Fields =
>>>> ...
>>>>    Tag              => [ 'TAG', ],
>>>>    Tags             => [ 'TAG', ],
>>>> %dispatch =
>>>> ...
>>>>    TAG             => \&_TagLimit,
>>>>
>>>> As well as adding them in after the fact:
>>>> $FIELDS{'Tag'}  = ['TAG'];
>>>> $FIELDS{'Tags'} = ['TAG'];
>>>> $dispatch{'TAG'} = \&_TagLimit;
>>>>
>>>> Neither of which seems to have any affect on the hashes at runtime.
>>>> Both of the above work properly, however, when I add them directly into
>>>> Tickets_Overly.pm
>>>>
>>>> My question is if anyone knows of a way to update these hashes without
>>>> modifying Tickets_Overlay (keep the update in Tickets_Local).  I would
>>>> guess this is a problem of scope, but I haven't yet been able to find a
>>>> way around it (including completely commenting out the FIELDS and
>>>> dispatch declarations in Tickets_Overlay).
>>>>
>>>>
>>>>         
>>> In your _Local file are you setting the package name?
>>>
>>> package RT::Tickets;
>>>
>>>
>>>
>>> -Todd
>>>
>>>       
>> _______________________________________________
>> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>>
>> Best Practical is hiring! Come hack Perl for us: http://bestpractical.com/about/jobs.html
>>
>>     
>
>
> --
> Best regards, Ruslan.
>   



More information about the Rt-devel mailing list