The idea of cut'n'paste between Perl and shell is seductive. I know I'm fond of heredocs and SQL. But I wonder if having to use a source filter is worth the pain.

With a bit of infrastructure it wouldn't be hard to produce a more Perlish interface. Consider a skeletal

#! /usr/bin/perl package OpenSSL; use strict; use warnings; use Exporter; use vars qw(@ISA @EXPORT); @ISA = 'Exporter'; @EXPORT = qw(openssl connect in s_client); sub openssl { return bless {}, __PACKAGE__; } sub s_client { my $self = shift; $self->{s_client} = 1; } sub connect { my $self = shift; my $uri = shift; my $cert = frantic_hand_waving($uri); return $cert; } 1;

This lets you write perfectly legal Perl code that looks like:

use OpenSSL; my $cert = openssl->s_client->connect('myhost.com:443');

That would be fine by me. But then again, it's your itch, not mine. I think the idea is definitely worth pursuing one way or another.

update: well DUH! Should have read the opening line a bit more carefully... so there are modules that already do this, more fool me.

That said, I'm sure there must be a way to convince the interpreter that the openssl command line is valid Perl. I'll have to think about it.

• another intruder with the mooring in the heart of the Perl


In reply to Re: Embed your openssl commands in Perl by grinder
in thread Embed your openssl commands in Perl by slife

Title:
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, details, 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, summary, 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.