Thread Warum kein $@ statt $! (29 answers)
Opened by rosti at 2014-09-23 13:04

rosti
 2014-09-29 09:48
#177560 #177560
User since
2011-03-19
3198 Artikel
BenutzerIn
[Homepage]
user image
Genau das habe ich in meinem Artikel http://rolfrost.de/perlmod.html ausführlich mal aufgeschrieben.

Zu $! und der Backtrace-Geschichte:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;
use IO::File;
use Carp;
use Data::Dumper;

my $fh = IO::File->new;
eval{$fh->open("asdf", "r") || croak $!};

print Dumper $!, $@;


Code: (dl )
1
2
3
4
$VAR1 = 'No such file or directory';
$VAR2 = 'No such file or directory at C:\\Dokumente und Einstellungen\\rolf\\Desktop\\pack.pl line 10.
eval {...} called at C:\\Dokumente und Einstellungen\\rolf\\Desktop\\pack.pl line 10
';

View full thread Warum kein $@ statt $!