- sudo apt-get update -qq
- sudo apt-get build-dep -qq irssi libperl-prereqscanner-perl libperl-critic-perl
cpanminus
-- sudo apt-get install -qq lynx zsh apt-file libyaml-tiny-perl libtest-most-perl libgetopt-long-descriptive-perl
+- sudo apt-get install -qq lynx zsh apt-file libtest-most-perl libgetopt-long-descriptive-perl
libwww-perl liblog-log4perl-perl libdatetime-perl libmodule-runtime-perl libparams-classify-perl
libtime-duration-parse-perl
- perl -V
- wget -qO- https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm | sudo
perl - App::cpanminus
-- sudo cpanm -q --skip-satisfied Perl::Critic Perl::PrereqScanner PPIx::XPath
+- sudo cpanm -q --skip-satisfied YAML::Tiny Perl::Critic Perl::PrereqScanner PPIx::XPath
- git clone -q git://github.com/irssi/irssi irssi-head
- pushd irssi-head
- ./autogen.sh --with-perl=module 2>/dev/null | tail -n 17
my ($package) = grep { !/^_/ } keys %Irssi::Script::;
require YAML::Tiny;
+YAML::Tiny->VERSION("1.59");
+require Encode;
+{
+ # This is an ugly hack to be `lax' about the encoding. We try to
+ # read everything as UTF-8 regardless of declared file encoding
+ # and fall back to Latin-1.
+ my $orig = YAML::Tiny->can("_has_internal_string_value");
+ *YAML::Tiny::_has_internal_string_value = sub {
+ my $ret = $orig->(@_);
+ use bytes;
+ $_[0] = Encode::decode_utf8($_[0], sub{pack 'U', +shift})
+ unless Encode::is_utf8($_[0]);
+ $ret
+ }
+}
require Module::CoreList;
require CPAN::Meta::Requirements;
require Perl::PrereqScanner;
unless (defined $package) {
my %fail = (failed => 1, name => $CURRENT_SCRIPT);
$fail{modules} = \@modules if @modules;
- { open my $ef, '>:utf8', "failed.yml";
- print $ef YAML::Tiny::Dump([\%fail]); }
+ YAML::Tiny::DumpFile("failed.yml", [\%fail]);
# Grep for the code instead
require PPI;
require PPIx::XPath;
}
$info{modules} = \@modules if @modules;
$info{default_package} = $package =~ s/::$//r if $package;
-{ open my $ef, '>:utf8', "info.yml";
- print $ef YAML::Tiny::Dump([\%info]); }
+YAML::Tiny::DumpFile("info.yml", [\%info]);
use strict; use warnings;
-use YAML::Tiny;
-use Scalar::Util;
-BEGIN {
- sub YAML::Tiny::_has_internal_string_value {
- !Scalar::Util::looks_like_number($_[0])
- }
-}
+use YAML::Tiny 1.59;
-my @config;
-if (open my $ef, '<:utf8', '_testing/config.yml') {
- @config = Load(do { local $/; <$ef> });
-}
+my $config = YAML::Tiny::LoadFile('_testing/config.yml');
my @yaml_keys;
-if (@config) {
- @yaml_keys = @{ $config[0]{scripts_yaml_keys}//[] };
+if ($config) {
+ @yaml_keys = @{ $config->{scripts_yaml_keys}//[] };
}
die "no keys defined in config.yaml\n" unless @yaml_keys;
} sort @yaml_keys
}
} sort keys %newmeta;
-{ open my $ef, '>:utf8', '_data/scripts.yaml' or die $!;
- print $ef Dump \@newdoc;
-}
+YAML::Tiny::DumpFile('_data/scripts.yaml', \@newdoc);
-if (@config && @{$config[0]{whitelist}//[]}) {
+if ($config && @{$config->{whitelist}//[]}) {
my $changed;
my @wl;
- for my $sf (@{$config[0]{whitelist}}) {
+ for my $sf (@{$config->{whitelist}}) {
if (-s "Test/$sf:passed") {
$changed = 1;
}
}
}
if ($changed) {
- $config[0]{whitelist} = \@wl;
- { open my $ef, '>:utf8', '_testing/config.yml' or die $!;
- print $ef Dump @config;
- }
+ $config->{whitelist} = \@wl;
+ YAML::Tiny::DumpFile('_testing/config.yml', $config);
}
}