r59517 - in /trunk/libtest-eol-perl: ./ debian/ inc/ lib/Test/ t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Fri Jun 18 22:18:04 UTC 2010
Author: gregoa
Date: Fri Jun 18 22:17:58 2010
New Revision: 59517
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59517
Log:
New upstream release.
Added:
trunk/libtest-eol-perl/LICENSE
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/LICENSE
trunk/libtest-eol-perl/META.json
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/META.json
trunk/libtest-eol-perl/dist.ini
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/dist.ini
trunk/libtest-eol-perl/t/00-compile.t
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/t/00-compile.t
trunk/libtest-eol-perl/t/release-no-tabs.t
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/t/release-no-tabs.t
trunk/libtest-eol-perl/t/release-pod-coverage.t
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/t/release-pod-coverage.t
trunk/libtest-eol-perl/t/release-pod-syntax.t
- copied unchanged from r59516, branches/upstream/libtest-eol-perl/current/t/release-pod-syntax.t
Removed:
trunk/libtest-eol-perl/inc/
trunk/libtest-eol-perl/t/00-load.t
trunk/libtest-eol-perl/t/04-pod.t
trunk/libtest-eol-perl/t/05-pod-coverage.t
Modified:
trunk/libtest-eol-perl/Changes
trunk/libtest-eol-perl/MANIFEST
trunk/libtest-eol-perl/META.yml
trunk/libtest-eol-perl/Makefile.PL
trunk/libtest-eol-perl/README
trunk/libtest-eol-perl/debian/changelog
trunk/libtest-eol-perl/lib/Test/EOL.pm
trunk/libtest-eol-perl/t/12-fail.t
Modified: trunk/libtest-eol-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/Changes?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/Changes (original)
+++ trunk/libtest-eol-perl/Changes Fri Jun 18 22:17:58 2010
@@ -1,4 +1,16 @@
Revision history for Test-EOL
+
+0.9 2010-06-16
+ - Fix warnings on very old perls (paul at city-fan.org)
+ (Closes: RT#58442)
+
+0.8 2010-06-11
+ - Use binmode :raw for input/output. Solves win32 translating the
+ \r\n character into \n's silently during input (Kent Fredric).
+ - Add an ( currently undocumeted ) all_reasons option to show
+ every line that is broken (Kent Fredric).
+ - Add visualising of invisible characters that match the regex
+ (Kent Fredric).
0.7 2010-03-03
- Deal correctly with -I includes paths that include spaces in the
Modified: trunk/libtest-eol-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/MANIFEST?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/MANIFEST (original)
+++ trunk/libtest-eol-perl/MANIFEST Fri Jun 18 22:17:58 2010
@@ -1,19 +1,15 @@
Changes
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+dist.ini
lib/Test/EOL.pm
-Makefile.PL
-MANIFEST This list of files
-META.yml
-README
-t/00-load.t
-t/04-pod.t
-t/05-pod-coverage.t
+t/00-compile.t
t/11-all.t
t/12-fail.t
+t/release-no-tabs.t
+t/release-pod-coverage.t
+t/release-pod-syntax.t
Modified: trunk/libtest-eol-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/META.yml?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/META.yml (original)
+++ trunk/libtest-eol-perl/META.yml Fri Jun 18 22:17:58 2010
@@ -2,28 +2,153 @@
abstract: 'Check the correct line endings in your project'
author:
- 'Tomas Doran <bobtfish at bobtfish.net>'
+ - "Arthur Axel 'fREW' Schmidt <frioux at gmail.com>"
+ - 'Kent Fredric <kentfredric at gmail.com>'
+ - 'Florian Ragwitz <rafl at debian.org>'
build_requires:
- ExtUtils::MakeMaker: 6.42
+ File::Temp: 0
+ Test::More: 0
configure_requires:
- ExtUtils::MakeMaker: 6.42
-distribution_type: module
-generated_by: 'Module::Install version 0.910'
+ ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101600'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Test-EOL
-no_index:
- directory:
- - inc
- - t
requires:
File::Find: 0
File::Spec: 0
FindBin: 0
Test::Builder: 0
- Test::More: 0
+ vars: 0
resources:
- license: http://dev.perl.org/licenses/
- repository: git://github.com/bobtfish/perl-test-eol.git
-version: 0.7
+ bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Test-EOL
+ homepage: http://search.cpan.org/dist/Test-EOL
+ repository: git://git.shadowcat.co.uk/catagits/Test-EOL.git
+version: 0.9
+x_Dist_Zilla:
+ plugins:
+ -
+ class: Dist::Zilla::Plugin::GatherDir
+ name: '@Filter/@Basic/GatherDir'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::PruneCruft
+ name: '@Filter/@Basic/PruneCruft'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::ManifestSkip
+ name: '@Filter/@Basic/ManifestSkip'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::MetaYAML
+ name: '@Filter/@Basic/MetaYAML'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::License
+ name: '@Filter/@Basic/License'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::Readme
+ name: '@Filter/@Basic/Readme'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::ExtraTests
+ name: '@Filter/@Basic/ExtraTests'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::ExecDir
+ name: '@Filter/@Basic/ExecDir'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::ShareDir
+ name: '@Filter/@Basic/ShareDir'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::MakeMaker
+ name: '@Filter/@Basic/MakeMaker'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::Manifest
+ name: '@Filter/@Basic/Manifest'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::TestRelease
+ name: '@Filter/@Basic/TestRelease'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::ConfirmRelease
+ name: '@Filter/@Basic/ConfirmRelease'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::UploadToCPAN
+ name: '@Filter/@Basic/UploadToCPAN'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::MetaConfig
+ name: '@Filter/MetaConfig'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::MetaJSON
+ name: '@Filter/MetaJSON'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::PkgVersion
+ name: '@Filter/PkgVersion'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::PodSyntaxTests
+ name: '@Filter/PodSyntaxTests'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::NoTabsTests
+ name: '@Filter/NoTabsTests'
+ version: 0.01
+ -
+ class: Dist::Zilla::Plugin::PodCoverageTests
+ name: '@Filter/PodCoverageTests'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::MetaResources
+ name: '@Filter/MetaResources'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::Authority
+ name: '@Filter/Authority'
+ version: 1.000
+ -
+ class: Dist::Zilla::Plugin::PodWeaver
+ name: '@Filter/PodWeaver'
+ version: 3.101530
+ -
+ class: Dist::Zilla::Plugin::AutoPrereq
+ name: '@Filter/AutoPrereq'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::CompileTests
+ name: CompileTests
+ version: 1.101600
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':InstallModules'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':TestFiles'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ExecFiles'
+ version: 4.101612
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':ShareFiles'
+ version: 4.101612
+ zilla:
+ class: Dist::Zilla
+ config:
+ is_trial: 0
+ version: 4.101612
+x_authority: cpan:FLORA
Modified: trunk/libtest-eol-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/Makefile.PL?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/Makefile.PL (original)
+++ trunk/libtest-eol-perl/Makefile.PL Fri Jun 18 22:17:58 2010
@@ -1,21 +1,58 @@
-use inc::Module::Install 0.78;
-name 'Test-EOL';
-license 'perl';
-author 'Tomas Doran <bobtfish at bobtfish.net>';
+use strict;
+use warnings;
-all_from 'lib/Test/EOL.pm';
-requires 'Test::More';
-requires 'Test::Builder';
-requires 'File::Spec';
-requires 'FindBin';
-requires 'File::Find';
-resources repository => 'git://github.com/bobtfish/perl-test-eol.git';
-if ($Module::Install::AUTHOR) {
- system("pod2text lib/Test/EOL.pm > README") and die;
+use ExtUtils::MakeMaker 6.31;
+
+
+
+my %WriteMakefileArgs = (
+ 'ABSTRACT' => 'Check the correct line endings in your project',
+ 'AUTHOR' => 'Tomas Doran <bobtfish at bobtfish.net>, Arthur Axel \'fREW\' Schmidt <frioux at gmail.com>, Kent Fredric <kentfredric at gmail.com>, Florian Ragwitz <rafl at debian.org>',
+ 'BUILD_REQUIRES' => {
+ 'File::Temp' => '0',
+ 'Test::More' => '0'
+ },
+ 'CONFIGURE_REQUIRES' => {
+ 'ExtUtils::MakeMaker' => '6.31'
+ },
+ 'DISTNAME' => 'Test-EOL',
+ 'EXE_FILES' => [],
+ 'LICENSE' => 'perl',
+ 'NAME' => 'Test::EOL',
+ 'PREREQ_PM' => {
+ 'File::Find' => '0',
+ 'File::Spec' => '0',
+ 'FindBin' => '0',
+ 'Test::Builder' => '0',
+ 'vars' => '0'
+ },
+ 'VERSION' => '0.9',
+ 'test' => {
+ 'TESTS' => 't/*.t'
+ }
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+ my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
+ for my $mod ( keys %$br ) {
+ if ( exists $pp->{$mod} ) {
+ $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+ }
+ else {
+ $pp->{$mod} = $br->{$mod};
+ }
+ }
}
-WriteAll;
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+WriteMakefile(%WriteMakefileArgs);
+
+
+
Modified: trunk/libtest-eol-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/README?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/README (original)
+++ trunk/libtest-eol-perl/README Fri Jun 18 22:17:58 2010
@@ -1,92 +1,13 @@
-NAME
- Test::EOL - Check the correct line endings in your project
-SYNOPSIS
- "Test::EOL" lets you check the presence of windows line endings in your
- perl code. It report its results in standard "Test::Simple" fashion:
- use Test::EOL tests => 1;
- eol_unix_ok( 'lib/Module.pm', 'Module is ^M free');
+This archive contains the distribution Test-EOL,
+version 0.9:
- and to add checks for trailing whitespace:
+ Check the correct line endings in your project
- use Test::EOL tests => 1;
- eol_unix_ok( 'lib/Module.pm', 'Module is ^M and trailing whitespace free', { trailing_whitespace => 1 });
+This software is copyright (c) 2010 by Tomas Doran.
- Module authors can include the following in a t/eol.t and have
- "Test::EOL" automatically find and check all perl files in a module
- distribution:
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
- use Test::EOL;
- all_perl_files_ok();
- or
-
- use Test::EOL;
- all_perl_files_ok( @mydirs );
-
- and if authors would like to check for trailing whitespace:
-
- use Test::EOL;
- all_perl_files_ok({ trailing_whitespace => 1 });
-
- or
-
- use Test::EOL;
- all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
-
-DESCRIPTION
- This module scans your project/distribution for any perl files (scripts,
- modules, etc) for the presence of windows line endings.
-
-EXPORT
- A list of functions that can be exported. You can delete this section if
- you don't export anything, such as for a purely object-oriented module.
-
-FUNCTIONS
- all_perl_files_ok( [ \%options ], [ @directories ] )
- Applies "eol_unix_ok()" to all perl files found in @directories (and sub
- directories). If no <@directories> is given, the starting point is one
- level above the current running script, that should cover all the files
- of a typical CPAN distribution. A perl file is *.pl or *.pm or *.t or a
- file starting with "#!...perl"
-
- If the test plan is defined:
-
- use Test::EOL tests => 3;
- all_perl_files_ok();
-
- the total number of files tested must be specified.
-
- eol_unix_ok( $file [, $text] [, \%options ] )
- Run a unix EOL check on $file. For a module, the path (lib/My/Module.pm)
- or the name (My::Module) can be both used.
-
-AUTHOR
- Tomas Doran (t0m) "<bobtfish at bobtfish.net>"
-
-BUGS
- Testing for EOL styles other than unix (\n) currently unsupported.
-
- The source code can be found on github, as listed in " META.yml ",
- patches are welcome.
-
- Otherwise please report any bugs or feature requests to "bug-test-eol at
- rt.cpan.org", or through the web interface at
- <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-EOL>. I will be
- notified, and then you'll automatically be notified of progress on your
- bug as I make changes.
-
-ACKNOWLEDGEMENTS
- Shamelessly ripped off from Test::NoTabs.
-
-SEE ALSO
- Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings>,
- Test::NoTabs, Module::Install::AuthorTests.
-
-COPYRIGHT & LICENSE
- Copyright 2009 Tomas Doran, some rights reserved.
-
- This program is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
-
Modified: trunk/libtest-eol-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/debian/changelog?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/debian/changelog (original)
+++ trunk/libtest-eol-perl/debian/changelog Fri Jun 18 22:17:58 2010
@@ -1,3 +1,9 @@
+libtest-eol-perl (0.9-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org> Sat, 19 Jun 2010 00:16:44 +0200
+
libtest-eol-perl (0.7-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libtest-eol-perl/lib/Test/EOL.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/lib/Test/EOL.pm?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/lib/Test/EOL.pm (original)
+++ trunk/libtest-eol-perl/lib/Test/EOL.pm Fri Jun 18 22:17:58 2010
@@ -1,4 +1,11 @@
package Test::EOL;
+BEGIN {
+ $Test::EOL::AUTHORITY = 'cpan:FLORA';
+}
+BEGIN {
+ $Test::EOL::VERSION = '0.9';
+}
+# ABSTRACT: Check the correct line endings in your project
use strict;
use warnings;
@@ -8,9 +15,7 @@
use FindBin qw($Bin);
use File::Find;
-use vars qw( $VERSION $PERL $UNTAINT_PATTERN $PERL_PATTERN);
-
-$VERSION = '0.7';
+use vars qw( $PERL $UNTAINT_PATTERN $PERL_PATTERN);
$PERL = $^X || 'perl';
$UNTAINT_PATTERN = qr|^([-+@\w./:\\]+)$|;
@@ -62,6 +67,29 @@
return @found;
}
+# Formats various human invisible symbols
+# to similar visible ones.
+# Perhaps ^M or something like that
+# would be more appropriate?
+
+sub _show_whitespace {
+ my $string = shift;
+ $string =~ s/\r/[\\r]/g;
+ $string =~ s/\t/[\\t]/g;
+ $string =~ s/ /[\\s]/g;
+ return $string;
+}
+
+# Format a line record for diagnostics.
+
+sub _debug_line {
+ my ( $options, $line ) = @_;
+ $line->[2] =~ s/\n\z//g;
+ return "line $line->[1] : $line->[0] " . (
+ $options->{show_lines} ? qq{: } . _show_whitespace( $line->[2] ) : q{}
+ );
+}
+
sub eol_unix_ok {
my $file = shift;
my $test_txt;
@@ -70,19 +98,38 @@
my $options = shift if ref $_[0] eq 'HASH';
$options ||= {
trailing_whitespace => 0,
+ all_reasons => 0,
};
$file = _module_to_path($file);
+
open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; };
+ # Windows-- , default is :crlf, which hides \r\n -_-
+ binmode( $fh, ':raw:utf8' );
my $line = 0;
+ my @fails;
while (<$fh>) {
$line++;
- if (
- (!$options->{trailing_whitespace} && /\r$/) ||
- ( $options->{trailing_whitespace} && /(\r|[ \t]+)$/)
- ) {
- $Test->ok(0, $test_txt . " on line $line");
- return 0;
+ if ( !$options->{trailing_whitespace} && /(\r+)$/ ) {
+ my $match = $1;
+ push @fails, [ _show_whitespace( $match ) , $line , $_ ];
}
+ if ( $options->{trailing_whitespace} && /([ \t]*\r+|[ \t]+)$/ ) {
+ my $match = $1;
+ push @fails, [ _show_whitespace($match), $line , $_ ];
+ }
+ # Minor short-circuit for people who don't need the whole file scanned
+ # once there's an err.
+ last if( @fails > 0 && !$options->{all_reasons} );
+ }
+ if( @fails ){
+ $Test->ok( 0, $test_txt . " on " . _debug_line({ show_lines => 0 } , $fails[0] ) );
+ if ( $options->{all_reasons} || 1 ){
+ $Test->diag( " Problem Lines: ");
+ for ( @fails ){
+ $Test->diag(_debug_line({ show_lines => 1 } , $_ ) );
+ }
+ }
+ return 0;
}
$Test->ok(1, $test_txt);
return 1;
@@ -104,7 +151,7 @@
my $file = shift;
return 1 if $file =~ /\.pl$/i;
return 1 if $file =~ /\.t$/;
- open my $fh, $file or return;
+ open (my $fh, $file) or return;
my $first = <$fh>;
return 1 if defined $first && ($first =~ $PERL_PATTERN);
return;
@@ -136,7 +183,12 @@
}
1;
+
+
__END__
+=pod
+
+=encoding utf-8
=head1 NAME
@@ -181,11 +233,6 @@
This module scans your project/distribution for any perl files (scripts,
modules, etc) for the presence of windows line endings.
-
-=head1 EXPORT
-
-A list of functions that can be exported. You can delete this section
-if you don't export anything, such as for a purely object-oriented module.
=head1 FUNCTIONS
@@ -209,22 +256,10 @@
Run a unix EOL check on C<$file>. For a module, the path (lib/My/Module.pm) or the
name (My::Module) can be both used.
-=head1 AUTHOR
-
-Tomas Doran (t0m) C<< <bobtfish at bobtfish.net> >>
-
-=head1 BUGS
-
-Testing for EOL styles other than unix (\n) currently unsupported.
-
-The source code can be found on github, as listed in C< META.yml >,
-patches are welcome.
-
-Otherwise please report any bugs or feature requests to
-C<bug-test-eol at rt.cpan.org>, or through the web interface at
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-EOL>.
-I will be notified, and then you'll automatically be notified of progress on
-your bug as I make changes.
+=head1 EXPORT
+
+A list of functions that can be exported. You can delete this section
+if you don't export anything, such as for a purely object-oriented module.
=head1 ACKNOWLEDGEMENTS
@@ -235,12 +270,34 @@
L<Test::More>, L<Test::Pod>. L<Test::Distribution>, L<Test:NoWarnings>,
L<Test::NoTabs>, L<Module::Install::AuthorTests>.
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2009 Tomas Doran, some rights reserved.
-
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Tomas Doran <bobtfish at bobtfish.net>
+
+=item *
+
+Arthur Axel 'fREW' Schmidt <frioux at gmail.com>
+
+=item *
+
+Kent Fredric <kentfredric at gmail.com>
+
+=item *
+
+Florian Ragwitz <rafl at debian.org>
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2010 by Tomas Doran.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
=cut
Modified: trunk/libtest-eol-perl/t/12-fail.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-eol-perl/t/12-fail.t?rev=59517&op=diff
==============================================================================
--- trunk/libtest-eol-perl/t/12-fail.t (original)
+++ trunk/libtest-eol-perl/t/12-fail.t Fri Jun 18 22:17:58 2010
@@ -3,11 +3,19 @@
use Test::More qw(no_plan);
use File::Temp qw( tempdir tempfile );
-
my $perl = $^X || 'perl';
my $inc = join(' -I ', map { qq{"$_"} } @INC) || '';
$inc = "-I $inc" if $inc;
+{
+ my ( $dir, $filename ) = make_raw_badfile();
+ local $/ = undef;
+ open my $fh, '<', $filename or die $!;
+ binmode( $fh, ':raw' );
+ my $content = <$fh>;
+ is( $content, ascii_string(), 'Data written to file is there when we look for it later' );
+
+}
{
my $dir = make_bad_file_1();
my (undef, $outfile) = tempfile();
@@ -50,22 +58,41 @@
unlink $outfile;
}
+sub ascii_string {
+ my $o = "<before \r\n between \r\n after \n normal >";
+ return $o x 3;
+}
+
+sub make_raw_badfile {
+ my $tmpdir = tempdir( CLEANUP => 1 );
+ my ( $fh, $filename ) = tempfile( DIR => $tmpdir, SUFFIX => '.tXt' );
+ binmode $fh, ':raw:utf8';
+ print $fh ascii_string();
+ close $fh;
+ return ( $tmpdir, $filename );
+}
+
+
sub make_bad_file_1 {
my $tmpdir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
- print $fh <<"DUMMY";
+ binmode $fh, ':raw:utf8';
+ my $str = <<"DUMMY";
#!perl
sub main {
print "Hello!\r\n";
}
DUMMY
+ print $fh $str;
+
return $tmpdir;
}
sub make_bad_file_2 {
my $tmpdir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
+ binmode $fh, ':raw:utf8';
print $fh <<"DUMMY";
#!perl
@@ -87,6 +114,7 @@
sub make_bad_file_3 {
my $tmpdir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pm' );
+ binmode $fh, ':raw:utf8';
print $fh <<"DUMMY";
use strict;
@@ -108,6 +136,7 @@
sub make_bad_file_4 {
my $tmpdir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
+ binmode $fh, ':raw:utf8';
print $fh <<"DUMMY";
#!perl
More information about the Pkg-perl-cvs-commits
mailing list