[rt-users] UntouchedInHours Module

Oluwatomisin Ilori tomisilori at yahoo.co.uk
Wed Feb 2 04:39:10 EST 2005


Please, can anyone help me out with this....I'm running rt 3.2.2 on redhat linux 8.0, perl 5.8.6, mode_perl 1 on apache 1.1.9 and mysql 4.1.9 and I'm trying to use the UntouchedInHours module from rt-crontool. However, I get the following error anytime i try to run this command from rt-crontool: 

[Wed Feb  2 08:43:28 2005] [crit]: Failed to load module RT::Condition::UntouchedInHours. () at ./rt-crontool line 162.
 (/opt/rt3/lib/RT.pm:276)
[Wed Feb  2 08:48:34 2005] [crit]: Failed to load module RT::Condition::UntouchedInHours. () at ./rt-crontool line 162.
 (/opt/rt3/lib/RT.pm:276)
[Wed Feb  2 08:48:50 2005] [crit]: Failed to load module RT::Condition::UntouchedInHours. () at ./rt-crontool line 162.
 (/opt/rt3/lib/RT.pm:276)
[Wed Feb  2 08:52:46 2005] [crit]: Failed to load module RT::Condition::UntouchedInHours. () at ./rt-crontool line 162.
 (/opt/rt3/lib/RT.pm:276)

The command I'm running from rt-crontool is:

./rt-crontool --search RT::Search::FromSQL --search-arg "Queue='VSATFaults' AND Status!='resolved" --condition RT::Condition::UntouchedInHours --condition-arg 2 --action RT:Action::RecordCorrespondence -template-id 13"

The UntouchedInHours module I got from RT Wiki is:

package RT::Condition::UntouchedInHours;require RT::Condition::Generic;  use strict;use vars qw/@ISA/;# We inherit from RT::Condition::Generic so we don't have to write (and maintain) # all the other stuff that goes into a condition at ISA = qw(RT::Condition::Generic);  =head2 IsApplicableIf the ticket's LastUpdated is more than n hours ago=cut# We just need to include this one function. I could have put everything in here but in# order to demonstrate the use of external functions, I've created the local_ageinhours# function. The function subtracts the LastUpdated time (as an Epoch timestamp) from the# current time stamp, then turns these seconds into hours.# The main function then just checks if this number is greater or equal to the argument# the crontool passed in.# # Note that the main function MUST be called 'IsApplicable'. For complex conditions it # may be best to create other functions as I've done here - so long as they're called # from IsApplicable.# I'd suggest naming your
 own functions with a 'local_' prefix so as to be certain not# to overwrite any current or future core function.sub IsApplicable {   my $self = shift;   if ( local_ageInHours($self->TicketObj) >= $self->Argument ) {       # Returning true (1) indicates that this condition is true       return 1;   } else {       # Returning undef indicates that this condition is false       return undef;   }}sub local_ageInHours {   my $ticketObj = shift;   return (time - $self->TicketObj->LastUpdated->Unix) / (60*60);}# The following could be omitted. They're there to allow overrides from Vendor and Local# but as this isn't a core module, they're just there for completeness :)eval "require RT::Condition::UntouchedInHours_Vendor";die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/UntouchedInHours_Vendor.pm});eval "require RT::Condition::UntouchedInHours_Local";die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/UntouchedInHours_Local.pm});# If you weren't already aware, all perl modules need to
 evaluate to true. So we# force it to evaluate to true by finishing with a '1'.1;


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20050202/91f75f53/attachment.htm>


More information about the rt-users mailing list