Locale::RecodeData(3)
π NAME π
Locale::RecodeData β Abstract Base Class for Charset Converters.
okay so this is the Locale::RecodeData(3) page from User Contributed Perl Documentation, and it's giving abstract base class realness for charset converters. Hi bestie, let's go πβ¨
β¨ SYNOPSIS β¨
bestie, read the comment first β for compatibility with Perl 5.005 and earlier, you must *use* the module before inheriting from it, fr fr.
# For compatibility with Perl 5.005 and earlier, you must
# *use* the module before inheriting from it!
use qw (Locale::RecodeData);
use base qw (Locale::RecodeData);
π¦ DESCRIPTION π¦
The module Locale::RecodeData serves as an abstract base class to all converters used by Locale::Recode(3). Main character energy, honestly π«Ά
Adding new conversion modules is currently not straightforward, and you will have to edit the sources of some modules for that purpose. No cap.
First, you have to add your new converter class to the list found in Locale::_Conversions(3), so that Locale::Recode(3) knows about its presence. If there are valid aliases for the codeset of your converter, you will also have to edit Locale::_Aliases(3).
Finally, you have to implement the (protected) conversion routine _recode(). See below ("INTERFACE") for details. Slay, but protected π
π CONSTRUCTOR π
new (from => FROM_CODESET, to => TO_CODESET)β the constructor takes two (named) arguments:fromβ the canonical name of the source codeset. Aliases have already been resolved and the name is converted to uppercase.toβ the canonical name of the destination codeset. Aliases have already been resolved and the name is converted to uppercase.
You normally don't have to implement the constructor. The default constructor implemented here will store the source and destination codesets in the protected members _from and _to. Cute, lowkey automatic π
πΈ METHODS πΈ
The class implements one method:
_getErrorβ returns the (protected) member_error.
π INTERFACE π
New conversion classes must provide the following interface:
new (from => FROM_CODESET, to => TO_CODESET)β the constructor takes two (named) arguments:fromβ the canonical name of the source codeset. Aliases have already been resolved and the name is converted to uppercase.toβ the canonical name of the destination codeset. Aliases have already been resolved and the name is converted to uppercase.
_getErrorβ should return the last error (as a string) or false if there was no error.
This method is implemented in the base class already. Periodt.
_recode STRINGREFβ should convert the argumentSTRINGREFin-place. In case of failure, return false, and make provisions that the method_getError()returns an informative error message.
π AUTHOR π
Copyright (C) 2002-2017 Guido Flohr http://www.guido-flohr.net/ (<mailto:guido.flohr@cantanea.com>), all rights reserved. See the source code for details!code for details!
π SEE ALSO π
okay that's the whole page, bestie! source/version and date: perl v5.42.0, 2025-01-22, Locale::RecodeData(3) πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- opensuse-leap 16.0: perl-libintl-perl 1.350.0-160000.2.2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms