0: ##################################################
1: #This is my first craft post and a very simple #
2: #one - so be nice, please - but it can help when #
3: #you start to bang your head to the wall because #
4: #your script is not working... #
5: # #
6: #It's a simple sub to print out var's values. #
7: # #
8: #Include it on your script and call it like this #
9: #Debug_aid(var,output_type) #
10: # #
11: # output_type: #
12: # w - creates a new file from scratch #
13: # a - append to the file, if it already exists #
14: ##################################################
15: sub Debug_aid
16: {
17: @t=(localtime)[0..5];
18: $dt=sprintf "%02u/%02u/%02u %02u:%02u:%02u",$t[3],
19: $t[4]+1,$t[5]+1900,$t[2],$t[1],$t[0];
20:
21: $out = $_[0];
22: $type = $_[1];
23:
24: if ($type eq "w")
25: {
26: open (DEB, ">debug.log");
27: }
28: elsif ($type eq "a")
29: {
30: open (DEB, ">>debug.log");
31: }
32:
33: print DEB "[$dt] -> $out\n\n";
34: close (DEB);
35: } In reply to Debugging Aid by DaWolf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |