view release on metacpan or search on metacpan
local/lib/perl5/IO/Async/Handle.pm view on Meta::CPAN
if( defined $read_handle ) {
if( !defined eval { $read_handle->fileno } ) {
croak 'Expected that read_handle can ->fileno';
}
unless( $self->can_event( 'on_read_ready' ) ) {
croak 'Expected either a on_read_ready callback or an ->on_read_ready method';
}
my @layers = PerlIO::get_layers( $read_handle );
if( grep m/^encoding\(/, @layers or grep m/^utf8$/, @layers ) {
# Only warn for now, because if it's UTF-8 by default but only
# passes ASCII then all will be well
carp "Constructing a ".ref($self)." with an encoding-enabled handle may not read correctly";
}
$self->{read_handle} = $read_handle;
$self->want_readready( defined $read_handle );
}
else {
local/lib/perl5/Module/Build/API.pod view on Meta::CPAN
dynamic_config => 1,
extra_compiler_flags => scalar `glib-config --cflags`,
extra_linker_flags => scalar `glib-config --libs`,
);
=item extra_manify_args
[version 0.4006]
Any extra arguments to pass to C<< Pod::Man->new() >> when building
man pages. One common choice might be C<< utf8 => 1 >> to get Unicode
support.
=item get_options
[version 0.26]
You can pass arbitrary command line options to F<Build.PL> or
F<Build>, and they will be stored in the Module::Build object and can
be accessed via the L</args()> method. However, sometimes you want
more flexibility out of your argument processing than this allows. In
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
my $mandir = File::Spec->catdir( $self->blib, 'bindoc' );
File::Path::mkpath( $mandir, 0, oct(777) );
require Pod::Man;
foreach my $file (sort keys %$files) {
# Pod::Simple based parsers only support one document per instance.
# This is expected to change in a future version (Pod::Simple > 3.03).
my $parser = Pod::Man->new( %podman_args );
my $manpage = $self->man1page_name( $file ) . '.' .
$self->config( 'man1ext' );
my $outfile = File::Spec->catfile($mandir, $manpage);
next if $self->up_to_date( $file, $outfile );
$self->log_verbose("Manifying $file -> $outfile\n");
eval { $parser->parse_from_file( $file, $outfile ); 1 }
or $self->log_warn("Error creating '$outfile': $@\n");
$files->{$file} = $outfile;
}
}
sub manify_lib_pods {
my $self = shift;
my %podman_args = (section => 3, @_); # libraries go in section 3
my $files = $self->_find_pods($self->{properties}{libdoc_dirs});
return unless keys %$files;
my $mandir = File::Spec->catdir( $self->blib, 'libdoc' );
File::Path::mkpath( $mandir, 0, oct(777) );
require Pod::Man;
foreach my $file (sort keys %$files) {
# Pod::Simple based parsers only support one document per instance.
# This is expected to change in a future version (Pod::Simple > 3.03).
my $parser = Pod::Man->new( %podman_args );
my $manpage = $self->man3page_name( $files->{$file} ) . '.' .
$self->config( 'man3ext' );
my $outfile = File::Spec->catfile( $mandir, $manpage);
next if $self->up_to_date( $file, $outfile );
$self->log_verbose("Manifying $file -> $outfile\n");
eval { $parser->parse_from_file( $file, $outfile ); 1 }
or $self->log_warn("Error creating '$outfile': $@\n");
$files->{$file} = $outfile;
}
}
sub _find_pods {
my ($self, $dirs, %args) = @_;
my %files;
foreach my $spec (@$dirs) {
my $dir = $self->localize_dir_path($spec);
next unless -e $dir;
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
foreach my $pod ( sort keys %$pods ) {
my ($name, $path) = File::Basename::fileparse($pods->{$pod},
$self->file_qr('\.(?:pm|plx?|pod)$')
);
my @dirs = File::Spec->splitdir( File::Spec->canonpath( $path ) );
pop( @dirs ) if scalar(@dirs) && $dirs[-1] eq File::Spec->curdir;
my $fulldir = File::Spec->catdir($htmldir, @rootdirs, @dirs);
my $tmpfile = File::Spec->catfile($fulldir, "${name}.tmp");
my $outfile = File::Spec->catfile($fulldir, "${name}.html");
my $infile = File::Spec->abs2rel($pod);
next if $self->up_to_date($infile, $outfile);
unless ( -d $fulldir ){
File::Path::mkpath($fulldir, 0, oct(755))
or die "Couldn't mkdir $fulldir: $!";
}
$self->log_verbose("HTMLifying $infile -> $outfile\n");
if ( $with_ActiveState ) {
my $depth = @rootdirs + @dirs;
my %opts = ( infile => $infile,
outfile => $tmpfile,
( defined($podpath) ? (podpath => $podpath) : ()),
podroot => $podroot,
index => 1,
depth => $depth,
);
eval {
ActivePerl::DocTools::Pod::pod2html(map { ($_, $opts{$_}) } sort keys %opts);
1;
} or $self->log_warn("[$htmltool] pod2html (" .
join(", ", map { "q{$_} => q{$opts{$_}}" } (sort keys %opts)) . ") failed: $@");
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
open(my $fh, '<', $infile) or die "Can't read $infile: $!";
my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract();
my $title = join( '::', (@dirs, $name) );
$title .= " - $abstract" if $abstract;
my @opts = (
"--title=$title",
( defined($podpath) ? "--podpath=$podpath" : ()),
"--infile=$infile",
"--outfile=$tmpfile",
"--podroot=$podroot",
($path2root ? "--htmlroot=$path2root" : ()),
);
unless ( eval{Pod::Html->VERSION(1.12)} ) {
push( @opts, ('--flush') ); # caching removed in 1.12
}
if ( eval{Pod::Html->VERSION(1.12)} ) {
push( @opts, ('--header', '--backlink') );
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
$html =~ s#^<!DOCTYPE .*?>#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">#im;
$html =~ s#<html xmlns="http://www.w3.org/1999/xhtml">#<html>#i;
# IE6+ will not display local HTML files with strict
# security without this comment
$html =~ s#<head>#<head>\n<!-- saved from url=(0017)http://localhost/ -->#i;
}
# Fixup links that point to our temp blib
$html =~ s/\Q$blibdir\E//g;
open($fh, '>', $outfile) or die "Can't write $outfile: $!";
print $fh $html;
close $fh;
unlink($tmpfile);
}
return ! $errors;
}
# Adapted from ExtUtils::MM_Unix
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
objects => [$spec->{obj_file}, @$objects],
lib_file => $spec->{lib_file},
extra_linker_flags => $self->extra_linker_flags );
return $spec->{lib_file};
}
sub compile_xs {
my ($self, $file, %args) = @_;
$self->log_verbose("$file -> $args{outfile}\n");
if (eval {require ExtUtils::ParseXS; 1}) {
ExtUtils::ParseXS::process_file(
filename => $file,
prototypes => 0,
output => $args{outfile},
);
} else {
# Ok, I give up. Just use backticks.
my $xsubpp = Module::Metadata->find_module_by_name('ExtUtils::xsubpp')
or die "Can't find ExtUtils::xsubpp in INC (@INC)";
my @typemaps;
push @typemaps, Module::Metadata->find_module_by_name(
'ExtUtils::typemap', \@INC
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
push @typemaps, $lib_typemap if $lib_typemap;
@typemaps = map {+'-typemap', $_} @typemaps;
my $cf = $self->{config};
my $perl = $self->{properties}{perl};
my @command = ($perl, "-I".$cf->get('installarchlib'), "-I".$cf->get('installprivlib'), $xsubpp, '-noprototypes',
@typemaps, $file);
$self->log_info("@command\n");
open(my $fh, '>', $args{outfile}) or die "Couldn't write $args{outfile}: $!";
print {$fh} $self->_backticks(@command);
close $fh;
}
}
sub split_like_shell {
my ($self, $string) = @_;
return () unless defined($string);
return @$string if ref $string eq 'ARRAY';
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
my $spec = $self->_infer_xs_spec($file);
# File name, minus the suffix
(my $file_base = $file) =~ s/\.[^.]+$//;
# .xs -> .c
$self->add_to_cleanup($spec->{c_file});
unless ($self->up_to_date($file, $spec->{c_file})) {
$self->compile_xs($file, outfile => $spec->{c_file});
}
# .c -> .o
my $v = $self->dist_version;
$self->compile_c($spec->{c_file},
defines => {VERSION => qq{"$v"}, XS_VERSION => qq{"$v"}});
# archdir
File::Path::mkpath($spec->{archdir}, 0, oct(777)) unless -d $spec->{archdir};
local/lib/perl5/Module/Build/PPMMaker.pm view on Meta::CPAN
$ppd .= <<'EOF';
</IMPLEMENTATION>
</SOFTPKG>
EOF
my $ppd_file = "$dist{name}.ppd";
open(my $fh, '>', $ppd_file)
or die "Cannot write to $ppd_file: $!";
binmode($fh, ":utf8")
if $] >= 5.008 && $Config{useperlio};
print $fh $ppd;
close $fh;
return $ppd_file;
}
sub _ppd_version {
my ($self, $version) = @_;