averagehat / gcap

Automatically exported from code.google.com/p/gcap
0 stars 0 forks source link

ARGV Problem #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gcap -W3Cn6R0jWk
2.
3.

What is the expected output? What do you see instead?
Should download subtitle for video code given in $ARGV[0].

% gcap -W3Cn6R0jWk
Unknown option: W
Unknown option: 3
Unknown option: C
Unknown option: n
Unknown option: 6
Unknown option: R
Unknown option: 0
Unknown option: j
Unknown option: W
Unknown option: k

What version of the product are you using? On what operating system?
Version: 0.0.6
OS: Linux

Please provide any additional information below.

Temporary fix:

foreach $arg (@ARGV) {
    if ($count = $arg =~ s/(.)/$1/gs eq 11) {
        ...Download srt file...
    }
}

Original issue reported on code.google.com by triz...@gmail.com on 20 Feb 2011 at 2:43

GoogleCodeExporter commented 9 years ago
The Getopt::* (Long?) module treats the arg as a list of short options due to 
the dash.

Or use the URL form instead, e.g.:
  % gcap http://youtube.com/v/-W3Cn6R0jWk

Original comment by legatvs on 20 Feb 2011 at 8:53

GoogleCodeExporter commented 9 years ago
Thanks for the temp fix.

-> 0.0.7

Original comment by legatvs on 21 Feb 2011 at 8:19

Attachments:

GoogleCodeExporter commented 9 years ago
'my $count =' is not needed, also you can do this in another elegant way: 'if ( 
length($arg) eq 11 ){'. Thanks for fixing it.

Original comment by triz...@gmail.com on 21 Feb 2011 at 10:34

GoogleCodeExporter commented 9 years ago
Left it there for readability. I'll change it to the length. Thanks.

Original comment by legatvs on 21 Feb 2011 at 8:39

GoogleCodeExporter commented 9 years ago

Original comment by legatvs on 21 Feb 2011 at 8:49

Attachments: