Archive-Lha
view release on metacpan or search on metacpan
Archive::Lha::Header::Utils; pure-Perl fallbacks retained
- Store raw DOS integer in header{timestamp} for Level0/1; new
timestamp_is_unix flag distinguishes DOS from Unix epoch at display time
- Preload Level0/1/2 header parsers; dispatch via array instead of eval
- Fix filename charset for UNIX-tagged archives: use Encode::Guess
instead of assuming UTF-8 (fixes latin-1 filenames e.g. "Français")
- plha l: show filename node only (no path), matching Amiga LhA guide
- plha v/vv: fix timestamps for Level0/1 archives; display CRC uppercase
- plha/plhasa: English month names by default (LC_TIME=C), matching
lhasa and LhA for UNIX which both hardcode a static months[] array
- Add --use-locale flag to opt in to system locale month names
- Add --from-charset/--to-charset as long forms of -fc/-tc
- CI: run on all branches, use cpanm --installdeps, cache deps,
use prove -wlvmb t; hardcode expected plhasa output in tests
0.12 2026-05-08 (Nicolas Mendoza)
- Install plhasa via EXE_FILES instead of postamble symlink so it
is correctly installed by cpanm (postamble install targets are
skipped by cpanm)
- Add GitHub repository URL to CPAN metadata
lib/Archive/ppport.h view on Meta::CPAN
aMY_CXT_|5.007003||p
aMY_CXT|5.007003||p
aTHXR_|5.011000||p
aTHXR|5.011000||p
aTHX_|5.006000||p
aTHX|5.006000||p
add_data|||n
addmad|||
allocmy|||
amagic_call|||
amagic_cmp_locale|||
amagic_cmp|||
amagic_i_ncmp|||
amagic_ncmp|||
any_dup|||
ao|||
append_elem|||
append_list|||
append_madprops|||
apply_attrs_my|||
apply_attrs_string||5.006001|
lib/Archive/ppport.h view on Meta::CPAN
hv_placeholders_p||5.009003|
hv_placeholders_set||5.009003|
hv_riter_p||5.009003|
hv_riter_set||5.009003|
hv_scalar||5.009001|
hv_store_ent||5.004000|
hv_store_flags||5.008000|
hv_stores|5.009004||p
hv_store|||
hv_undef|||
ibcmp_locale||5.004000|
ibcmp_utf8||5.007003|
ibcmp|||
incline|||
incpush_if_exists|||
incpush|||
ingroup|||
init_argv_symbols|||
init_debugger|||
init_global_struct|||
init_i18nl10n||5.006000|
lib/Archive/ppport.h view on Meta::CPAN
sortcv|||
sortsv_flags||5.009003|
sortsv||5.007003|
space_join_names_mortal|||
ss_dup|||
stack_grow|||
start_force|||
start_glob|||
start_subparse||5.004000|
stashpv_hvname_match||5.011000|
stdize_locale|||
strEQ|||
strGE|||
strGT|||
strLE|||
strLT|||
strNE|||
str_to_version||5.006000|
strip_return|||
strnEQ|||
strnNE|||
lib/Archive/ppport.h view on Meta::CPAN
sv_catsv_flags||5.007002|
sv_catsv_mg|5.004050||p
sv_catsv_nomg|5.007002||p
sv_catsv|||
sv_catxmlpvn|||
sv_catxmlsv|||
sv_chop|||
sv_clean_all|||
sv_clean_objs|||
sv_clear|||
sv_cmp_locale||5.004000|
sv_cmp|||
sv_collxfrm|||
sv_compile_2op||5.008001|
sv_copypv||5.007003|
sv_dec|||
sv_del_backref|||
sv_derived_from||5.004000|
sv_destroyable||5.010000|
sv_does||5.009004|
sv_dump|||
lib/Archive/ppport.h view on Meta::CPAN
if (PL_numeric_radix_sv && IN_LOCALE) {
STRLEN len;
char* radix = SvPV(PL_numeric_radix_sv, len);
if (*sp + len <= send && memEQ(*sp, radix, len)) {
*sp += len;
return TRUE;
}
}
#else
/* older perls don't have PL_numeric_radix_sv so the radix
* must manually be requested from locale.h
*/
#include <locale.h>
dTHR; /* needed for older threaded perls */
struct lconv *lc = localeconv();
char *radix = lc->decimal_point;
if (radix && IN_LOCALE) {
STRLEN len = strlen(radix);
if (*sp + len <= send && memEQ(*sp, radix, len)) {
*sp += len;
return TRUE;
}
}
#endif
#endif /* USE_LOCALE_NUMERIC */
/* always try "." if numeric radix didn't match because
* we may have data from different locales mixed */
if (*sp < send && **sp == '.') {
++*sp;
return TRUE;
}
return FALSE;
}
#endif
#endif
#ifndef grok_number
use File::Basename;
use File::Path;
use Getopt::Long qw( GetOptionsFromArray );
use lib File::Spec->catfile($FindBin::Bin, '..', 'lib');
use Archive::Lha::Decode;
use Archive::Lha::Header;
use Archive::Lha::Header::Utils ();
use Archive::Lha::Stream::File;
use Carp;
use POSIX qw( strftime setlocale LC_TIME );
use Time::Moment;
# Charset options: -fc (from charset) and -tc (to charset)
my $opt_from_charset;
my $opt_to_charset;
my $opt_use_locale;
# Parse --use-locale before anything else so setlocale runs at startup
Getopt::Long::GetOptionsFromArray(\@ARGV,
'use-locale' => \$opt_use_locale,
'from-charset|fc=s' => \$opt_from_charset,
'to-charset|tc=s' => \$opt_to_charset,
);
setlocale(LC_TIME, 'C') unless $opt_use_locale;
# Return display name for a header, respecting -fc/-tc options.
# Without options, pathname() auto-detects from the OS field.
sub _display_name {
my ($header) = @_;
return $header->pathname( $opt_from_charset, $opt_to_charset // 'UTF-8' );
}
my $controller = +{
d => sub {
_main_lhasa();
} else {
_main_plha();
}
}
sub _main_plha {
GetOptionsFromArray(\@ARGV,
'from-charset|fc=s' => \$opt_from_charset,
'to-charset|tc=s' => \$opt_to_charset,
'use-locale' => \$opt_use_locale,
);
my $cmd = shift @ARGV or usage();
my $file = shift @ARGV or usage();
check_magic($file);
if ( !exists $controller->{$cmd} ) {
usage("Unknown command: $cmd");
}
$controller->{$cmd}->($file, @ARGV);
}
my ($msg) = @_;
my $text = "Usage: $0 [options] (l|v|vv|x|t|d) archive (files)\n" .
" l - list contents (LhA terse format, filename only)\n" .
" v - list archive verbose (LhA v format)\n" .
" vv - list archive full (LhA vv format)\n" .
" x - extract archive\n" .
" t - test file\n" .
" d - dump each header\n" .
" -fc, --from-charset <charset> source encoding for filenames (default: auto-detect)\n" .
" -tc, --to-charset <charset> output encoding for filenames (default: UTF-8)\n" .
" --use-locale use system locale for month names (default: English)\n";
if ($msg) {
die "$msg\n$text";
}
die $text;
}
sub _header_date {
my ($h) = @_;
return $h->{timestamp_is_unix}
? strftime("%d-%b-%y", localtime($h->{timestamp}))
Supported charset names are those accepted by L<Encode>. Run
C<perl -MEncode -e 'print join "\n", Encode->encodings(":all")'>
for a full list.
=item -tc I<charset>, --to-charset I<charset>
Specify the output character encoding for displayed filenames.
Defaults to UTF-8.
=item --use-locale
Use the system locale for month name abbreviations in date output.
By default, month names are always displayed in English (equivalent to
LC_TIME=C), matching the behaviour of lhasa and LhA for UNIX, which both
hardcode English month abbreviations.
=back
=head1 SEE ALSO
L<Archive::Lha>, L<Encode>
( run in 0.667 second using v1.01-cache-2.11-cpan-5a3173703d6 )