Skip Menu |

This queue is for tickets about the Text-MicroMason CPAN distribution.

Report information
The Basics
Id: 8601
Status: resolved
Priority: 0/
Queue: Text-MicroMason

People
Owner: EVO [...] cpan.org
Requestors: jeremy [...] belent.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.07
Fixed in: (no value)



Subject: dos files and \r\n
Version 1.07 Using a linux system, with files created on a windows system (\r\n end of line markers) fails to strip </%args> and (and other block closing tags) out of the code. (the same files run flawlessly in Mason itself) The attached patch should correct this behaviour. BTW, thanks for an excellent module
--- /usr/local/share/perl/5.8.4/Text/MicroMason.pm 2003-09-26 18:26:59.000000000 -0400 +++ MicroMason.pm 2004-11-24 17:03:13.000000000 -0500 @@ -81,19 +81,19 @@ $_ } elsif ( s/\A\<\%perl\>// ) { # Blocks in <%perl> ... <%perl> tags. - s/\<\/\%perl\>\Z// and $_ + s/\<\/\%perl\>(?:\r\n|\Z)// and $_ } elsif ( s/\A\<\%init\>// ) { # Blocks in <%init> ... <%init> tags get moved up to start of sub - s/\<\/\%init\>\Z// and unshift(@code, "$_;") and () + s/\<\/\%init\>(?:\r\n|\Z)// and unshift(@code, "$_;") and () } elsif ( s/\A\<\%cleanup\>// ) { # Blocks in <%cleanup> ... <%cleanup> tags get moved down to end of sub - s/\<\/\%cleanup\>\Z// and unshift(@post, "$_;") and () + s/\<\/\%cleanup\>(?:\r\n|\Z)// and unshift(@post, "$_;") and () } elsif ( s/\A\<\%once\>// ) { # Blocks in <%once> ... <%once> tags get moved up above the sub - s/\<\/\%once\>\Z// and unshift(@pre, "$_;") and () + s/\<\/\%once\>(?:\r\n|\Z)// and unshift(@pre, "$_;") and () } elsif ( s/\A\<\%args\>// ) { # Blocks in <%args> ... <%args> tags. - s/\<\/\%args\>\Z//; + s/\<\/\%args\>(?:\r\n|\Z)//; s/^\s*([\$\@\%])(\w+) (?:\s* => \s* ([^\r\n]+))?/ "my $1$2 = exists \$ARGS{$2} ? " . ( ($1 eq '$') ? "\$ARGS{$2}" : "$1\{ \$ARGS{$2} }" ) . " : " .
[guest - Wed Nov 24 17:15:07 2004]: Show quoted text
> Using a linux system, with files created on a windows system (\r\n > end of line markers) fails to strip </%args> (and other block > closing tags) out of the code.
This should be fixed in the current 1.97 release, which now accepts any of \r\n|\r|\n|\z as a line ending. Please let me know if the problem is not resolved. Thanks for the feedback, -Simon