Server IP : 103.119.228.120 / Your IP : 18.227.209.101 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Locale::Maketext::Utils::Phrase 3" .TH Locale::Maketext::Utils::Phrase 3 "2014-11-18" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Locale::Maketext::Utils::Phrase \- Consolidated Phrase Introspection .SH "VERSION" .IX Header "VERSION" This document describes Locale::Maketext::Utils::Phrase version 0.1 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Locale::Maketext::Utils::Phrase (); \& \& my $struct = Locale::Maketext::Utils::Phrase::phrase2struct( \& "So long, and thanks for [output,strong,all] the fish." \& ); \& \& for my $piece (@{$struct}) { \& if (!ref($piece)) { \& # this $piece is a non\-bracket notation chunk \& } \& else { \& # this $piece is a hashref describing the bracket notation chunk \& } \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is meant to allow you to simplify an already complex task by doing all of the parsing and basic categorization of bracket notation (or lack of \s-1BN\s0) for you. .PP That way you do not have to worry about parsing or matching the syntax/escaping/delimiters/etc correctly and then maintaining it in each place it is used. .SH "INTERFACE" .IX Header "INTERFACE" .SS "Object" .IX Subsection "Object" Eventually the base functions below will be used in an object that can be used for even more complete and fine tuned introspection. .PP For now these functions allow us to do most of what we need with little trouble. .SS "Functions" .IX Subsection "Functions" Terms: .IP "Phrase" 4 .IX Item "Phrase" A string intended to be passed to \fImaketext()\fR that may or may not contain bracket notation. .IP "Struct" 4 .IX Item "Struct" An array ref that represents a parsed phrase. .Sp Each item in that array is either a string (a chunk that is not bracket notation) or a hashref (a chunk that is bracket notation). .Sp The hashref has the following keys: .RS 4 .IP "orig" 4 .IX Item "orig" The value is the original bracket notation string in its entirety. e.g. '[output,strong,NOT]' .IP "cont" 4 .IX Item "cont" The value is the content of the inside of original bracket notation string. e.g. 'output,strong,NOT' .IP "list" 4 .IX Item "list" The value is the original bracket notation in list form. e.g. an array reference containing 'output', 'strong', '\s-1NOT\s0'. .IP "type" 4 .IX Item "type" This is a string defining what general type of bracket notation we’re dealing with: .RS 4 .IP "'var'" 4 .IX Item "'var'" The content is a variable reference (i.e. not translatable). .Sp e.g. [_1] .IP "'meth'" 4 .IX Item "'meth'" The content is a method that shouldn’t have any translatable part. .Sp e.g. [numf,_1] .IP "'basic'" 4 .IX Item "'basic'" The content is a method that can have translatable parts and follows a basic pattern like the first part or two after the method can be a string and the rest can be an arbitrary name/value attribute list. .Sp e.g. [output,strong,foo] .IP "'basic_var'" 4 .IX Item "'basic_var'" The content is 'basic' except every possible translatable part is a variable reference (i.e. not translatable). .Sp e.g. [output,strong,_1] .IP "'complex'" 4 .IX Item "'complex'" The content is more complicated than 'basic'. .IP "'_unknown'" 4 .IX Item "'_unknown'" The content type could not be determined. This is not necessarily an error. It could be a method specific to your object, it could be something this module misses (rt please!). .IP "'_invalid'" 4 .IX Item "'_invalid'" The content type is invalid. .Sp This could be something Locale::Maketext would see as a syntax error (e.g. [\*(L" ,foo\*(R"]) or something it might allow through (on purpose or by happenstance (e.g. [])) but is ambiguous for no gain. .RE .RS 4 .RE .RE .RS 4 .RE .PP \fIPhrase related\fR .IX Subsection "Phrase related" .PP These all take a phrase as their only argument. .PP \fIphrase2struct()\fR .IX Subsection "phrase2struct()" .PP Returns the struct for the given phrase. .PP If there is a problem it will croak either \*(L"Unbalanced bracket: “…”\*(R" or "\*(L"Consecutive tildes are ambiguous\*(R": “…”". .PP \fIphrase_has_bracket_notation()\fR .IX Subsection "phrase_has_bracket_notation()" .PP Returns a boolean. .PP True: the given phrase has bracket notation. .PP False: the given phrase does not have any bracket notation. .PP \fIphrase_is_entirely_bracket_notation()\fR .IX Subsection "phrase_is_entirely_bracket_notation()" .PP Returns a boolean. .PP True: the given phrase is entirely bracket notation. .PP False: the given phrase is not entirely bracket notation. .PP Consecutive tildes are ambiguous .IX Subsection "Consecutive tildes are ambiguous" .PP In order to keep the parsing as simple/fast as possible we avoid trying to properly interpret multiple consecutive tildes. .PP In the rare case you really need a literal ~ to precede a comma, ~, [, or ] (really, anywhere in the string) just use the explicit placeholder string “_TILDE_”. .PP .Vb 1 \& $lh\->maketext(\*(AqA tilde is this: _TILDE_, you like?\*(Aq); \& \& $lh\->maketext(\*(AqA tilde [output,strong,is this: _TILDE_, you like]?\*(Aq); .Ve .PP \fIStructure Related\fR .IX Subsection "Structure Related" .PP These all take a struct as their only argument. .PP \fIstruct2phrase()\fR .IX Subsection "struct2phrase()" .PP Returns the given struct as a stringified phrase. .PP \fIstruct_has_bracket_notation()\fR .IX Subsection "struct_has_bracket_notation()" .PP Returns a boolean. .PP True: the given struct has bracket notation. .PP False: the given struct does not have any bracket notation. .PP \fIstruct_is_entirely_bracket_notation()\fR .IX Subsection "struct_is_entirely_bracket_notation()" .PP Returns a boolean. .PP True: the given struct is entirely bracket notation. .PP False: the given struct is not entirely bracket notation. .PP \fIMisc\fR .IX Subsection "Misc" .PP \fIget_bn_var_regexp()\fR .IX Subsection "get_bn_var_regexp()" .PP Takes no arguments, returns a regular expression that matches bracket notation variable syntax. .PP .Vb 7 \& my $bn_var_regexp = Locale::Maketext::Utils::Phrase::get_bn_var_regexp(); \& if ($string =~ m/\eA$bn_var_regexp\ez/) { \& # string is a BN variable \& } \& elsif ($string =~ m/$bn_var_regexp/) { \& # string contains a BN variable \& } \& \& my @bn_variables = $string =~ m/($bn_var_regexp)/g; .Ve .PP \fIget_non_translatable_type_regexp()\fR .IX Subsection "get_non_translatable_type_regexp()" .PP Takes no arguments, returns a regular expression that matches types that should not have any translatable parts. .PP .Vb 4 \& my $non_translatable_type_regexp = Locale::Maketext::Utils::Phrase::get_non_translatable_type_regexp(); \& if ($piece\->{\*(Aqtype\*(Aq} =~ m/\eA$non_translatable_type_regexp\ez/) { \& # nothing to translate here, move along, move along \& } \& \& if ($xliff\->{\*(Aqctype\*(Aq} =~ m/\eAx\-bn\-$non_translatable_type_regexp\ez/) { \& # handle the XLIFF syntax for non\-translatable <ph> tags back into bracket notation \& } .Ve .PP \fIstring_has_opening_or_closing_bracket()\fR .IX Subsection "string_has_opening_or_closing_bracket()" .PP Takes one argument, a string. Returns true if it contains an opening or closing bracket. .PP .Vb 3 \& if ( !Locale::Maketext::Utils::Phrase::string_has_opening_or_closing_bracket($string) ){ \& # $string does not have any bracket notation. \& } .Ve .PP \fIPrivate functions\fR .IX Subsection "Private functions" .PP These are essentially meant to be used internally but if you find a use for them be sure to verify the values you pass to them or you will get odd results. .IP "\fI_split_bn_cont()\fR" 4 .IX Item "_split_bn_cont()" Takes the 'cont' of the bracket notation piece hashref and optionally the max number of item to split it into and returns the resulting array. .Sp Used internally to build the hash’s 'list' value. .IP "\fI_get_attr_hash_from_list()\fR" 4 .IX Item "_get_attr_hash_from_list()" Takes the 'list' of the bracket notation piece hashref and the index of where the arbitrary attributes begin and returns a hash. Accounts for non\-key/value variable array refs. .IP "\fI_get_bn_type_from_list()\fR" 4 .IX Item "_get_bn_type_from_list()" Takes the 'list' of the bracket notation piece hashref and returns the type. .Sp Used internally to build the hash’s 'type' value. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" Nothing besides what is documented in \fIphrase2struct()\fR. .SH "CONFIGURATION AND ENVIRONMENT" .IX Header "CONFIGURATION AND ENVIRONMENT" Locale::Maketext::Utils::Phrase requires no configuration files or environment variables. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" Locale::Maketext::Utils .SH "INCOMPATIBILITIES" .IX Header "INCOMPATIBILITIES" None reported. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" No bugs have been reported. .PP Please report any bugs or feature requests to \&\f(CW\*(C`bug\-locale\-maketext\-utils\-mock@rt.cpan.org\*(C'\fR, or through the web interface at <http://rt.cpan.org>. .SH "TODO" .IX Header "TODO" Add in the object layer to really make the introspection complete. .SH "AUTHOR" .IX Header "AUTHOR" Daniel Muey \f(CW\*(C`<http://drmuey.com/cpan_contact.pl>\*(C'\fR .SH "LICENCE AND COPYRIGHT" .IX Header "LICENCE AND COPYRIGHT" Copyright (c) 2012, Daniel Muey \f(CW\*(C`<http://drmuey.com/cpan_contact.pl>\*(C'\fR. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" \&\s-1BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE \*(L"AS IS\*(R" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.\s0 .PP \&\s-1IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE \s0(\s-1INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE\s0), \s-1EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\s0