Thread Debugging von lang laufenden Perlprogrammen (6 answers)
Opened by z80crew at 2005-04-06 02:58

renee
 2005-04-06 11:25
#53379 #53379
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Wie man debugging-Meldungen machen kann:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/perl

use strict;
use warnings;

unless(open(FILE,"<$ARGV[0]")){
print_debug("Kann Datei $ARGV[0] nicht öffnen!");
}
else{
while(my $line = <FILE>){
print $line;
}
close FILE;
}

print_debug("Ein anderer Fehler");

#------------------------------------------------------#
# Subroutines #
#------------------------------------------------------#

sub print_debug{
my ($msg) = @_;
my ($package,$filename,$line) = caller();
my $logfile = "./skript.log";
if(open(LOG,">>$logfile")){
print LOG $filename," ",$line,": ",$msg,"\n";
close LOG;
}
}# end print_debug
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Debugging von lang laufenden Perlprogrammen