Yes, you're right, I missed that. Sorry. Some more readable examples (IMHO) 1. JSON::XS - $enable $json = $json->convert_blessed ([$enable]) $enabled = $json->get_convert_blessed If $enable is true (or missing) (although true (or missing) is a bit confusing, but we'll have default false, so no problem) 2. Your "map" example. BLOCK LIST and EXPR are look more like placeholders, than FAIL_OK. So I propose use EXPR here $success = utf8::downgrade($string[, EXPR]); On failure dies or, if the value of EXPR is true, returns false. There is a module Encode, often used together with utf8, and it defines constants like FB_CROAK etc (although they are not exported so appear like Encode::FB_CROAK in documentation) On Mon Jun 03 03:36:26 2013, davem wrote: > On Mon, Jun 03, 2013 at 02:38:02AM -0700, Victor Efimov wrote: > > FAIL_OK is not defined in utf8 module, however it's mentioned in > > documentation > > > > $ perl poc.pl > > Bareword "FAIL_OK" not allowed while "strict subs" in use at poc.pl > line 5. > > Execution of poc.pl aborted due to compilation errors. > > > > $ cat poc.pl > > use strict; > > use warnings; > > use utf8; > > my $string='123'; > > utf8::downgrade($string, FAIL_OK); > > > > it does not work as utf8::FAIL_OK too > > tested under perl 5.10 and 5.18 > > FAIL_OK is not a literal constant; its just a placeholder in the > documentation, which later on says "if the value of C<FAIL_OK> is > true...". > > It's similar to where the docs for map say > > =item map BLOCK LIST > > where you're not expected to pass the literal string 'BLOCK' as an > arg. > > Perhaps the docs could be improved by putting FAIL_OK in italics or > something? > --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=118279Thread Previous | Thread Next