Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Any reason to use the Paws module over aws cli commands in perl script?

by nysus (Parson)
on Oct 21, 2020 at 13:25 UTC ( [id://11123035]=perlquestion: print w/replies, xml ) Need Help??

nysus has asked for the wisdom of the Perl Monks concerning the following question:

What are the arguments for using the Paws module instead of just embedding commands like `aws ec2 run-isntances --image-id ....` into my perl script? I feel dirty just executing command line commands in my perl script and it doesn't feel very professional, but what's the harm, really?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on Any reason to use the Paws module over aws cli commands in perl script?
  • Download Code

Replies are listed 'Best First'.
Re: Any reason to use the Paws module over aws cli commands in perl script?
by choroba (Cardinal) on Oct 21, 2020 at 13:47 UTC
    Once you need to read values from config files or user input, you'll also need to properly quote them for the command line, as they can contain characters as [{};<> ] etc. That's what a module saves you from.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Quoting is less of an issue if you use system(LIST).

Re: Any reason to use the Paws module over aws cli commands in perl script?
by haukex (Archbishop) on Oct 21, 2020 at 15:10 UTC
    I feel dirty just executing command line commands in my perl script and it doesn't feel very professional

    If you do it right, it's fine* - but backticks are usually not the "right" way to do it: Calling External Commands More Safely

    In this case, see jo37's and my responses to PERL to AWS.

    * Update: To be a little more specific: I personally think it's fine in the case of aws and other complex tools like that, and if you're not doing it in a tight loop where performance is important. For stuff like grep, cat, awk, etc., of course one shouldn't call external commands - afoken made a nice list in this node.

Re: Any reason to use the Paws module over aws cli commands in perl script?
by hippo (Bishop) on Oct 21, 2020 at 13:41 UTC
    what's the harm, really?

    If your typo is less benign than run-isntances you could be in a whole world of trouble.


    🦛

Re: Any reason to use the Paws module over aws cli commands in perl script?
by Anonymous Monk on Oct 21, 2020 at 17:20 UTC
    Hey ... if there wasn't a very good reason for it, no one would have written and then published it!
      "If the cop shot her, he must have had a good reason for it."
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11123035]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-18 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found