Changeset 224

Show
Ignore:
Timestamp:
08/30/01 14:16:40
Author:
miyagawa
Message:

binary <=> number handled via pack/unpack

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • HTML-Entities-ImodePictogram/trunk/Changes

    r221 r224  
    11Revision history for Perl extension HTML::Entities::ImodePictogram. 
     2 
     30.03  Thu Aug 30 14:14:15 JST 2001 
     4        - binary <=> number now handled via (un)?pack 
     5          Thanks to SADAHIRO Tomoyuki <BQW10602@nifty.com> 
    26 
    370.02  Thu Aug 30 02:57:02 JST 2001 
  • HTML-Entities-ImodePictogram/trunk/lib/HTML/Entities/ImodePictogram.pm

    r221 r224  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = '0.02'; 
     5$VERSION = '0.03'; 
    66 
    77use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); 
     
    2727        if ($orig_match =~ /^$Pictogram_re$/) { 
    2828            $num_found++; 
    29             $callback->($orig_match, _bin2num($orig_match)); 
     29            $callback->($orig_match, unpack('n', $orig_match)); 
    3030        } 
    3131        else { 
     
    5252            ($2 >= 63808 && $2 <= 63870) || 
    5353            ($2 >= 63872 && $2 <= 63919)) { 
    54             _num2bin($2)
     54            pack 'n', $2
    5555        } 
    5656        else { 
     
    6767                   }); 
    6868    return $text; 
    69 } 
    70  
    71 sub _num2bin { 
    72     my $num = shift; 
    73     my $hex = sprintf '%x', $num; 
    74     $hex =~ s/([0-9a-f]{2})/chr(hex($1))/ge; 
    75     return $hex; 
    76 } 
    77  
    78 sub _bin2num { 
    79     my $bin = shift; 
    80     $bin =~ s/(.)(.)/256 * ord($1) + ord($2)/eg; 
    81     return $bin; 
    8269} 
    8370