ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Guard/Guard.pm
(Generate patch)

Comparing Guard/Guard.pm (file contents):
Revision 1.6 by root, Sat Dec 13 18:43:01 2008 UTC vs.
Revision 1.7 by root, Sat Dec 13 18:44:16 2008 UTC

6 6
7 use Guard; 7 use Guard;
8 8
9 # temporarily chdir to "/etc" directory, but make sure 9 # temporarily chdir to "/etc" directory, but make sure
10 # to go back to "/" no matter how myfun exits: 10 # to go back to "/" no matter how myfun exits:
11 sub dosomething { 11 sub myfun {
12 scope_guard { chdir "/" }; 12 scope_guard { chdir "/" };
13 chdir "/etc"; 13 chdir "/etc";
14 14
15 call_function_that_might_die_or_other_fun_stuff; 15 call_function_that_might_die_or_other_fun_stuff;
16 } 16 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines