<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>Sadly, I'm not cool enough to get you a free TiVo. Mine
wasn't even free :P</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>I have Learning Perl, I'm just floundering and it's all
starting to look the same</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>Condition: on create</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>Action: User Defined</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>Templayte: Global template: Blank</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>Stage: TransactionCreate</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>my $to =
$self->TicketObj->Transactions->First->Message->First->GetHeader('To');<BR>if
($to
=~/xx\-alert\@.*\.?tivo\.com/)<BR>{<BR>$self->TicketObj->SetPriority(98);<BR>}<BR>return
1;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2>It doesn't error, but it seems to be ignored entirely. I
used 'my', as the global variable was throwing errors about global symbol
requiring an explicit package name. Perhaps it's working and not parsing
right?</FONT></SPAN></DIV>
<DIV dir=ltr align=left> </DIV>
<DIV>
<DIV dir=ltr align=left><SPAN class=764492620-30012008><FONT face=Arial
color=#0000ff size=2></DIV></FONT></SPAN><FONT face=Arial color=#0000ff
size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Todd Chapman [mailto:todd@chaka.net]
<BR><B>Sent:</B> Wednesday, January 30, 2008 12:23 PM<BR><B>To:</B> Kimberly
McKinnis<BR><B>Cc:</B> rt-users@lists.bestpractical.com<BR><B>Subject:</B> Re:
[rt-users] Scrip for escalating priority based on to address from
header<BR></FONT><BR></DIV>
<DIV></DIV>Kimberly,<BR><BR>I would starting by picking up a copy of Learning
Perl. If you don't know basic Perl syntax there is no way you will be able to
write RT scrips. Try:<BR><BR><FONT face=Arial size=2>if ($to =~
/xxx\-alert\@.*\.?tivo\.com/) {</FONT><BR><FONT face=Arial size=2>{</FONT>
<BR><FONT face=Arial size=2>$self->TicketObj->SetPriority(98);</FONT>
<BR><FONT face=Arial size=2>}</FONT> <BR><BR>I'll write it for you if you send
me an HD Tivo. ;)<BR><BR>-Todd<BR><BR><BR>
<DIV><SPAN class=gmail_quote>On 1/30/08, <B class=gmail_sendername>Kimberly
McKinnis</B> <<A href="mailto:kmckinnis@tivo.com">kmckinnis@tivo.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Because I
have no idea what I'm doing. Without, I still receive
errors:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>[Wed Jan
30 20:17:14 2008] [error]: Scrip 16 Commit failed: Global symbol "$to"
requires explicit package name at (eval 2305) line 1.<BR>Global symbol
"$Ticket" requires explicit package name at (eval 2305) line 1.<BR>syntax
error at (eval 2305) line 2, near "if $to "<BR>Global symbol "$to" requires
explicit package name at (eval 2305) line 2.<SPAN
class=q><BR> (/usr/lib/rt/RT/Action/UserDefined.pm:81)<BR></SPAN></FONT></SPAN></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> Todd Chapman [mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:todd@chaka.net" target=_blank>todd@chaka.net</A>]
<BR><B>Sent:</B> Wednesday, January 30, 2008 11:58 AM<BR><B>To:</B> Kimberly
McKinnis<BR><B>Cc:</B> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:rt-users@lists.bestpractical.com"
target=_blank>rt-users@lists.bestpractical.com</A><BR><B>Subject:</B> Re:
[rt-users] Scrip for escalating priority based on to address from
header<BR></FONT><BR></DIV>
<DIV><SPAN class=e id=q_117cc59656cb7756_3>
<DIV></DIV>Why do you have a package statement?<BR><BR>And $Ticket should be
$self->TicketObj.<BR><BR>
<DIV><SPAN class=gmail_quote>On 1/30/08, <B class=gmail_sendername>Kimberly
McKinnis</B> <<A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:kmckinnis@tivo.com" target=_blank>kmckinnis@tivo.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<P><FONT face=Arial size=2>I've read up on priorities, but nothing I've seen
quite fits my need. We have two email addresses that both go to the same
queue, an alert email and a support email. The alert email also SMS's my
mobile phone. I'd like to have RT check the to: address from the header and
set anything to the alert email to a high priority. Then I can do things
like a cron to check for untouched emails with a high priority and alert us.
</FONT></P>
<P><FONT face=Arial size=2>I've approached this with a user defined scrip in
the server queue:</FONT> </P>
<P><FONT face=Arial size=2>Custom condition: return 1;</FONT> </P>
<P><FONT face=Arial size=2>Custom action prep code: return 1;</FONT> </P>
<P><FONT face=Arial size=2>Custom action cleanup code:</FONT> <BR><FONT
face=Arial size=2> </FONT> <BR><FONT face=Arial size=2>package
RT::User;</FONT> </P>
<P><FONT face=Arial size=2>my $to =
$Ticket->Transactions->First->Message->First->GetHeader('To');</FONT>
<BR><FONT face=Arial size=2>if $to = ('xxx\-alert\@.*\.?tivo\.com')</FONT>
<BR><FONT face=Arial size=2>{</FONT> <BR><FONT face=Arial
size=2>$self->TicketObj->SetPriority(98);</FONT> <BR><FONT face=Arial
size=2>}</FONT> <BR><FONT face=Arial size=2>return 1;</FONT> </P>
<P><FONT face=Arial size=2>When opening a new ticket, I see in
rt.log:</FONT> <BR><FONT face=Arial size=2>[Wed Jan 30 18:56:16 2008]
[error]: Scrip 16 Commit failed: Global symbol "$to" requires explicit
package name at (eval 2242) line 3.</FONT></P>
<P><FONT face=Arial size=2>Global symbol "$Ticket" requires explicit package
name at (eval 2242) line 3.</FONT> <BR><FONT face=Arial size=2>syntax error
at (eval 2242) line 4, near "if $to "</FONT> <BR><FONT face=Arial
size=2>Global symbol "$to" requires explicit package name at (eval 2242)
line 4.</FONT> <BR><FONT face=Arial
size=2> (/usr/lib/rt/RT/Action/UserDefined.pm:81)</FONT> </P>
<P><FONT face=Arial size=2>Obviously, I'm doing something very wrong, but
I'm not clear what. Could someone proofread this and let me know where I've
gone wrong? Thanks!</FONT></P>
<P><FONT face=Arial size=2>~~</FONT> <BR><FONT face=Arial size=2>Kimberly
McKinnis</FONT> <BR><FONT face=Arial size=2>System Operations
Engineer</FONT> <BR><FONT face=Arial size=2>Service Provider Division, TiVo
Inc</FONT> <BR><FONT face=Arial size=2>408-519-9607</FONT>
</P></DIV><BR>_______________________________________________<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users"
target=_blank>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</A><BR><BR>Community
help: <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://wiki.bestpractical.com"
target=_blank>http://wiki.bestpractical.com</A><BR>Commercial support: <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:sales@bestpractical.com"
target=_blank>sales@bestpractical.com</A><BR><BR><BR>Discover RT's hidden
secrets with RT Essentials from O'Reilly Media.<BR>Buy a copy at <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://rtbook.bestpractical.com"
target=_blank>http://rtbook.bestpractical.com</A><BR></BLOCKQUOTE></DIV><BR></SPAN></DIV></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>