App::MadEye::Plugin::Check::User - check uid


App-MadEye documentation Contained in the App-MadEye distribution.

Index


Code Index:

NAME

Top

App::MadEye::Plugin::Check::User - check uid

SYNOPSIS

Top

    - module: Check::User
      config:
        user: tokuhirom

AUTHOR

Top

Tokuhiro Matsuno

SEE ALSO

Top

App::MadEye


App-MadEye documentation Contained in the App-MadEye distribution.

package App::MadEye::Plugin::Check::User;
use strict;
use warnings;
use base qw/Class::Component::Plugin/;
use POSIX qw(getuid getpwuid);

sub check :Hook {
    my ($self, $context, $args) = @_;

    my $user = $self->config->{config}->{user};

    my @pw = getpwuid getuid;
    my $current_user = $pw[0];
    if ($current_user ne $user) {
        die "this script must run by $user user!(not $current_user)";
    }
}

1;
__END__