Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: locating specific function calls

by markov (Scribe)
on Apr 11, 2007 at 13:59 UTC ( #609368=note: print w/replies, xml ) Need Help??

in reply to Re: locating specific function calls
in thread locating specific function calls

Ok, let tell me a little more about the plan.

When your program needs to support multiple languages, then you can use gettext. Its use has various syntaxes, of which Locale::TextDomain seems to be the nicest: __x("found {count} files", count => 6). To use gettext(), the string needs to be translated into all supported languages.

After translation, these messages have to go somewhere. Of course, you can simply die/warn/croak, but a generally applicable module is not sure about the destination of the output. More complex applications have to apply nasty tricks to catch and handle "die()" in third-party code. With Log::Dispatch and Log::Log4perl you can help the message find its way cleaner, but do not translate

So, what I want to do, is link the translation framework with the distribution network. Any piece of distributed text must be translated, and therefore I would like to avoid the explicit call to __x(). I try to write this:

use Log::Report textdomain => 'my-domain'; report trace => "{count} files", count => 10;
with "compile-time" parameter checking. In stead of the unchecked
use Log::Report textdomain => 'my-domain'; report trace => __x("{count} files", count => 10);

In the major module of a set of related modules, you will be able to say:

use Log::Report textdomain => 'my-domain' , directory => '/usr/share/locale';
etc: I do not want to repeat configuration information in each pm file. And I do not want to limit the whole application (containing multiple distributions) to one domain. The default use of the current modules have these limitations: I wish to change the default.

In the "main" script, you must be able to say something like:

use Log::Report destinations => [ CRITICAL => 'syslog' , 'ERRORS-' => 'die' , 'TRACE,INFO' => 'ignore' ];

Be aware: all syntax still under development, and will certainly be clearer.

To come back to my original question: I want to simplify the use and automatically check the "report()" calls without running the program.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609368]
and the grasshoppers chirp...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-02-23 05:08 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (300 votes). Check out past polls.