I'll admit it. I'm confused too. You say that you add_client() sub "works fine", but I don't undertsand how it could? I just tried to simulate your code and any attempt I made to call add_client(); with paramters caused the compile time error:
Too many arguments for main::add_client at ... near "'password' )"
This is exactly what I expected. Maybe I am missing something?
#! perl -sw use vars qw($app $FATAL); use strict; $app = 'test'; $FATAL = 'FATAL'; sub add_client() { print "******ADDING ROW TO CLIENT TABLE******\n"; print "I AM HERE\n"; my ($dbh, $clt, $prdpasswd) = @_; my $count = 1; my $cltid; my $sql = "select distinct CLT_ID from ENRMASTER..CLT order by CLT +_ID"; my $sth = $$dbh->prepare($sql) or $app->error($FATAL, "can't prepare SQL statement [ $sql ] : +:$DBI::errstr"); $sth->execute(); } # 1047 my $cltid = add_client(\$dbhTarget, $clt, $passwd); add_client(); # the compiler accepts this but it wouldn't do anything +useful. add_client( 'handle', 'clt_id', 'password' ); ## << Line 25 __END__
gives
c:\test>209750 Too many arguments for main::add_client at C:\test\209750.pl line 25, +near "'password' )" Execution of C:\test\209750.pl aborted due to compilation errors. c:\test>
In reply to Re: One sub routine call works a similar one does not.
by BrowserUk
in thread One sub routine call works a similar one does not.
by mnlight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |