Cwd-Ext

 view release on metacpan or  search on metacpan

lib/Cwd/Ext.pm  view on Meta::CPAN

# abs path no dereference
sub abs_path_nd {   
   my $abs_path = shift;
   return $abs_path if $abs_path=~m{^/$};
   
   unless( $abs_path=~/^\// ){
      require Cwd;
      $abs_path = Cwd::cwd()."/$abs_path";
   }
    
    my @elems = split m{/}, $abs_path;
    my $ptr = 1;
    while($ptr <= $#elems){
        if($elems[$ptr] eq ''      ){
            splice @elems, $ptr, 1;
        }

        elsif($elems[$ptr] eq '.'  ){
            splice @elems, $ptr, 1;
        }



( run in 2.535 seconds using v1.01-cache-2.11-cpan-71847e10f99 )