From: ndparker <> Date: Sun, 17 Jun 2001 00:58:48 +0000 (+0000) Subject: added version checks, fixed some issues ;) X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/989aad5e517fa5c6e2799dd5d5b096139e404c0c added version checks, fixed some issues ;) --- diff --git a/selfforum-cgi/shared/Encode/Plain.pm b/selfforum-cgi/shared/Encode/Plain.pm index 17c749c..3deb755 100644 --- a/selfforum-cgi/shared/Encode/Plain.pm +++ b/selfforum-cgi/shared/Encode/Plain.pm @@ -17,8 +17,15 @@ use vars qw( %unimap $utf8 $v56 + $VERSION ); +################################################################################ +# +# Version check +# +$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + $v56 = eval {local $SIG{__DIE__}; require 5.6.0;}; ################################################################################ @@ -129,7 +136,6 @@ sub plain ($;$) { if ($except) { $new =~ s/($exreg)|/defined($1)?$1:'>'/eg; - $new =~ s/($exreg)|\|/defined($1)?$1:'|'/eg; $new =~ s/($exreg)|"/defined($1)?$1:'"'/eg; # the big hash @@ -164,7 +170,6 @@ sub plain ($;$) { # $new =~ s//>/g; - $new =~ s/\|/|/g; $new =~ s/"/"/g; # the big hash @@ -225,7 +230,7 @@ sub multiline ($) { # turn \n into
# - $string=~s/\n/
/g; + $string=~s!\n!
!g; # more than 1 space =>   # @@ -234,7 +239,7 @@ sub multiline ($) { # Single Spaces after
=>   # (save ascii arts ;) # - $string=~s/(?:^|(
))\s/($1?$1:'').' '/eg; + $string=~s!(?:^|())\s!($1?$1:'').' '!eg; # return # @@ -255,17 +260,11 @@ sub toUTF8 ($) { ? $$ref : $ref; -# if ($v56) { -# no warnings 'utf8'; -# $string =~ tr/\x80-\xff//CU; -# } -# else { - $string =~ s - {([\x80-\xff])} - { chr((ord ($1) >> 6) | 192) - .chr((ord ($1) & 191)) - }eg; -# } + $string =~ s + {([\x80-\xff])} + { chr((ord ($1) >> 6) | 192) + .chr((ord ($1) & 191)) + }eg; ref($ref) ? \$string @@ -531,4 +530,4 @@ BEGIN { # # -### end of Encode::Plain ####################################################### +### end of Encode::Plain ####################################################### \ No newline at end of file diff --git a/selfforum-cgi/shared/Encode/Posting.pm b/selfforum-cgi/shared/Encode/Posting.pm index 395f71f..4ff9410 100644 --- a/selfforum-cgi/shared/Encode/Posting.pm +++ b/selfforum-cgi/shared/Encode/Posting.pm @@ -11,16 +11,26 @@ package Encode::Posting; ################################################################################ use strict; +use vars qw( + @EXPORT + $VERSION +); use Encode::Plain; $Encode::Plain::utf8 = 1; use CheckRFC; +################################################################################ +# +# Version check +# +$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + ################################################################################ # # Export # use base qw(Exporter); -@Encode::Posting::EXPORT = qw( +@EXPORT = qw( encoded_body answer_field message_field @@ -71,7 +81,7 @@ sub encoded_body ($;$) { my @rawlinks; push @rawlinks => [$1 => $2] while ($posting =~ /\[([Ll][Ii][Nn][Kk]):\s*([^\]\s]+)\s*\]/g); my @links = grep { - is_URL ( $_ -> [1] => ':ALL') + is_URL ( $_ -> [1] => qw(http ftp news nntp telnet gopher mailto)) or is_URL (($_ -> [1] =~ /^[Vv][Ii][Ee][Ww]-[Ss][Oo][Uu][Rr][Cc][Ee]:(.+)/)[0] || '' => 'http') or ( $_ -> [1] =~ m<^(?:\.?\.?/(?!/)|\?)> and is_URL (rel_uri ($_ -> [1], $base) => 'http')) @@ -158,7 +168,7 @@ sub answer_field ($$) { my $area = $$posting; my $qchar = $params -> {quoteChars}; - $area =~ s//\n/g; #
=> \n + $area =~ s//\n/g; #
=> \n $area =~ s/&(?:#160|nbsp);/ /g; # nbsp => ' ' $area =~ s/^(.)/\177$1/gm if ($params -> {quoteArea}); # shift a quoting character @@ -213,7 +223,7 @@ sub message_field ($$) { if ($params -> {quoting}) { # quotes are displayed as special? my @array = [0 => []]; - for (split // => $posting) { + for (split // => $posting) { my $l = length ((/^(\177*)/)[0]); if ($array[-1][0] == $l) { push @{$array[-1][-1]} => $_; @@ -248,4 +258,4 @@ sub message_field ($$) { # # -### end of Encode::Posting ##################################################### +### end of Encode::Posting ##################################################### \ No newline at end of file