[rt-users] Problems with an SLA Scrip I created

Robert Wysocki robert.wysocki at contium.pl
Thu Jan 12 04:06:25 EST 2012


Dnia 2012-01-11, śro o godzinie 17:50 -0500, David Hollinger pisze:
(cut)
> 
> my $ticketPriority = $self->TicketObj->Priority;
> 
> if($ticketPriority == 0) {
> 
>       my $SLA = '24';
> 
>       }
> 
> elsif($ticketPriority == 25) {
> 
>       my $SLA = '8';
> 
>       }
> 
> elsif($ticketPriority == 50) {
> 
>       my $SLA = '4';
> 
>       }
> 
> elsif($ticketPriority == 75) {
> 
>       my $SLA = '1';
> 
>       }
> 
> else {
> 
>       my $SLA = 'Critical';
> 
>       }

"my" keyword defines variable in the smallest posibble lexical context -
in this case your SLA variable is visible only in the if/elsif/else
blocks, not beyond them.

Regards,
-- 
Robert Wysocki
administrator systemów linuksowych
CONTIUM S.A., http://www.contium.pl




More information about the rt-users mailing list