home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / Iconv.pm < prev    next >
Encoding:
Perl POD Document  |  2003-09-16  |  2.6 KB  |  93 lines

  1. package Text::Iconv;
  2. # @(#) $Id: Iconv.pm,v 1.2 2003/09/16 18:16:45 joker Exp $
  3. # Copyright (c) 2000 Michael Piotrowski
  4.  
  5. use strict;
  6. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
  7.  
  8. require Exporter;
  9. require DynaLoader;
  10. require AutoLoader;
  11.  
  12. @ISA = qw(Exporter AutoLoader DynaLoader);
  13. # Items to export into callers namespace by default. Note: do not export
  14. # names by default without a very good reason. Use EXPORT_OK instead.
  15. # Do not simply export all your public functions/methods/constants.
  16. @EXPORT_OK = qw(
  17.     convert
  18. );
  19. $VERSION = '1.2';
  20.  
  21. bootstrap Text::Iconv $VERSION;
  22.  
  23. # Preloaded methods go here.
  24.  
  25. # Autoload methods go after =cut, and are processed by the autosplit program.
  26.  
  27. 1;
  28. __END__
  29. # Below is the documentation for the module.
  30.  
  31. =head1 NAME
  32.  
  33. Text::Iconv - Perl interface to iconv() codeset conversion function
  34.  
  35. =head1 SYNOPSIS
  36.  
  37.   use Text::Iconv;
  38.   $converter = Text::Iconv->new("fromcode", "tocode");
  39.   $converted = $converter->convert("Text to convert");
  40.  
  41. =head1 DESCRIPTION
  42.  
  43. The B<Text::Iconv> module provides a Perl interface to the iconv()
  44. function as defined by the Single UNIX Specification.  The convert()
  45. method converts the encoding of characters in the input string from
  46. the I<fromcode> codeset to the I<tocode> codeset, and returns the
  47. result.
  48.  
  49. Settings of I<fromcode> and I<tocode> and their permitted combinations
  50. are implementation-dependent.  Valid values are specified in the
  51. system documentation
  52.  
  53. =head1 ERRORS
  54.  
  55. If the conversion can't be initialized an exception is raised (using
  56. croak()).
  57.  
  58. As an experimental feature, this version of I<Text:Iconv> provides a
  59. new class attribute B<raise_error> and a corresponding class method
  60. for setting and getting its value.  The handling of errors during
  61. conversion now depends on the setting of this attribute.  If
  62. B<raise_error> is set to a true value, an exception is raised;
  63. otherwise, the convert() method only returns B<undef>.  By default
  64. B<raise_error> is false.  Warnings are no longer emitted.  Example
  65. usage:
  66.  
  67.   Text::Iconv->raise_error(1);     # Conversion errors raise exceptions
  68.   Text::Iconv->raise_error(0);     # Conversion errors return undef
  69.   $a = Text::Iconv->raise_error(); # Get current setting
  70.  
  71. Consult L<iconv(3)> for details on errors that might occur.
  72.  
  73. Converting undef, e.g.,
  74.  
  75.   $converted = $converter->convert(undef);
  76.  
  77. always returns undef.  This is not considered an error.
  78.  
  79. =head1 NOTES
  80.  
  81. The supported codesets, their names, the supported conversions, and
  82. the quality of the conversions are all system-dependent.
  83.  
  84. =head1 AUTHOR
  85.  
  86. Michael Piotrowski <mxp@dynalabs.de>
  87.  
  88. =head1 SEE ALSO
  89.  
  90. iconv(1), iconv(3)
  91.  
  92. =cut
  93.