[rt-users] Script to build timeworked report based on CustomField

Rick Russell rickr at rice.edu
Tue Apr 18 11:59:11 EDT 2006



Jesse Vincent wrote:
> On Wed, Apr 05, 2006 at 03:32:12PM -0500, Rick Russell wrote:
>> Jason Fenner wrote:
>>> use POSIX(strftime);
>> Be careful! RT uses a default PERL package called CTime that includes
>> its own versions of strftime, localtime, etc.
> Huh?

Sorry for the "huh"-worthy comment :-)

When I attempted to use common time functions like localtime & strftime
in my custom scripts, I found that I was getting unpredictable results.
Careful debugging revealed the strftime was rarely barfing with an error
because the output of localtime was not what it expected.

I suspect that the problem was a conflict between CTime & POSIX modules:

http://search.cpan.org/~nwclark/perl-5.8.8/ext/POSIX/POSIX.pod

http://search.cpan.org/~muir/Time-modules-2003.1126/lib/Time/CTime.pm

which has a version of localtime that returns a different data structure
than POSIX localtime. Or maybe it was pulling the wrong version of
strftime instead.

Is RT dependent on CTime? I'm not really sure. The POSIX module is a
default for sure.

Either way, the problem went away when I referred to the functions
explicitly as POSIX::localtime & POSIX::strftime.

BTW, I read _RT Essentials_. I liked it, but I wish there was more
coverage of scripting and the various data structures in RT. Figuring
out what data structures are associated with tickets & transactions is
often an exercise in trial-and-error.

Rick R.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rickr.vcf
Type: text/x-vcard
Size: 182 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060418/75049c16/attachment.vcf>


More information about the rt-users mailing list