Salutations Perl World Hello Perl World Greetings Perl World Done Debugged program terminated. L also lists any actions you have created. Delete all the installed actions with the A command. This process is commonly used to insert tracing code on the fly. For example, suppose you have a program executing a loop containing way too much code to step through, but you want to monitor the state of certain variables each time it goes around the loop. You might want to confirm what’s actually being ordered in a shopping cart application test (looking at just a fragment of an imaginary such application here): DB<1> l 79-91 79: while (my $item = shift @shopping_basket) 80 { 81: if ($item->in_stock) 82 { 83: $inventory->remove($item); 84: $order->add($item); 85 } 86 else 87 { 88: $order->back_order($item); 89: $inventory->order($item); 90 } 91 } DB<2> a 81 printf “Item: %25s, Cost: %5.2fn”, $item->name, $item->cost DB<3> c 92 Item: Forbidden Planet, Cost: 24.50 Item: Kentucky Fried Movie, Cost: 29.95 Item: Eraserhead, Cost: 14.75 main::(cart.pl:92): $customer->charge($order->total); DB<3> 7.2.7 Watch It: W Suppose you want to break on a condition that is dictated not by a particular line of code but by a change in a particular variable. This is called a watchpoint, and in Perl you set it with the W command followed by the name of a variable.[3] [3] In fact, Perl can monitor anything that evaluates to an lvalue, so you can watch just specific array or hash entries, for example. Let’s say you’re reading a file of telephone numbers and to whom they belong into a hash, and you want to stop once you’ve read in the number 555-1212 to inspect the next input line before going on to check other things: main::(foo:1): my %phone;
Hint: This post is supported by Gama besplatan domen provider