Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't understand if you're trying to use those programs or to recreate similar ones.

The attempt was a little of both, but I should have specified that I was trying to provide an sshclient-like interface for a qmail filtering program, since (as you mentioned) running a Perl program as sshclient's child is pretty easy.

I'd used sshclient in the past, and even though I often mix up which fd is read and which is write does what (different djb/djb-like util's use different fd's for different things), I like the nice, generic, cross-language interface. It fits nicely with both "Do one thing, and do it well" and "Everything's a pipe". I wondered how easy it'd be to provide that interface in Perl.

The idea was that I would provide the filtering program (child) fd's 0,1,4,5,6,7 for message-in, message-out, header-in, header-out, body-in, and body-out. If any of the '-out's was the same as its '-in' or was empty, the original would be used. And, either message-out or (header-out + body-out) would be used, depending on what the filter program changed.

Since this isn't easy to do, I'm probably going to use an option flag to specify which one of 'message', 'headers', or 'body' the filter wants to have and just use STDIN + STDOUT.


Update: clarified my confusion re: djb{|-esque} tools' use of fd's

In reply to Re: Open a file on a specific file descriptor? by benizi
in thread Open a file on a specific file descriptor? by benizi

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2024-07-13 08:11 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.