Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: RFC Using PERL HEREDOC script within bash

by roboticus (Chancellor)
on Aug 27, 2014 at 13:07 UTC ( #1098734=note: print w/replies, xml ) Need Help??


in reply to RFC Using PERL HEREDOC script within bash

dcronin135:

What is that buying you? Those scripts could just be perl scripts for what it's worth. Why the extra rigamarole to put bash/ksh into the process. If you've got a particular use case that shows why you'd actually *want* to do that, it would help your post.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: RFC Using PERL HEREDOC script within bash

Replies are listed 'Best First'.
Re^2: RFC Using PERL HEREDOC script within bash
by RonW (Parson) on Aug 27, 2014 at 16:20 UTC

    Maybe when forced to incrementally "port" a legacy bash script to Perl. I have re-implemented some bash scripts in the past.

    One legacy bash scripts that stands out in my memory, had several embedded AWK and Sed scripts. Management was very sceptical, so I had to do it incrementally. Phase 0, I replaced the AWK and Sed scripts with Perl equivalents. In some cases, I was able combine adjacent AWK/Sed scripts into a single Perl script. This was fortuitous because it gave a small but measurable performance boost. After demonstrating the new version worked correctly, I moved to phase 1 to re-implement the rest of the script, which was straight forward. The end result was much faster and much less fragile, therefor much easier to maintain and improve.

Re^2: RFC Using PERL HEREDOC script within bash
by mr_mischief (Monsignor) on Aug 28, 2014 at 19:05 UTC

    If it is primarily a shell script with some trivial Perl that had been in a separate file embedding one in the other can slightly ease deployment. Reimplementing it all in Perl is probably better but might take much longer to get right.

Re^2: RFC Using PERL HEREDOC script within bash
by dcronin135 (Acolyte) on Aug 27, 2014 at 14:58 UTC

    Just illustrating and example of how this might be done when a bash or ksh script needs a little more scripting muscle. It merely illustrates a method for leveraging PERL within bash or shell of choice, when OS utilities fall a little short. No one tool can do it all, though PERL comes very close, but, when it can't... the illustration offers by example an enhancement to your existing tools out of the box.

    roboticus, Sorry we don't share the same out-of-box thinking. I have seen other requests for this type of method. Merely fulfilling a need to know, whether you agree or not.

      No one tool can do it all

      Well, Perl can! :-) Especially with the appropriate modules, plus it's pretty portable. (With what kind of tasks did you have portability problems with Perl?)

      You did post on a Perl website after all, so of course everyone says, why not do it all in Perl? ;-)

        You are exactly right! Should have known better than to put PERL in a second-class context. Ouch! It wasn't my intent to make defacto statement, merely present an example to others asking how. I am a big fan of PERL and use it as primary scripting choice. Just hope the examples are taken as just that... examples. Though I sure it will touch a nerve somewhere.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2019-12-11 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?