|
Passwd4.pm |
use Carp; # ... sub pwinit { my $passwd = shift; $passwd = "/etc/passwd" unless defined $passwd; open(PASSWD, $passwd) || croak "Unable to read from $passwd"; # ... } |
Bibliotheksmodule schieben die Schuld gerne auf den
Aufrufer und verwenden daher gerne croak aus
dem Modul Carp anstatt die.
|
testpasswd4.pl |
use Passwd4 qw(getpwent_by_login pwinit); (my($cmdname) = $0) =~ s{.*/}{}; die "Usage: $cmdname login [passwd]\n" if @ARGV == 0 || @ARGV > 2; my $login = shift; pwinit(shift) if @ARGV > 0; my $pwentry = getpwent_by_login($login); |
theseus$ testpasswd4.pl root /no/such/file Unable to read from /no/such/file at testpasswd4.pl line 9 theseus$ |
Copyright © 1996, 1998, 1999, 2000 Andreas Borchert, in HTML konvertiert am 07.02.2000 |