"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "wml_include/TheWML/Frontends/Wml/PassesManager.pm" between
wml-2.28.0.tar.xz and wml-2.30.0.tar.xz

About: WML (Website META Language) is an extensible Webdesigner’s off-line HTML generation toolkit.

PassesManager.pm  (wml-2.28.0.tar.xz):PassesManager.pm  (wml-2.30.0.tar.xz)
skipping to change at line 72 skipping to change at line 72
use Path::Tiny qw/ path /; use Path::Tiny qw/ path /;
my $RESOLV_FN = '/etc/resolv.conf'; my $RESOLV_FN = '/etc/resolv.conf';
my $EXEC_DIR = "@{[TheWML::Config::libdir()]}/exec"; my $EXEC_DIR = "@{[TheWML::Config::libdir()]}/exec";
sub new sub new
{ {
my $self = bless +{}, shift; my $self = bless +{}, shift;
$self->_gnu_m4( scalar( which('gm4') ) // scalar( which('m4') ) ); $self->_gnu_m4( scalar( which('gm4') ) // scalar( which('m4') ) );
my $args = shift; my $args = shift;
my $__PASSES = [
sub { return shift->pass1(@_); },
sub { return shift->pass2(@_); },
sub { return shift->pass3(@_); },
sub { return shift->pass4(@_); },
sub { return shift->pass5(@_); },
sub { return shift->pass6(@_); },
sub { return shift->pass7(@_); },
sub { return shift->pass8(@_); },
sub { return shift->pass9(@_); },
];
$self->_passes( $self->_passes(
[ [
'', '',
map { map { TheWML::Frontends::Wml::PassObj->new( cb => $_ ) } (
TheWML::Frontends::Wml::PassObj->new( (
idx => ( $_ + 1 ), sub { return shift->pass1(@_); },
cb => $__PASSES->[$_] sub { return shift->pass2(@_); },
sub { return shift->pass3(@_); },
sub { return shift->pass4(@_); },
sub { return shift->pass5(@_); },
sub { return shift->pass6(@_); },
sub { return shift->pass7(@_); },
sub { return shift->pass8(@_); },
sub { return shift->pass9(@_); },
) )
} )
keys @$__PASSES
] ]
); );
my $gen_hostname = `hostname`; my $gen_hostname = `hostname`;
$gen_hostname =~ s|\n$||; $gen_hostname =~ s|\n$||;
$gen_hostname ||= 'UNKNOWN-HOSTNAME'; $gen_hostname ||= 'UNKNOWN-HOSTNAME';
if ( $gen_hostname =~ /\A[a-zA-Z0-9_-]+\z/ if ( $gen_hostname =~ /\A[a-zA-Z0-9_-]+\z/
and -f $RESOLV_FN ) and -f $RESOLV_FN )
{ {
open( my $tmp_fh, '<', $RESOLV_FN ) open( my $tmp_fh, '<', $RESOLV_FN )
skipping to change at line 149 skipping to change at line 143
sub dosystem sub dosystem
{ {
my ( $self, $cmd ) = @_; my ( $self, $cmd ) = @_;
$self->verbose( 2, "system: $cmd\n" ); $self->verbose( 2, "system: $cmd\n" );
return scalar system($cmd); return scalar system($cmd);
} }
sub _generic_do sub _generic_do
{ {
my ( $self, $args, ) = @_; my ( $self, $pass_idx, $EXE, $opt, $from, $to, $cb ) = @_;
my $pass_idx = $args->{pass_idx};
my $EXE = $args->{EXE};
my $opt = $args->{opt};
my $from = $args->{from};
my $to = $args->{to};
my $prog = "$EXEC_DIR/$EXE"; my $prog = "$EXEC_DIR/$EXE";
my $argv = "$opt -o $to $from"; my $argv = "$opt -o $to $from";
return scalar( return scalar(
$self->_opt_s $self->_opt_s
? $self->dosystem("$prog $argv") ? $self->dosystem("$prog $argv")
: $self->pass($pass_idx)->dosource( $self, $prog, $argv, $args->{cb} ) : $self->pass($pass_idx)->dosource( $self, $prog, $argv, $cb, )
); );
} }
sub pass1 sub pass1
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 1,
pass_idx => 1, 'wml_p1_ipp',
EXE => 'wml_p1_ipp', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::IPP::Main;
to => $to,
cb => sub {
require TheWML::Backends::IPP::Main;
return TheWML::Backends::IPP::Main->new( argv => [@_] )->main; return TheWML::Backends::IPP::Main->new( argv => [@_] )->main;
}, },
}
); );
} }
sub pass2 sub pass2
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
my $cwd = _my_cwd; my $cwd = _my_cwd;
my $rc = $_pass_mgr->dosystem( my $rc = $_pass_mgr->dosystem(
"$EXEC_DIR/wml_p2_mp4h $opt -I '$cwd' $from >$tmp"); "$EXEC_DIR/wml_p2_mp4h $opt -I '$cwd' $from >$tmp");
skipping to change at line 224 skipping to change at line 208
return return
scalar $_pass_mgr->dosystem( scalar $_pass_mgr->dosystem(
$_pass_mgr->_gnu_m4() . " $opt --prefix-builtins <$from >$to" ); $_pass_mgr->_gnu_m4() . " $opt --prefix-builtins <$from >$to" );
} }
sub pass5 sub pass5
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 5,
pass_idx => 5, 'wml_p5_divert',
EXE => 'wml_p5_divert', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::Divert::Main;
to => $to,
cb => sub { return TheWML::Backends::Divert::Main->new( argv => [@_] )->main;
require TheWML::Backends::Divert::Main; },
return TheWML::Backends::Divert::Main->new( argv => [@_] )
->main;
},
}
); );
} }
sub pass6 sub pass6
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 6,
pass_idx => 6, 'wml_p6_asubst',
EXE => 'wml_p6_asubst', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::ASubst::Main;
to => $to,
cb => sub { return TheWML::Backends::ASubst::Main->new( argv => [@_] )->main;
require TheWML::Backends::ASubst::Main; },
return TheWML::Backends::ASubst::Main->new( argv => [@_] )
->main;
},
}
); );
} }
sub pass7 sub pass7
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 7,
pass_idx => 7, 'wml_p7_htmlfix',
EXE => 'wml_p7_htmlfix', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::Fixup::Main;
to => $to,
cb => sub {
require TheWML::Backends::Fixup::Main;
return TheWML::Backends::Fixup::Main->new( argv => [@_] )->main; return TheWML::Backends::Fixup::Main->new( argv => [@_] )->main;
}, },
}
); );
} }
sub pass8 sub pass8
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 8,
pass_idx => 8, 'wml_p8_htmlstrip',
EXE => 'wml_p8_htmlstrip', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::HtmlStrip::Main;
to => $to,
cb => sub { return TheWML::Backends::HtmlStrip::Main->new( argv => [@_] )->main;
require TheWML::Backends::HtmlStrip::Main; },
return TheWML::Backends::HtmlStrip::Main->new( argv => [@_] )
->main;
},
}
); );
} }
sub pass9 sub pass9
{ {
my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_; my ( $_pass_mgr, $opt, $from, $to, $tmp ) = @_;
# First check whether a shebang line is found and no # First check whether a shebang line is found and no
# output files were assigned on command line. # output files were assigned on command line.
# This is needed to unprotect output files. # This is needed to unprotect output files.
skipping to change at line 320 skipping to change at line 285
{ {
$_pass_mgr->out_istmp(0); $_pass_mgr->out_istmp(0);
$_pass_mgr->_process_argv_cb->($_pass_mgr); $_pass_mgr->_process_argv_cb->($_pass_mgr);
$opt = $_pass_mgr->pass(9)->opt_pass; $opt = $_pass_mgr->pass(9)->opt_pass;
} }
} }
# slice contains "package" commands and # slice contains "package" commands and
# other stuff, so we cannot source it. # other stuff, so we cannot source it.
return $_pass_mgr->_generic_do( return $_pass_mgr->_generic_do(
{ 9,
pass_idx => 9, 'wml_p9_slice',
EXE => 'wml_p9_slice', $opt, $from, $to,
opt => $opt, sub {
from => $from, require TheWML::Backends::Slice::Main;
to => $to,
cb => sub {
require TheWML::Backends::Slice::Main;
return TheWML::Backends::Slice::Main->new( argv => [@_] )->main; return TheWML::Backends::Slice::Main->new( argv => [@_] )->main;
}, },
}
); );
} }
sub _read_slices sub _read_slices
{ {
my ( $self, $from ) = @_; my ( $self, $from ) = @_;
my @ret; my @ret;
open( my $slice_fh, '<', $from ) open( my $slice_fh, '<', $from )
or error("Unable to load $from: $!"); or error("Unable to load $from: $!");
 End of changes. 14 change blocks. 
99 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)