Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: It's the little things...

by JavaFan (Canon)
on Mar 02, 2010 at 23:50 UTC ( #826297=note: print w/replies, xml ) Need Help??

in reply to Re: It's the little things...
in thread It's the little things...

Which is silly, of course. Why go to the shell when you've got Perl?
Perl is the ultimate glue language. You've got Perl. That means, using the shell is easy. It's designed to be easy to use different utilities. Not using the shell for the sake of not using the shell is very unPerlish.

Now, in this particular case, I probably wouldn't use use the shell either, but there are many cases I don't hesitate to it.

Replies are listed 'Best First'.
Re^3: It's the little things...
by liverpole (Monsignor) on Mar 03, 2010 at 00:28 UTC
        "Not using the shell for the sake of not using the shell is very unPerlish"

    <Sigh> -- Not exactly what I meant, but because you may have misunderstood my intended message, let me rephrase it:  Why go to the shell when you can do it just as easily in Perl?

    Of course I use the shell when it makes sense.  Without hesitation.  But it's not a good idea (for a number of reasons) to get in the habit of blindly running to the shell without considering the alternatives.  One reason the comes to mind is portability.  Another is speed.

    And yes, I'm aware that in a little program that uses the shell for nothing other than stripping the basename from its own path there is unlikely to be noticeably slower than its alternative.  But what if your script is so useful that some other program now calls it thousands or millions of times?  And some other program calls that one thousands or millions of times?  Eventually you run the risk of encountering leaky abstractions.

    I'll confess, there are plenty of times I've done:

    % cat somefile | grep somestring

    But I still try to be aware that it's overkill, just like instinctively using the shell (when you don't necessarily have to) can be.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2018-11-18 14:16 GMT
Find Nodes?
    Voting Booth?
    My code is most likely broken because:

    Results (205 votes). Check out past polls.