How to redirect stderr to C lang function

Discussion in 'Perl Misc' started by Lukas Petrlik, Sep 12, 2005.

  1. I was considering the following possibilities:

    1) To include logging in the Perl's internal function
    util.c:perl_write_to_stderr().

    This possibility is quite simple, but I would have to modify Perl
    sources.

    2) To use binmode (STDERR, ":via(myModule)") and call back the logging
    function; the disadvantage of this solution is that it would not log most
    syntactic errors.

    3) To call PerlIO_stdstreams() and assign to PL_perlio[3], before we call
    perl_parse().

    This third solution is probably the best one, but I will have to fill my
    own PerlIO structure and ensure that it will get free()d once and only
    once.

    Is there a better possibility?

    Lukas
    Lukas Petrlik, Sep 12, 2005
    #1
    1. Advertising

  2. Lukas Petrlik

    Matija Papec Guest

    X-Ftn-To: Lukas Petrlik

    Lukas Petrlik <> wrote:
    >3) To call PerlIO_stdstreams() and assign to PL_perlio[3], before we call
    > perl_parse().
    >
    > This third solution is probably the best one, but I will have to fill my
    > own PerlIO structure and ensure that it will get free()d once and only
    > once.
    >
    >Is there a better possibility?


    You can tie STDERR to your custom class which will capture all STDERR
    output. There are also some modules that can do such things for you,
    http://search.cpan.org/search?query=stderr&mode=all



    --
    Matija
    Matija Papec, Sep 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VisionSet
    Replies:
    6
    Views:
    9,608
    Sudsy
    Sep 20, 2003
  2. Guest
    Replies:
    3
    Views:
    1,161
    Guest
    Jan 11, 2004
  3. newgene
    Replies:
    0
    Views:
    820
    newgene
    Jul 28, 2003
  4. Sal
    Replies:
    1
    Views:
    358
  5. Lukas P
    Replies:
    1
    Views:
    74
    Anno Siegel
    Sep 12, 2005
Loading...

Share This Page