Changeset 10646 for lang/perl/Archive-Lha
- Timestamp:
- 04/28/08 15:58:53 (7 months ago)
- Location:
- lang/perl/Archive-Lha/trunk
- Files:
-
- 1 added
- 6 modified
-
Changes (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
lib/Archive/Lha.pm (modified) (2 diffs)
-
lib/Archive/Lha/Header/Level0.pm (modified) (1 diff)
-
lib/Archive/Lha/Header/Level1.pm (modified) (2 diffs)
-
t/20_decode.t (modified) (1 diff)
-
t/archive/lh5_lvl1.lzh (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Archive-Lha/trunk/Changes
r3588 r10646 1 1 Revision history for Archive-Lha 2 3 0.03 2008/04/28 4 - applied a patch from Yukio USUDA to fix level 1 header handling. 5 - added 'known limitation' section to note the slowness. 2 6 3 7 0.02 2007/12/26 -
lang/perl/Archive-Lha/trunk/MANIFEST
r3588 r10646 33 33 t/archive/lh0.lzh 34 34 t/archive/lh5.lzh 35 t/archive/lh5_lvl1.lzh 35 36 t/archive/lh7.lzh 36 37 tools/plha -
lang/perl/Archive-Lha/trunk/lib/Archive/Lha.pm
r3588 r10646 4 4 use warnings; 5 5 6 our $VERSION = '0.0 2';6 our $VERSION = '0.03'; 7 7 8 8 require XSLoader; … … 40 40 41 41 This package offers rather crude methods to decode/extract files from LHa archives. As of writing this, I'm not inclined to support creating/updating archives for various reasons but this may change. As for decoding, I'll probably add if testable (and preferably uploadable) archives should be found or offered. 42 43 =head1 KNOWN LIMITATION 44 45 As you suspect, this is slow. Really slow. Some of the code is written in XS/C, but it may take minutes to extract larger archives (well, I must confess, the prototype of this module, written in pure perl, took hours to extract them). If you need more speed, just use native archivers such as LHa for UNIX, or unlha32.dll for MSWin32. They have their own limitations (such as single-threadedness, may need temporary files, and others), but they're much faster, and would take seconds to extract. 42 46 43 47 =head1 ACKNOWLEDGMENT -
lang/perl/Archive-Lha/trunk/lib/Archive/Lha/Header/Level0.pm
r6751 r10646 69 69 This parses Level 0 headers found mainly in the oldest archives created in the MS-DOS era. Actually, it was designed for LHarc, one of the ancestors of LHa. 70 70 71 As Level 0 header has rather severe limitation for the path length of the archived file, recent archivers usually use Level 2 (or extended Level 1) headers. If you find multibyte strings in the header, most probably they are encoded in shift _jis.71 As Level 0 header has rather severe limitation for the path length of the archived file, recent archivers usually use Level 2 (or extended Level 1) headers. If you find multibyte strings in the header, most probably they are encoded in shift-jis. 72 72 73 73 =head1 METHODS -
lang/perl/Archive-Lha/trunk/lib/Archive/Lha/Header/Level1.pm
r6751 r10646 52 52 my $extended_size_total = 0; 53 53 my $extended_size = _short( @bits[-2..-1] ); 54 my $from = $size;55 54 while( $extended_size ) { 55 @bits = split '', $stream->read( $extended_size ); 56 56 $extended_size_total += $extended_size; 57 my $to = $from + $extended_size - 1; 58 my ($next, %hash) = _extended_header( @bits[$from..$to] ); 57 my ($next, %hash) = _extended_header( @bits ); 59 58 %header = (%header, %hash) if %hash; 60 59 $extended_size = $next; 61 $from = $to + 1;62 60 } 63 61 $header{encoded_size} = $header{skip_size} - $extended_size_total; … … 83 81 This parses Level 1 headers found mainly in older archives created in the MS-DOS era. Also, some of the older ports, including LHa for UNIX, still prefer this header for compatibility reasons. Historically, Level 1 header, which is actually a combination of previous Level 0 header and following Level 2 header, was designed to foster the transition to Level 2 header. However, as Level 2 implementation delayed, Level 1 archives prevailed enough and could not be ignored. 84 82 85 Level 1 header also has rather severe limitation for the path length of the archived file. However, Level 1 header can use extended headers to store longer file/directory names. Multibyte strings in the header may be encoded in shift _jis, or in euc-jp, or in other encodings.83 Level 1 header also has rather severe limitation for the path length of the archived file. However, Level 1 header can use extended headers to store longer file/directory names. Multibyte strings in the header may be encoded in shift-jis, or in euc-jp, or in other encodings. 86 84 87 85 =head1 METHODS -
lang/perl/Archive-Lha/trunk/t/20_decode.t
r3588 r10646 11 11 test( file_stream( $name ) ); 12 12 } 13 14 test( file_stream('lh5_lvl1') ); 13 15 14 16 sub test {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)