perfSONAR_PS-Services-MA-perfSONARBUOY

 view release on metacpan or  search on metacpan

lib/perfSONAR_PS/OWP.pm  view on Meta::CPAN

    # Now set UID
    if ( $uid =~ /\D/ ) {

        # If there are any non-digits, it is a username.
        $uid = getpwnam( $unam = $uid )
            or die "Can't getpwnam($unam): $!";
    }
    elsif ( $uid < 0 ) {
        $uid = -$uid;
    }
    die("Invalid UID: $uid") if ( !getpwuid($uid) );
    $> = $< = $uid;

    return;
}

=head2 daemonize()

TDB

=cut

lib/perfSONAR_PS/OWP/Conf.pm  view on Meta::CPAN

=cut

sub resolve_path {
    my ( $self, $path ) = @_;
    my ( $home, $user, $key );

    if ( ( $path =~ m#^~/#o ) || ( $path =~ m#^~$#o ) ) {
        $home 
            = $ENV{"HOME"}
            || $ENV{"LOGDIR"}
            || ( getpwuid($<) )[7]
            || "BOGUSHOMEDIR";
        $path =~ s#^\~#$home#o;
    }
    elsif ( ($user) = ( $path =~ m#^~([^/]+)/.*#o ) ) {
        $home = ( getpwnam($user) )[7] || "BOGUSHOMEDIR";
        $path = $home . substr( $path, length($user) + 1 );
    }

    while ( ($key) = ( $path =~ m#\$([^\/]+)#o ) ) {
        $path =~ s/\$$key/$ENV{$key}/g;



( run in 0.239 second using v1.01-cache-2.11-cpan-454fe037f31 )