Re: any module like Getopt::Long ?
On Sat, Nov 16, 2013 at 12:58:57AM +0200, Serge A. Ribalchenko wrote: > > it's *@input, not @input: > Thank you! you're welcome :) -- Marc Chantreux (eiro on github and freenode) http://eiro.github.com/ http://eiro.github.com/atom.xml "Don't believe everything you read on the Internet" -- Abraham Lincoln
Re: any module like Getopt::Long ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 11/16/2013 01:46 AM, Marc Chantreux wrote: > it's *@input, not @input: > Thank you! - -- 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/ iF4EAREKAAYFAlKGpzEACgkQHurxoSxHllcgwgD/RdLoeSd7XVL/a3O9Yinfh4yh rze4WCcOaisayy2SIyIA/R1fK/y99BKXqwV7IO4kI+2oqEdFDM5oDvE+TIJ6Vd34 =9gHi -END PGP SIGNATURE-
Re: any module like Getopt::Long ?
On Sat, Nov 16, 2013 at 12:25:23AM +0200, Serge A. Ribalchenko wrote: > sub MAIN(@input, Bool :$n, :$i='any') { > say "n is $n, interface is $i, input is ", @input; it's *@input, not @input: use v6; sub MAIN( Bool :$n=False, :$i='any', *@spec ) { say "n is $n, interface is $i, input is {@spec}"; } regards -- Marc Chantreux (eiro on github and freenode) http://eiro.github.com/ http://eiro.github.com/atom.xml "Don't believe everything you read on the Internet" -- Abraham Lincoln
Re: any module like Getopt::Long ?
-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-
Re: any module like Getopt::Long ?
hello, On Fri, Nov 15, 2013 at 11:31:19PM +0200, Serge A. Ribalchenko wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > 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/ regards -- Marc Chantreux (eiro on github and freenode) http://eiro.github.com/ http://eiro.github.com/atom.xml "Don't believe everything you read on the Internet" -- Abraham Lincoln
any module like Getopt::Long ?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Is there any module like Getopt::Long comes with rakudo in a bundle? Or something alike for command-line options parsing? - -- 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/ iF4EAREKAAYFAlKGkmcACgkQHurxoSxHllf5HAD+NSy4qfwZDco0WSXGpviibla/ x98yh1qIa6fgevZHkT0A/0bkT8RBgxnvuL5CKE5NdY8+qjsXRUObjPqVSvhCAi/3 =Xyqm -END PGP SIGNATURE-