Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Access to Attachment structure

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


aserrau at reilabs

Nov 13, 2009, 8:01 AM

Post #1 of 3 (386 views)
Permalink
Access to Attachment structure

In order to create a custom scrip, I need to access to Attachment structure
because I would know the value of a header of the original request message.

So I try to do in custom cleanup code block:
my $headers = $self->TransactionObj->Attachments->Headers;

but in log I have this error message:
Can't locate object method "Headers" via package "RT::Attachments".....

I seen in file ..lib/RT/Attachment.pm that the method Headers exists.


Anybody can say me the reason of this error?

Thank you in advance for the attention

--
Alessandra Serrau


elacour at easter-eggs

Nov 13, 2009, 8:04 AM

Post #2 of 3 (355 views)
Permalink
Re: Access to Attachment structure [In reply to]

On Fri, Nov 13, 2009 at 05:01:47PM +0100, Alessandra Serrau wrote:
> In order to create a custom scrip, I need to access to Attachment structure
> because I would know the value of a header of the original request message.
>
> So I try to do in custom cleanup code block:
> my $headers = $self->TransactionObj->Attachments->Headers;
>

$self->TransactionObj->Attachments links to multiple attachements, you
have to walk them with:

while ( my $Attachment = $self->TransactionObj->Attachments->Next ) {
my $headers = $Attachment->Headers;
}

Or use only the first one:

my $headers = $self->TransactionObj->Attachments->First->Headers;

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales [at] bestpractical


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


aserrau at reilabs

Nov 13, 2009, 8:26 AM

Post #3 of 3 (367 views)
Permalink
Access to Attachment structure [In reply to]

> In order to create a custom scrip, I need to access to Attachment
> structure
> > because I would know the value of a header of the original request
> message.
> >
> > So I try to do in custom cleanup code block:
> > my $headers = $self->TransactionObj->Attachments->Headers;
> >
>
> $self->TransactionObj->Attachments links to multiple attachements, you
> have to walk them with:
>
> while ( my $Attachment = $self->TransactionObj->Attachments->Next ) {
> my $headers = $Attachment->Headers;
> }
>
> Or use only the first one:
>
> my $headers = $self->TransactionObj->Attachments->First->Headers;
>
>
> Thank you very much for the fast response!
>
> I tryed both solution, the first one works, the second one doesn't work,
> the error is:
> Can't call method "Headers" on an undefined value at (eval 962) line 3.
>
> For me is sufficent the first one solution.
> Still thank you
> --
> Alessandra Serrau
>
>
Sorry, the last email is not the correct answer...
The first solution doesn't work like the second one.

If I exclude the while loop and write:

my $Attachment = $self->TransactionObj->Attachments->Next;
my $headers = $Attachment->Headers;

the error is te์he same:

Can't call method "Headers" on an undefined value at (eval 837) line 4.

Infact, in Attachment.pm it is not present neither "First" nor "Next"
methods.

How can I resolve my issue?
--
Alessandra Serrau

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.