Skip to content

Commit

Permalink
coding style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Sep 25, 2021
1 parent e90ff26 commit 39cbd43
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions lib/App/Perlbrew/Path.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use warnings;

package App::Perlbrew::Path;

require File::Basename;
require File::Glob;
require File::Path;
use File::Basename ();
use File::Glob ();
use File::Path ();

use overload (
'""' => \& stringify,
Expand All @@ -29,8 +29,7 @@ sub _child {
sub _children {
my ($self, $package) = @_;

return map $package->new($_),
File::Glob::bsd_glob($self->child("*"))
map { $package->new($_) } File::Glob::bsd_glob($self->child("*"));
}

sub new {
Expand All @@ -42,7 +41,7 @@ sub new {
sub basename {
my ($self, $suffix) = @_;

return scalar File::Basename::fileparse ($self, ($suffix) x!! defined $suffix);
return scalar File::Basename::fileparse($self, ($suffix) x!! defined $suffix);
}

sub child {
Expand All @@ -60,27 +59,27 @@ sub children {
sub dirname {
my ($self) = @_;

return App::Perlbrew::Path->new(File::Basename::dirname ($self));
return App::Perlbrew::Path->new( File::Basename::dirname($self) );
}

sub mkpath {
my ($self) = @_;
File::Path::mkpath ([$self->stringify], 0, 0777);
File::Path::mkpath( [$self->stringify], 0, 0777 );
return $self;
}

sub readlink {
my ($self) = @_;

my $link = readlink $self->stringify;
my $link = CORE::readlink( $self->stringify );
$link = __PACKAGE__->new($link) if defined $link;

return $link;
}

sub rmpath {
my ($self) = @_;
File::Path::rmtree([$self->stringify], 0, 0);
File::Path::rmtree( [$self->stringify], 0, 0 );
return $self;
}

Expand All @@ -102,15 +101,14 @@ sub symlink {
my ($self, $destination, $force) = @_;
$destination = App::Perlbrew::Path->new($destination) unless ref $destination;

CORE::unlink $destination if $force && (-e $destination || -l $destination);
CORE::unlink($destination) if $force && (-e $destination || -l $destination);

$destination if CORE::symlink $self, $destination;
$destination if CORE::symlink($self, $destination);
}

sub unlink {
my ($self) = @_;

CORE::unlink ($self);
CORE::unlink($self);
}

1;
Expand Down

0 comments on commit 39cbd43

Please sign in to comment.