Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
ah yes, thank you for noticing. It's fixed via return to and set in main now.

I've transformed all of the code but the expect parts by now but want to complete and throughly test it before posting the version 2. However I'm not entirely sure if what I have in mind is going to work.

The expect-interaction is entirely independent on the protocol so I will consolidate both prior subs, but since most expect calls are similar I would like to create abstract subs and pass params to them as well as an exp-handle ref. is this possible?

rough example:
sub expect_main { my $exp = new Expect; $exp->configure_stuff; my $FB = expect_do_something(\$exp, \@expectthese, \@sendthese); } sub expect_do_something { my ($exp,$expectthese,$sendthese) = @_; $exp->expect(5, [ qr/$expectthese->[0]/, sub { $exp->send("$sendthese->[0]");}], [ qr/$expectthese->[1]/, sub { $exp->send("$sendthese->[1]");}], ); my $fb = $exp->before(); return $fb; }
Would this work or is it impossible to interact with the expect handle and methods this way? Or is there maybe a better way? Thanks in advance.

In reply to Re^6: RFC: beginner level script improvement by georgecarlin
in thread RFC: beginner level script improvement by georgecarlin

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
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (8)
    As of 2018-06-25 09:06 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.