Rex-Endpoint-HTTP
view release on metacpan or search on metacpan
lib/Rex/Endpoint/HTTP/Interface/Fs/Base.pm view on Meta::CPAN
return 1;
}
sub download {
my ($self, $path) = @_;
if(! -f $path) {
die("File not found.");
}
my $content = eval { local(@ARGV, $/) = ($path); <>; };
return $content;
}
sub ln {
my ($self, $from, $to) = @_;
if(-f $to) {
CORE::unlink($to) or die($!);
}
lib/Rex/Endpoint/HTTP/Mojolicious/Plugin/Auth.pm view on Meta::CPAN
}
return 0;
});
$app->helper(auth => sub {
my ($mojo, $user, $pass) = @_;
if($user && $pass) {
# do the auth
my $file = $mojo->stash('config')->{user_file};
my ($f_user, $f_pw) = split( /:/, [ grep { /^$user:/ } eval { local(@ARGV) = ($file); <>; } ]->[0] || "" );
if($f_user) {
chomp $f_pw;
$pass = sha1_hex($pass);
if($user eq $f_user && $pass eq $f_pw) {
return 1;
}
}
}
( run in 1.667 second using v1.01-cache-2.11-cpan-49f99fa48dc )