Devel-PatchPerl
view release on metacpan or search on metacpan
lib/Devel/PatchPerl/Hints.pm view on Meta::CPAN
ZSAiJGNjIiBpbgoqZysrKnwqQ0MqKQogIGRfZGxvcGVuPSdkZWZpbmUnCiAgZF9kbGVycm9yPSdk
ZWZpbmUnCiAgOzsKZXNhYwoKIyBPcmFjbGUvU3VuIGJ1aWxkcyB0aGVpciBQZXJsIHNoYXJlZCBz
aW5jZSA1LjYuMSwgYW5kIHRoZXkgYWxzbwojIHN0cm9uZ2x5IHJlY29tbWVuZCB1c2luZyBzaGFy
ZWQgbGlicmFyaWVzIGluIGdlbmVyYWwuCiMKIyBGdXJ0aGVybW9yZSwgT3BlbkluZGlhbmEgc2Vl
bXMgdG8gZWZmZWN0aXZlbHkgcmVxdWlyZSBidWlsZGluZyBwZXJsCiMgc2hhcmVkLCBvciBvdGhl
cndpc2UgcGVybCBzY3JpcHRzIHdvbid0IGV2ZW4gZmluZCB0aGUgUGVybCBsaWJyYXJ5Lgp1c2Vz
aHJwbGliPSd0cnVlJwo=',
);
my %files = (
'freebsd' => 'freebsd.sh',
'netbsd' => 'netbsd.sh',
'openbsd' => 'openbsd.sh',
'linux' => 'linux.sh',
'dragonfly' => 'dragonfly.sh',
'darwin' => 'darwin.sh',
'hpux' => 'hpux.sh',
'cygwin' => 'cygwin.sh',
'midnightbsd' => 'midnightbsd.sh',
'gnukfreebsd' => 'gnukfreebsd.sh',
'solaris' => 'solaris_2.sh',
'bitrig' => 'bitrig.sh',
'gnu' => 'gnu.sh',
);
sub hint_file {
my $os = shift;
$os = shift if eval { $os->isa(__PACKAGE__) };
$os = $^O unless $os;
return unless defined $hints{ $os };
my $content = decode_base64( $hints{ $os } );
return $content unless wantarray;
return ( $files{ $os }, $content );
}
sub hints {
return sort keys %hints;
}
qq'nudge nudge wink wink';
__END__
=pod
=encoding UTF-8
=head1 NAME
Devel::PatchPerl::Hints - replacement 'hints' files
=head1 VERSION
version 2.14
=head1 SYNOPSIS
use Devel::PatchPerl::Hints;
if ( my $content = Devel::PatchPerl::Hints->hint_file() ) {
chmod 0644, 'hints/netbsd.sh' or die "$!";
open my $hints, '>', 'hints/netbsd.sh' or die "$!";
print $hints $content;
close $hints;
}
# Get a list of OS for which we have hints
my @os = Devel::PatchPerl::Hints->hints();
=head1 DESCRIPTION
Sometimes there is a problem with Perls C<hints> file for a particular
perl port. This module provides fixed C<hints> files encoded using
C<MIME::Base64>.
=head1 FUNCTION
The function is exported, but has to implicitly imported into the
requesting package.
use Devel::PatchPerl::Hints qw[hint_file];
It may also be called as a class method:
use Devel::PatchPerl::Hints;
my $content = Devel::PatchPerl::Hints->hint_file();
=over
=item C<hint_file>
Takes an optional argument which is the OS name ( as would be returned by C<$^O> ).
By default it will use C<$^O>.
In a scalar context, Will return the decoded content of the C<hints> file suitable for writing straight to a
file handle or undef list if there isn't an applicable C<hints> file for the given or derived
OS.
If called in a list context, will return a list, the first item will be the name of the C<hints> file that
will need to be amended, the second item will be a string with the decoded content of the C<hints> file suitable
for writing straight to a file handle. Otherwise an empty list will be returned.
=item C<hints>
Takes no arguments, returns a list of OS names for which there are C<hints> files.
=back
=head1 AUTHOR
Chris Williams <chris@bingosnet.co.uk>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Chris Williams and Marcus Holland-Moritz.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 1.492 second using v1.01-cache-2.11-cpan-99c4e6809bf )