Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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.


Comment on Re^2: locating specific function calls
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-12-27 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls