RT::Transactions->count

Hi.

I’ve written an Element that writes individual ticket loading times to a
file.
This file is then read by an html page.
The html page takes a ticket ID and retrieves a Transactions object for
that ticket.
It then wants to count the number of transactions on the ticket.
I had this working on one machine (solaris 9) with the following code:

$ticket = new RT::Ticket($RT::SystemUser);
$ticket->Load($id);
$transactions = $ticket->Transactions;
$numtrans = $transactions->count;

Then I transferred the code to another solaris machine (the production
box) and it hiccups on ‘count’ with the following message:

Can’t locate object method “count” via package “RT::Transactions”

Why would that be?
Puzzling.

Any suggestions appreciated.
Kind regards.

Luke

[snip] Why would that be?

Change it to $transactions->Count (note the uppercase) and it should
work. DBIx::SearchBuilder allows you to use under_score’d versions of
all of the methods if you happen to have the ‘capitalization’ module
installed. Of course, as you found out, this makes the code
non-portable. For instance, it bit us as well in the RTFM 2.2.0RC1
release. This makes the ‘capitalization’ code kinda irritating; Jesse
calls it a “failed experiment,” I call it a “silly hack.”
Luckily, we went back and did it right for Jifty::DBI, but that won’t
help the RT codebase for a while yet. ;>

  • Alex