-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi there,

On 11/16/2013 12:40 AM, Marc Chantreux wrote:
>> 
>> Is there any module like Getopt::Long comes with rakudo in a
>> bundle? Or something alike for command-line options parsing?
> 
> in many cases, there is no need of such a module as parsing command
> line options is a perl6 built-in feature:
> 
> http://perl6advent.wordpress.com/2010/12/02/day-2-interacting-with-the-command-line-with-main-subs/
> 
Hm, thanks, seems like a good fit, but I can't figure out how to make
a variable length array with what it comes *after* parameters. Like
tcpdump uses a bunch of optional options and then it's own DSL,
"tcpdump -n -i eth0 ip and not icmp".

The quick intuitive approach is to declare an array for it like this:

sub MAIN(@input, Bool :$n, :$i='any') {
  say "n is $n, interface is $i, input is ", @input;

but this doesn't work.

- -- 
Serge Ribalchenko
This is my personal e-mail

DAFB 7999 4767 EECC B6C8  2380 1EEA F1A1 2C47 9657
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iF4EAREKAAYFAlKGn1MACgkQHurxoSxHlles5QD/eXYGDWcCzRi/rhx/iwljXqyh
RStBTXuqUp6uVf37RyQBAM9URWLFua4DNUs/GKoVjQZWBlntMgyx5fZfCNouGiQT
=KTBe
-----END PGP SIGNATURE-----

Reply via email to