Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^4: App::Cmd::Command and abstract encoding (=encoding utf8)

by McA (Priest)
on Mar 04, 2013 at 14:00 UTC ( #1021647=note: print w/replies, xml ) Need Help??

in reply to Re^3: App::Cmd::Command and abstract encoding (=encoding utf8)
in thread App::Cmd::Command and abstract encoding

I'm not really happy with that "solution", because if a perl source is not declared beeing utf8-encoded it is latin1-encoded by default. A German umlaut in an ABSTRACT would be decoded wrong.

My proposal from above:

--- App/Cmd/ 2013-01-31 01:37:50.000000000 +0100 +++ App/Cmd/ 2013-03-04 14:57:08.398638804 +0100 @@ -11,6 +11,7 @@ # ABSTRACT: a base class for App::Cmd commands use Carp (); +use Encode (); sub prepare { @@ -115,6 +116,7 @@ local $/ = "\n"; my $inpod; + my $enc_seen; while (local $_ = <$fh>) { # =cut toggles, it doesn't end :-/ @@ -127,10 +129,10 @@ next unless $inpod; chomp; - + $enc_seen = $1 if(/^=encoding\s+(\S+)/); next unless /^(?:$class\s-\s)(.*)/; - $result = $1; + $result = $enc_seen ? Encode::decode($enc_seen, $1) : $1; last; }

Best regards

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021647]
[Corion]: I've started that again this month (now forever instead of a limited time), and it already destresses me a lot
[holli]: There are Anti Vaxxer weeks at IKEA.
[Corion]: Of course, it's a 20% cut in the money I receive, while the work doesn't necessarily reduce at all, but my approach is to make the work take longer instead of fitting 5 days worth of work into 4
[holli]: 50% off all children coffins.
[Corion]: holli: Ooof :)
[hippo]: Cut should beless than 20% after tax, though. :-)
[Corion]: hippo: Yeah, but at least two years ago, it still was close enough to 20% cut
[Corion]: But I have a very positive experience with a four day workweek and a three day weekend. I can't easily go back though to full money.
[Corion]: That is easy without having to pay for a house, a wife or children though. If I had any of these, or any two of these, the decision wouldn't be that easy.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-09-21 15:11 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (249 votes). Check out past polls.