1package Spreadsheet::ParseExcel::FmtJapan2; 2 3############################################################################### 4# 5# Spreadsheet::ParseExcel::FmtJapan2 - A class for Cell formats. 6# 7# Used in conjunction with Spreadsheet::ParseExcel. 8# 9# Copyright (c) 2014 Douglas Wilson 10# Copyright (c) 2009-2013 John McNamara 11# Copyright (c) 2006-2008 Gabor Szabo 12# Copyright (c) 2000-2006 Kawai Takanori 13# 14# perltidy with standard settings. 15# 16# Documentation after __END__ 17# 18 19use strict; 20use warnings; 21 22use Jcode; 23use Unicode::Map; 24use base 'Spreadsheet::ParseExcel::FmtJapan'; 25our $VERSION = '0.65'; 26 27#------------------------------------------------------------------------------ 28# new (for Spreadsheet::ParseExcel::FmtJapan2) 29#------------------------------------------------------------------------------ 30sub new { 31 my ( $sPkg, %hKey ) = @_; 32 my $oMap = Unicode::Map->new('CP932Excel'); 33 die "NO MAP FILE CP932Excel!!" 34 unless ( -r Unicode::Map->mapping("CP932Excel") ); 35 36 my $oThis = { 37 Code => $hKey{Code}, 38 _UniMap => $oMap, 39 }; 40 bless $oThis; 41 $oThis->SUPER::new(%hKey); 42 return $oThis; 43} 44 45#------------------------------------------------------------------------------ 46# TextFmt (for Spreadsheet::ParseExcel::FmtJapan2) 47#------------------------------------------------------------------------------ 48sub TextFmt { 49 my ( $oThis, $sTxt, $sCode ) = @_; 50 51 # $sCode = 'sjis' if((! defined($sCode)) || ($sCode eq '_native_')); 52 if ( $oThis->{Code} ) { 53 if ( !defined($sCode) ) { 54 $sTxt =~ s/(.)/\x00$1/sg; 55 $sTxt = $oThis->{_UniMap}->from_unicode($sTxt); 56 } 57 elsif ( $sCode eq 'ucs2' ) { 58 $sTxt = $oThis->{_UniMap}->from_unicode($sTxt); 59 } 60 return Jcode::convert( $sTxt, $oThis->{Code}, 'sjis' ); 61 } 62 else { 63 return $sTxt; 64 } 65} 661; 67 68__END__ 69 70=pod 71 72=head1 NAME 73 74Spreadsheet::ParseExcel::FmtJapan2 - A class for Cell formats. 75 76=head1 SYNOPSIS 77 78See the documentation for Spreadsheet::ParseExcel. 79 80=head1 DESCRIPTION 81 82This module is used in conjunction with Spreadsheet::ParseExcel. See the documentation for Spreadsheet::ParseExcel. 83 84=head1 AUTHOR 85 86Current maintainer 0.60+: Douglas Wilson dougw@cpan.org 87 88Maintainer 0.40-0.59: John McNamara jmcnamara@cpan.org 89 90Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org 91 92Original author: Kawai Takanori kwitknr@cpan.org 93 94=head1 COPYRIGHT 95 96Copyright (c) 2014 Douglas Wilson 97 98Copyright (c) 2009-2013 John McNamara 99 100Copyright (c) 2006-2008 Gabor Szabo 101 102Copyright (c) 2000-2006 Kawai Takanori 103 104All rights reserved. 105 106You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. 107 108=cut 109