Hi again Monks,

So I finally got around to troubleshooting one of my module CPAN Testers failures on Windows platforms.

It became clear after a while that the purpose for the failures is that I have sample data files, along with base expected output files for certain tests in my suite. These are breaking because of line endings. I've worked around it in my Makefile.PL file with the following, and I'm just wondering if this is overkill and whether there's a more sane way to make my tests cross-platform. Note that I'm just sweeping the entire /t directory as a test. I'll make the work focus only on the necessary files if there isn't a better way.

if ($^O eq 'MSWin32'){ print "\nPreparing unit tests for MSWin32 platform...\n\n"; my $dir = getcwd(); $dir .= "/t"; my @files; find({wanted => sub { return if ! -f; my $file = $File::Find::name; push @files, $file; }, no_chdir => 1, }, $dir, ); for (@files){ tie my @file, 'Tie::File', $_ or die $!; for (@file){ s/\n/\r\n/g; } untie @file; } }

Cheers,

-stevieb


In reply to CPAN module unit test issues: OS line endings by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.