Commit f508e133 authored by Florian Schlichting's avatar Florian Schlichting

Imported Upstream version 1.005

parents 25ae4831 94a1292a
Revision history for IO-TieCombine
1.005 2015-10-30 22:18:10-04:00 America/New_York
- fileno on a IO::TieCombine::Handle now returns a negative value
so they can be known to be artificial
1.004 2014-02-01 19:15:17-05:00 America/New_York
- update bugtracker link
......
This software is copyright (c) 2014 by Ricardo SIGNES.
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2014 by Ricardo SIGNES.
This software is Copyright (c) 2015 by Ricardo SIGNES.
This is free software, licensed under:
......@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
......@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2014 by Ricardo SIGNES.
This software is Copyright (c) 2015 by Ricardo SIGNES.
This is free software, licensed under:
......
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.012.
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.041.
Changes
LICENSE
MANIFEST
......@@ -10,7 +10,8 @@ dist.ini
lib/IO/TieCombine.pm
lib/IO/TieCombine/Handle.pm
lib/IO/TieCombine/Scalar.pm
t/000-report-versions-tiny.t
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/basic.t
xt/author/pod-syntax.t
xt/release/changes_has_content.t
xt/release/pod-syntax.t
This diff is collapsed.
This diff is collapsed.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.012.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.041.
use strict;
use warnings;
use ExtUtils::MakeMaker 6.30;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "produce tied (and other) separate but combined variables",
"AUTHOR" => "Ricardo SIGNES <rjbs\@cpan.org>",
"BUILD_REQUIRES" => {},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30"
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "IO-TieCombine",
"EXE_FILES" => [],
"LICENSE" => "perl",
"NAME" => "IO::TieCombine",
"PREREQ_PM" => {
......@@ -27,9 +22,11 @@ my %WriteMakefileArgs = (
"warnings" => 0
},
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"Test::More" => "0.96"
},
"VERSION" => "1.004",
"VERSION" => "1.005",
"test" => {
"TESTS" => "t/*.t"
}
......@@ -38,6 +35,8 @@ my %WriteMakefileArgs = (
my %FallbackPrereqs = (
"Carp" => 0,
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"Symbol" => 0,
"Test::More" => "0.96",
"strict" => 0,
......@@ -55,6 +54,3 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
This archive contains the distribution IO-TieCombine,
version 1.004:
version 1.005:
produce tied (and other) separate but combined variables
This software is copyright (c) 2014 by Ricardo SIGNES.
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This README file was generated by Dist::Zilla::Plugin::Readme v5.012.
This README file was generated by Dist::Zilla::Plugin::Readme v5.041.
......@@ -2,61 +2,61 @@ use strict;
use warnings;
package IO::TieCombine;
# ABSTRACT: produce tied (and other) separate but combined variables
$IO::TieCombine::VERSION = '1.004';
$IO::TieCombine::VERSION = '1.005';
use Carp ();
use IO::TieCombine::Handle;
use IO::TieCombine::Scalar;
use Symbol ();
# =head1 SYNOPSIS
#
# First, we set up a bunch of access points:
#
# my $hub = IO::TieCombine->new;
#
# my $str_ref = $hub->scalar_ref('x');
# my $fh = $hub->fh('x');
# my $callback = $hub->callback('x');
#
# tie my $scalar, $hub, 'x';
# tie local *STDOUT, $hub, 'x';
#
# tie local *STDERR, $hub, 'err';
#
# Then we write to things:
#
# $$str_ref .= 'And ';
# print $fh "now ";
# $callback->('for ');
# $scalar .= 'something ';
# print "completely ";
# warn "different.\n";
#
# And then:
#
# $hub->combined_contents; # And now for something completely different.
# $hub->slot_contents('x'); # And now for something completely
# $hub->slot_contents('err'); # different.
#
# B<ACHTUNG!!> Because of a serious problem with Perl 5.10.0, output sent to a
# tied filehandle using C<say> B<will not have the expected newline>. 5.10.1 or
# later is needed. Since 5.10.0 is broken in so many other ways, you should
# really upgrade anyway.
#
# B<ACHTUNG!!> Because of a different problem with Perls 5.10.1 - 5.16.3, if you
# send output to a tied filehandle using C<say>, and C<$\> is undefined (which is
# the default), B<< C<$\> will not be restored to C<undef> after the C<say> >>!
# This means that once you've used C<say> to print to I<any> tied filehandle, you
# have corrupted the global state of your program. Either start your program by
# setting C<$\> to an empty string, which should be safe, or upgrade to 5.18.0.
#
# =cut
# =method new
#
# The constructor takes no arguments.
#
# =cut
#pod =head1 SYNOPSIS
#pod
#pod First, we set up a bunch of access points:
#pod
#pod my $hub = IO::TieCombine->new;
#pod
#pod my $str_ref = $hub->scalar_ref('x');
#pod my $fh = $hub->fh('x');
#pod my $callback = $hub->callback('x');
#pod
#pod tie my $scalar, $hub, 'x';
#pod tie local *STDOUT, $hub, 'x';
#pod
#pod tie local *STDERR, $hub, 'err';
#pod
#pod Then we write to things:
#pod
#pod $$str_ref .= 'And ';
#pod print $fh "now ";
#pod $callback->('for ');
#pod $scalar .= 'something ';
#pod print "completely ";
#pod warn "different.\n";
#pod
#pod And then:
#pod
#pod $hub->combined_contents; # And now for something completely different.
#pod $hub->slot_contents('x'); # And now for something completely
#pod $hub->slot_contents('err'); # different.
#pod
#pod B<ACHTUNG!!> Because of a serious problem with Perl 5.10.0, output sent to a
#pod tied filehandle using C<say> B<will not have the expected newline>. 5.10.1 or
#pod later is needed. Since 5.10.0 is broken in so many other ways, you should
#pod really upgrade anyway.
#pod
#pod B<ACHTUNG!!> Because of a different problem with Perls 5.10.1 - 5.16.3, if you
#pod send output to a tied filehandle using C<say>, and C<$\> is undefined (which is
#pod the default), B<< C<$\> will not be restored to C<undef> after the C<say> >>!
#pod This means that once you've used C<say> to print to I<any> tied filehandle, you
#pod have corrupted the global state of your program. Either start your program by
#pod setting C<$\> to an empty string, which should be safe, or upgrade to 5.18.0.
#pod
#pod =cut
#pod =method new
#pod
#pod The constructor takes no arguments.
#pod
#pod =cut
sub new {
my ($class) = @_;
......@@ -69,24 +69,24 @@ sub new {
bless $self => $class;
}
# =method combined_contents
#
# This method returns the contents of all collected data.
#
# =cut
#pod =method combined_contents
#pod
#pod This method returns the contents of all collected data.
#pod
#pod =cut
sub combined_contents {
my ($self) = @_;
return ${ $self->{combined} };
}
# =method slot_contents
#
# my $str = $hub->slot_contents( $slot_name );
#
# This method returns the contents of all collected data for the named slot.
#
# =cut
#pod =method slot_contents
#pod
#pod my $str = $hub->slot_contents( $slot_name );
#pod
#pod This method returns the contents of all collected data for the named slot.
#pod
#pod =cut
sub slot_contents {
my ($self, $name) = @_;
......@@ -115,13 +115,13 @@ sub _tie_args {
};
}
# =method clear_slot
#
# $hub->clear_slot( $slot_name );
#
# This sets the slot back to an empty string.
#
# =cut
#pod =method clear_slot
#pod
#pod $hub->clear_slot( $slot_name );
#pod
#pod This sets the slot back to an empty string.
#pod
#pod =cut
sub clear_slot {
my ($self, $slot_name) = @_;
......@@ -129,14 +129,14 @@ sub clear_slot {
return;
}
# =method fh
#
# my $fh = $hub->fh( $slot_name );
#
# This method returns a reference to a tied filehandle. When printed to, output
# is collected in the named slot.
#
# =cut
#pod =method fh
#pod
#pod my $fh = $hub->fh( $slot_name );
#pod
#pod This method returns a reference to a tied filehandle. When printed to, output
#pod is collected in the named slot.
#pod
#pod =cut
sub fh {
my ($self, $name) = @_;
......@@ -159,15 +159,15 @@ sub _tie_fh_args {
return ('IO::TieCombine::Handle', $self->_tie_args($name));
}
# =method scalar_ref
#
# my $str_ref = $hub->scalar_ref( $slot_name );
#
# This method returns a reference to scalar. When appended to, the new content
# is collected in the named slot. Attempting to alter the string other than by
# adding new content to its end will result in an exception.
#
# =cut
#pod =method scalar_ref
#pod
#pod my $str_ref = $hub->scalar_ref( $slot_name );
#pod
#pod This method returns a reference to scalar. When appended to, the new content
#pod is collected in the named slot. Attempting to alter the string other than by
#pod adding new content to its end will result in an exception.
#pod
#pod =cut
sub scalar_ref {
my ($self, $name) = @_;
......@@ -188,11 +188,11 @@ sub _tie_scalar_args {
return ('IO::TieCombine::Scalar', $self->_tie_args($name));
}
# =method callback
#
# my $code = $hub->callback( $slot_name );
#
# =cut
#pod =method callback
#pod
#pod my $code = $hub->callback( $slot_name );
#pod
#pod =cut
sub callback {
my ($self, $name) = @_;
......@@ -219,7 +219,7 @@ IO::TieCombine - produce tied (and other) separate but combined variables
=head1 VERSION
version 1.004
version 1.005
=head1 SYNOPSIS
......@@ -310,7 +310,7 @@ Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Ricardo SIGNES.
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
......@@ -2,7 +2,7 @@ use strict;
use warnings;
package IO::TieCombine::Handle;
# ABSTRACT: tied filehandles for IO::TieCombine
$IO::TieCombine::Handle::VERSION = '1.004';
$IO::TieCombine::Handle::VERSION = '1.005';
use Carp ();
sub TIEHANDLE {
......@@ -37,7 +37,7 @@ sub PRINTF {
sub OPEN { return $_[0] }
sub BINMODE { return 1; }
sub FILENO { return 0 + $_[0] }
sub FILENO { return 0 - $_[0] }
1;
......@@ -53,7 +53,7 @@ IO::TieCombine::Handle - tied filehandles for IO::TieCombine
=head1 VERSION
version 1.004
version 1.005
=head1 AUTHOR
......@@ -61,7 +61,7 @@ Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Ricardo SIGNES.
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
......@@ -2,7 +2,7 @@ use strict;
use warnings;
package IO::TieCombine::Scalar;
# ABSTRACT: tied scalars for IO::TieCombine
$IO::TieCombine::Scalar::VERSION = '1.004';
$IO::TieCombine::Scalar::VERSION = '1.005';
use Carp ();
sub TIESCALAR {
......@@ -49,7 +49,7 @@ IO::TieCombine::Scalar - tied scalars for IO::TieCombine
=head1 VERSION
version 1.004
version 1.005
=head1 AUTHOR
......@@ -57,7 +57,7 @@ Ricardo SIGNES <rjbs@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Ricardo SIGNES.
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......
do { my $x = {
'configure' => {
'requires' => {
'ExtUtils::MakeMaker' => '0'
}
},
'develop' => {
'requires' => {
'Test::More' => '0',
'Test::Pod' => '1.41'
}
},
'runtime' => {
'requires' => {
'Carp' => '0',
'Symbol' => '0',
'strict' => '0',
'warnings' => '0'
}
},
'test' => {
'recommends' => {
'CPAN::Meta' => '2.120900'
},
'requires' => {
'ExtUtils::MakeMaker' => '0',
'File::Spec' => '0',
'Test::More' => '0.96'
}
}
};
$x;
}
\ No newline at end of file
#!perl
use strict;
use warnings;
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.021
use Test::More tests => 1;
use ExtUtils::MakeMaker;
use File::Spec;
# from $version::LAX
my $lax_version_re =
qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
|
(?:\.[0-9]+) (?:_[0-9]+)?
) | (?:
v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
|
(?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
)
)/x;
# hide optional CPAN::Meta modules from prereq scanner
# and check if they are available
my $cpan_meta = "CPAN::Meta";
my $cpan_meta_pre = "CPAN::Meta::Prereqs";
my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
# Verify requirements?
my $DO_VERIFY_PREREQS = 1;
sub _max {
my $max = shift;
$max = ( $_ > $max ) ? $_ : $max for @_;
return $max;
}
sub _merge_prereqs {
my ($collector, $prereqs) = @_;
# CPAN::Meta::Prereqs object
if (ref $collector eq $cpan_meta_pre) {
return $collector->with_merged_prereqs(
CPAN::Meta::Prereqs->new( $prereqs )
);
}
# Raw hashrefs
for my $phase ( keys %$prereqs ) {
for my $type ( keys %{ $prereqs->{$phase} } ) {
for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
$collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
}
}
}
return $collector;
}
my @include = qw(
);
my @exclude = qw(
);
# Add static prereqs to the included modules list
my $static_prereqs = do 't/00-report-prereqs.dd';
# Merge all prereqs (either with ::Prereqs or a hashref)
my $full_prereqs = _merge_prereqs(
( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
$static_prereqs
);
# Add dynamic prereqs to the included modules list (if we can)
my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
if ( $source && $HAS_CPAN_META ) {
if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {
$full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
}
}
else {
$source = 'static metadata';
}
my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
}
for my $phase ( qw(configure build test runtime develop other) ) {
next unless $req_hash->{$phase};
next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
for my $type ( qw(requires recommends suggests conflicts modules) ) {
next unless $req_hash->{$phase}{$type};
my $title = ucfirst($phase).' '.ucfirst($type);
my @reports = [qw/Module Want Have/];
for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
next if $mod eq 'perl';
next if grep { $_ eq $mod } @exclude;
my $file = $mod;
$file =~ s{::}{/}g;
$file .= ".pm";
my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
my $want = $req_hash->{$phase}{$type}{$mod};
$want = "undef" unless defined $want;
$want = "any" if !$want && $want == 0;
my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
if ($prefix) {
my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
if ( $have !~ /\A$lax_version_re\z/ ) {
push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
}
elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
push @dep_errors, "$mod version '$have' is not in required range '$want'";
}
}
}
else {
push @reports, [$mod, $want, "missing"];
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
push @full_reports, "\n";
}
}
}
if ( @full_reports ) {
diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
}
if ( @dep_errors ) {
diag join("\n",
"\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n",
"The following REQUIRED prerequisites were not satisfied:\n",
@dep_errors,
"\n"
);
}
pass;
# vim: ts=4 sts=4 sw=4 et:
use strict;
use warnings;
use Test::More 0.88;
# This is a relatively nice way to avoid Test::NoWarnings breaking our
# expectations by adding extra tests, without using no_plan. It also helps
# avoid any other test module that feels introducing random tests, or even
# test plans, is a nice idea.
our $success = 0;
END { $success && done_testing; }
# List our own version used to generate this
my $v = "\nGenerated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10\n";
eval { # no excuses!
# report our Perl details
my $want = "any version";
$v .= "perl: $] (wanted $want) on $^O from $^X\n\n";
};
defined($@) and diag("$@");
# Now, our module version dependencies:
sub pmver {
my ($module, $wanted) = @_;
$wanted = " (want $wanted)";
my $pmver;
eval "require $module;";
if ($@) {
if ($@ =~ m/Can't locate .* in \@INC/) {
$pmver = 'module not found.';
} else {
diag("${module}: $@");
$pmver = 'died during require.';
}
} else {
my $version;
eval { $version = $module->VERSION; };
if ($@) {
diag("${module}: $@");
$pmver = 'died during VERSION check.';
} elsif (defined $version) {
$pmver = "$version";
} else {
$pmver = '<undef>';
}
}
# So, we should be good, right?
return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n");
}
eval { $v .= pmver('Carp','any version') };
eval { $v .= pmver('ExtUtils::MakeMaker','6.30') };
eval { $v .= pmver('Symbol','any version') };
eval { $v .= pmver('Test::More','0.96') };
eval { $v .= pmver('strict','any version') };
eval { $v .= pmver('warnings','any version') };
# All done.
$v .= <<'EOT';
Thanks for using my code. I hope it works for you.
If not, please try and include this output in the bug report.
That will help me reproduce the issue and solve your problem.
EOT
diag($v);
ok(1, "we really didn't test anything, just reporting data");
$success = 1;
# Work around another nasty module on CPAN. :/
no warnings 'once';
$Template::Test::NO_FLUSH = 1;
exit 0;
#!perl
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
eval "use Test::Pod 1.41";
plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
use Test::Pod 1.41;
all_pod_files_ok();
......@@ -4,7 +4,7 @@ use Test::More tests => 2;
note 'Checking Changes';
my $changes_file = 'Changes';
my $newver = '1.004';
my $newver = '1.005';
my $trial_token = '-TRIAL';
SKIP: {
......