Concierge-Auth
view release on metacpan or search on metacpan
lib/Concierge/Auth.pm view on Meta::CPAN
if (-e $args->{file}) {
open my $afh, "<", $args->{file} or
croak ("Can't read auth file ($args->{file}). $! ");
close $afh;
} else {
open my $afh, ">", $args->{file} or
croak ("Can't open/create auth file ($args->{file}). $! ");
close $afh;
}
chmod 0600, $args->{file} or carp $!;
$self->{auth}->{file} = $args->{file};
$self;
}
## Class Methods for Responses
## confirm, reject, reply
## NOT called with object arrow notation:
## $self->reject # !WRONG
## Once instantiated, the auth object will not die/croak;
## Instead, all methods that check or validate respond with
lib/Concierge/Auth.pm view on Meta::CPAN
if (-e $file) {
open my $afh, "<", $file or
return reject( "Can't read auth file ($file). $!" );
close $afh;
} else {
open my $afh, ">", $file or
return reject( "Can't open/create auth file ($file). $!" );
close $afh;
}
chmod 0600, $file or carp $!;
if ( $self->validateFile($file) ) {
$self->{auth}->{file} = $file;
return confirm( "Valid file" );
}
return reject( "Invalid file" );
}
## rmFile: deletes the passwd file
( run in 0.397 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )