View::Value->new({ name => 'create_key', opt_spec => [qw( host=s #few more values )], db_connection => [qw/ hello /], handler => sub { foo (@_) }, }); sub foo { my @opt = View::Value::get_opt; my %handler_for = ( host => sub { create(@_) }, #few more key, value pair ); sub create { my %opt = @_; # Assume that $key has the public key for my $host (split /,/, $opt{host}) { system qq{cat $key | ssh -q $host 'umask 077; test -d .ssh || + mkdir .ssh ; cat >> .ssh/keys'} } return; }
The function foo() is called through View::Value->new. I think that this code takes command-line argument as well. Let me know if this is the case. Kindly, help me with the following: 1. I am nowhere able to find the routine get_opt. Is it a pre-defined one 2. Will the function create() be called only when I give --host during runtime? 3. Now what values are passed to create() 4. what does that system command mean? what is its order or execution? 5. What is that host=s?

In reply to run-time arguments by akagrawal3

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.