Next | Program Repair Shop | 73 |
Here's a common problem
24 { mkdir $target_directory || die "Couldn't create dir : $target_node\n"}
36 mkdir $target_node || die "Couldn't create dir : $target_node\n" } }
This will never call die
It behaves as though he had written this:
mkdir ($target_node || die "Couldn't create dir : $target_node\n");
To fix this, use this:
mkdir($target_node) || die "Couldn't create dir : $target_node\n";
Or:
mkdir $target_node or die "Couldn't create dir : $target_node\n";
Rule: To be safe, use either parentheses or the or operator
This programmer did neither
Next | Copyright © 2002 M. J. Dominus |