Mabooka-Mabooka has asked for the wisdom of the Perl Monks concerning the following question:
I am not a Perl programmer. But I badly need to fix my colleague's code, and I'm stuck. Please excuse me if I came to a wrong place.
Here's the slightly obfuscated snippet from real script:
#!/usr/local/bin/perl -w use strict; sub get_useful_number_1() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone, $days_without_water) = @_; my $camel_id; if (1 == 1) { $camel_id = get_camel_id($self, $harness, $bridle_radius, $max_ +spit_distance, $num_legs, $last_name, $day_phone); # line above: NO COMPLAINTS } } sub get_camel_id() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone) = @_; my $camel_id = 18; if ($camel_id == 18) { return($camel_id); } else { return(-18); } } sub get_useful_number_2() { my ($self, $harness, $bridle_radius, $max_spit_distance, $num_legs +, $last_name, $day_phone, $days_without_water) = @_; my $camel_id; if (1 == 1) { $camel_id = get_camel_id($self, $harness, $bridle_radius, $max_ +spit_distance, $num_legs, $last_name, $day_phone); # line above: Too many arguments for main::get_camel_id at ./er +rand-01.pl line 41, near "$day_phone)" } } 1;
The code won't compile, giving a syntax error message "Too many arguments". The only difference between caller1 and caller2 is... the 2nd one is located after the function I need to call in the file.
My best bet: it's related to the sin #2: http://www.perl.com/pub/a/1999/11/sins.html#2
Can anybody bring piece back to my life please?20050416 Janitored by Corion: Added formatting, changed PRE to CODE, linkified link
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Badly need to call a function...:-)
by BUU (Prior) on Apr 16, 2005 at 21:55 UTC | |
by Mabooka-Mabooka (Sexton) on Apr 16, 2005 at 22:04 UTC | |
|
Re: Badly need to call a function...:-)
by eibwen (Friar) on Apr 16, 2005 at 22:15 UTC | |
|
Re: Badly need to call a function...:-)
by Cody Pendant (Prior) on Apr 16, 2005 at 23:22 UTC | |
by eibwen (Friar) on Apr 17, 2005 at 00:13 UTC | |
by Mabooka-Mabooka (Sexton) on Apr 17, 2005 at 05:25 UTC | |
by eibwen (Friar) on Apr 17, 2005 at 18:05 UTC |