develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #116919] Examples in I18N::Langinfo pod won't run due to fatal errors

Thread Previous
From:
Aaron Trevena
Date:
February 25, 2013 18:37
Subject:
[perl #116919] Examples in I18N::Langinfo pod won't run due to fatal errors
Message ID:
rt-3.6.HEAD-31961-1361789543-694.116919-75-0@perl.org
# New Ticket Created by  "Aaron Trevena" 
# Please include the string:  [perl #116919]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116919 >


Hi,

There is something wrong in the pod for I18N::Langinfo, seems to have
not changed since at least 5.10

If you actually run the example in the pod :

   use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR);
   my ($abday_1, $yesstr, $nostr) = map { langinfo } qw(ABDAY_1 YESSTR NOSTR);
   print "$abday_1? [$yesstr/$nostr] ";

You will get a fatal runtime error :
Not enough arguments for I18N::Langinfo::langinfo at langinfo.pl line
2, near "langinfo }"

Doesn't seem much point in details which perl compiler options etc I
have, as that example will never work unless perl or I18N::Langinfo
has had a significant change in behaviour since perl 5.10

Fix is to remove the qw string quoting and refer to variables instead
of strings and then pass them as an argument to langinfo :

    map { langinfo($_) } (DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7)

regards,

Aaron



-- 
Aaron J Trevena, BSc Hons
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Consulting


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About