Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Help with looping

by MysticElaine (Novice)
on Aug 24, 2018 at 16:32 UTC ( #1221037=perlquestion: print w/replies, xml ) Need Help??

MysticElaine has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to figure out why my if ($do_ECP_approved) isn't going for each issue. It is within my for loop, and the if ($do_labcloud_request) works as intended sending an email for each issue. Thanks!

for my $i (@issues){ + + my $intid = undef; my $id = $i->issue_id; my @assets = NIE::Issue->search($id); my ($assets, $oops) = NIE::Issue->search($id); my $ip = $assets->ip_asset_ip_address; $age = $assets->ticket_age; my $name = $assets->owner_login; $count = 2; while ($count >= 1){ $delegated_status = Update_ticket('s'); $comments = Update_ticket ('c'); if ($count >1) { $activity_type = Update_ticket('t'); } else {$activity_type = Update_ticket('d');} my $verbage = undef; $verbage .= sprintf "----------\nIssue: %s\n", $i->iss +ue_id ; $verbage .= sprintf "IssueStatus: %s->%s\n", $i->statu +s, $issue_status if ($issue_status); $verbage .= sprintf "ActivityType: %s\nActivityAbstrac +t: \"%s\"\nActivityComments:\n\"%s\"\n", $activity_type, $abstract, $comments if ($activity_type); $verbage .= sprintf "DelegatedStatus: %s->%s\n", $i->delegated_status, $delegated_status if ($delegated +_status); if ($prompt_to_update && !$yes_just_once) { my $reply = $term->get_reply( prompt => "y/n/YES/NO?" . " (YES/NO => y/n to all tickets)", allow => ['y','n','YES','NO'], print_me => $verbage); next if ($reply eq 'n'); last if ($reply eq 'NO'); $prompt_to_update = undef if ($reply eq 'YES'); } $yes_just_once = 0 if ($yes_just_once); printf "Updating %s\n", $i->issue_id; if ($live) { $intid = addFollowup($i->issue_id, $abstract, $comments, undef, undef, undef, undef, $activity_type); } if ($delegated_status) { if ($live && $i->delegated_status ne $delegated_st +atus) { $intid = UpdateNoccSRTicket( 'SRId' => $i->issue_id, 'DelegatedStatus' => $delegated_status ); } } if ($issue_status){ if ($live && $i->status ne $issue_status) { $intid = UpdateNoccSRTicket( 'SRId' => $i->issue_id, 'Status' => $issue_status ); } } } continue { --$count; $count = 0 if ($do_ECP_approved); } if ($do_labcloud_request){ ..... mail_func($name,$sub_ref,$body_ref); } if ($do_ECP_approved){ print "I need to change ownership back to $name for $ip\n" +; #lab-owner --set-owner $name $ip -u } }

Replies are listed 'Best First'.
Re: Help with looping
by mr_mischief (Monsignor) on Aug 24, 2018 at 16:41 UTC

    It often helps to examine one's assumptions. Have you checked that the value you expect in $do_ECP_approved is the value it actually has at that scope?

      This was my bad...I see the issue, thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1221037]
Approved by mr_mischief
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2020-10-21 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (223 votes). Check out past polls.

    Notices?