Skip to content

Commit 6dc77b2

Browse files
committed
Fix use of loop variable
I was having this test fail when malware scanning is enabled with: Use of uninitialized value $_ in concatenation (.) or string at t/web/charting.t line 14. In perlsyn under https://perldoc.perl.org/perlsyn#Foreach-Loops it says: The foreach keyword is actually a synonym for the for keyword, so you can use either. If VAR is omitted, $_ is set to each value. VAR is set (it is $n), so perhaps this usage of $_ while VAR is set is undefined.
1 parent 81dde1c commit 6dc77b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/web/charting.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ for my $n (1..7) {
99
my $ticket = RT::Ticket->new( RT->SystemUser );
1010
my $req = 'root' . ($n % 2) . '@localhost';
1111
my ( $ret, $msg ) = $ticket->Create(
12-
Subject => "base ticket $_",
12+
Subject => "base ticket $n",
1313
Queue => "General",
1414
Owner => "root",
1515
Requestor => $req,
@@ -19,8 +19,8 @@ for my $n (1..7) {
1919
MIMEObj => MIME::Entity->build(
2020
From => $req,
2121
To => 'rt@localhost',
22-
Subject => "base ticket $_",
23-
Data => "Content $_",
22+
Subject => "base ticket $n",
23+
Data => "Content $n",
2424
),
2525
);
2626
ok( $ret, "ticket $n created: $msg" );

0 commit comments

Comments
 (0)