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