akagrawal3 has asked for the wisdom of the Perl Monks concerning the following question:
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?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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: run-time arguments
by rovf (Priest) on Mar 01, 2012 at 10:41 UTC | |
by akagrawal3 (Beadle) on Mar 01, 2012 at 11:16 UTC | |
by tobyink (Canon) on Mar 01, 2012 at 11:27 UTC | |
|
Re: run-time arguments
by JavaFan (Canon) on Mar 01, 2012 at 10:36 UTC | |
|
Re: run-time arguments
by Anonymous Monk on Mar 01, 2012 at 10:33 UTC | |
by akagrawal3 (Beadle) on Mar 01, 2012 at 10:43 UTC |