Shipwright

 view release on metacpan or  search on metacpan

lib/Shipwright/Util.pm  view on Meta::CPAN


=head3 user_home

return current user's home directory

=cut

sub user_home {
    return $ENV{HOME} if $ENV{HOME};

    my $home = eval { (getpwuid $<)[7] };
    if ( $@ ) {
        confess_or_die "can't find user's home, please set it by env HOME";    
    }
    else {
        return $home;
    }
}

=head3 shipwright_user_root

share/bin/shipwright-builder  view on Meta::CPAN

unless ( $args{'no-install-base'} ) {
    $args{'install-base'} = get_install_base() unless $args{'install-base'};

    unless ( $args{'install-base'} ) {
        my $dir = tempdir( 'vessel_' . $args{name} . '-XXXXXX', TMPDIR => 1 );
        $args{'install-base'} = catdir( $dir, $args{name} );
        print "no default install-base, will set it to $args{'install-base'}\n";
    }

    # replace prefix ~ with real home dir
    $args{'install-base'} =~ s/^~/(getpwuid $<)[7]/e;

    # remove last / or \
    $args{'install-base'} =~ s{[/\\]$}{};
}

my ( $installed, $installed_file );
my $installed_hash = {};
unless ( $args{'no-install-base'} ) {
    $installed_file =
      catfile( $args{'install-base'}, "$args{as}_installed.yml" );



( run in 0.267 second using v1.01-cache-2.11-cpan-8d75d55dd25 )