[rt-users] Searching for a string

Bryon Baker bbaker at copesan.com
Fri Aug 9 15:09:14 EDT 2013


Never mind found the issue.  

Again thanks Nathan for the help on the regex stuff.

Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  •  262-783-6261 ext. 2296
bbaker at copesan.com
www.copesan.com
"Servicing North America with Local Care"


-----Original Message-----
From: Bryon Baker 
Sent: Friday, August 09, 2013 1:19 PM
To: 'Nathan Cutler'; rt-users at lists.bestpractical.com
Subject: RE: [rt-users] Searching for a string

Ok moving on
So the "Custom action preparation code" is working I added this to the "Custom action cleanup code:"

use strict;
use warnings;

#### Start Area for Request Tracker ############

my $storenumber = "4223";
my $wonumber = "C2239243";


$RT::Logger->debug("Clean up Found Work Order: $wonumber Store: $storenumber\n");

return 1;

and all I get in the log is 
[Fri Aug  9 18:13:49 2013] [debug]: Found match for Walgreens, C2239243, 4233 ((eval 1635):8)     (From the "Custom action preparation code")
[Fri Aug  9 18:13:49 2013] [debug]: Skipping Scrip #15 because it didn't Prepare (/usr/lib/perl5/vendor_perl/5.16.2/RT/Scrips.pm:237)

Where is the message from the "Custom action cleanup code:"?

Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  •  262-783-6261 ext. 2296
bbaker at copesan.com
www.copesan.com
"Servicing North America with Local Care"


-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Nathan Cutler
Sent: Friday, August 09, 2013 11:59 AM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Searching for a string

Hi Bryon:

Perl regexes can be a bit tricky.

> Here is the codes being used.
>
> my $t_subject = $self->TransactionObj->ContentObj->Content ; my $match 
> = "Building: Walgreen Drug Store";

Here I would be to use \s+ after the colon, since there might be multiple spaces or even a tab in the email. Unless you're sure it will always be just a single space.

> if ( $t_subject !~ /$match/i)  {

This says "if $t_subject does NOT match". Don't you want the opposite?
I'd suggest you try changing the !~ operator (does NOT match) in this line to =~ (matches).

>    $RT::Logger->debug("Found Match\n");
>    return 0;
> }
> else {
>    $RT::Logger->debug("No Match Found Match string: $match content: $t_subject\n");
>    return 1;
> }

Another thing to try is the "s" modifier, which explicitly tells Perl to treat the entire email as a single line. But in my test it works fine without.

Hope this helps.
Nathan



More information about the rt-users mailing list