Archive-Lha

 view release on metacpan or  search on metacpan

lib/Archive/Lha/Header/Utils.pm  view on Meta::CPAN

  }
  elsif ( $type == 0x02 ) {
    my $dir = substr($buf, $from + 1, $len - 3);
    $dir =~ s/\0.*//s;
    $hash{directory} = $dir;
  }
  elsif ( $type == 0x50 ) {
    $hash{unix_perm} = unpack 'v', substr($buf, $from + 1, 2);
  }
  elsif ( $type == 0x51 ) {
    $hash{unix_gid} = unpack 'v', substr($buf, $from + 1, 2);
    $hash{unix_uid} = unpack 'v', substr($buf, $from + 3, 2);
  }
  elsif ( $type == 0x52 ) {
    $hash{unix_group} = substr($buf, $from + 1, $len - 3);
  }
  elsif ( $type == 0x54 ) {
    $hash{timestamp}         = unpack 'V', substr($buf, $from + 1, 4);
    $hash{timestamp_is_unix} = 1;
  }
  elsif ( $type == 0x39 || $type == 0x3F || $type == 0x40 || $type == 0x41

tools/plha  view on Meta::CPAN

        my $perm = $header->{unix_perm};
        my $type = _is_directory($header) ? 'd' : '-';
        my $str = $type;
        for my $shift (6, 3, 0) {
            my $bits = ($perm >> $shift) & 7;
            $str .= ($bits & 4) ? 'r' : '-';
            $str .= ($bits & 2) ? 'w' : '-';
            $str .= ($bits & 1) ? 'x' : '-';
        }
        my $uid = $header->{unix_uid} // 0;
        my $gid = $header->{unix_gid} // 0;
        # PERMSSN(10) + sep(1) + UID/GID(%5d/%-5d = 11) + sep(1) = 23
        return sprintf "%s %5d/%-5d ", $str, $uid, $gid;
    }
    return sprintf "%-23s", '[' . ($header->{os}[1] // 'generic') . ']';
}

sub _decode_entry {
    my ($header, $stream) = @_;
    return ('', 0) if _is_directory($header);
    my $decoded = '';
    my $decoder = Archive::Lha::Decode->new(
        header => $header,



( run in 0.610 second using v1.01-cache-2.11-cpan-ceb78f64989 )