last question on the switch statement ....

2005-04-17 Thread David Gilden
Dear fellow PERL coders..., What is the "&& do" part of the code doing, i.e. I am looking to understand the syntax, the example was found in perl beginners archive, from some else's post... Thanks, Dave (kora musician / audiophile / webmaster @ www.coraconnection.com / Ft. Worth, TX, USA) f

RE: passing database data to a sub

2005-04-17 Thread Charles K. Clarkson
Hawkes, Mick I wrote: : [Charles] said: : : Second, GetOfficers() is called as a subroutine, not as a method : of an object. But it is written as an object method. Try this. : $template->param( db_loop => $self->GetOfficers() ); : : I'm not sure of the difference, why

RE: passing database data to a sub

2005-04-17 Thread Charles K. Clarkson
Hawkes, Mick I wrote: : Also, I put all the changes in you recommended, but I still get the : same error! I didn't test the fetchall_arrayref() solution. You shouldn't add it until you have tested it first. : Error executing run mode 'Mode_0': can't call method

Re: passing database data to a sub

2005-04-17 Thread Jeff 'japhy' Pinyan
On Apr 18, Hawkes, Mick I said: sub mainmenu { my $self = shift; my $dbh = $self->param('mydbh'); # Get the CGI query object so that you can use the CGI.pm modules. my $q = $self->query(); # Setup the template to use for the output. my $template = $self->load_tmpl('test2.tmpl.htm'); # call p

RE: passing database data to a sub

2005-04-17 Thread Hawkes, Mick I
Wow! Thanks Charles, it will take a while to digest all that. Some questions though... You said: Second, GetOfficers() is called as a subroutine, not as a method of an object. But it is written as an object method. Try this. $template->param( db_loop => $self->GetOfficers() ); I'm not sure o

RE: passing database data to a sub

2005-04-17 Thread Charles K. Clarkson
Hawkes, Mick I wrote: : I am having trouble getting a subprocedure to work using : parameter data passed with shift Your call to the GetOfficers() looks suspect twice. First calling it with a reference ( \GetOfficers() ) doesn't look right. Have you tested the resul

passing database data to a sub

2005-04-17 Thread Hawkes, Mick I
Hi all I am having trouble getting a subprocedure to work using parameter data passed with shift Here is the calling routine. It's a snippet. All the modules are called properly sub mainmenu { my $self = shift; my $dbh = $self->param('mydbh'); # Get the CGI query object so that you can

Re: Passing array as refer ?

2005-04-17 Thread John W. Krahn
Michael Gale wrote: Hello, Hello again, Ok, I have it working but I am not sure why: --snip-- sub printlist { my $arrayref = [EMAIL PROTECTED]; Now you are copying the whole array to @_ (which you said you didn't want to do) and are assigning a reference of that array. John -- use Perl;

Re: Passing array as refer ?

2005-04-17 Thread John W. Krahn
Michael Gale wrote: Hello, Hello, I am trying to pass an array by reference since it could become very large. The function should take the array and print it out but only 10 elements per line. Did you read the Perl subroutines and/or the Perl references document? perldoc perlsub perldoc perlr

Re: Passing array as refer ?

2005-04-17 Thread Michael Gale
Hello, Ok, I have it working but I am not sure why: --snip-- sub printlist { my $arrayref = [EMAIL PROTECTED]; ## create a reference to my passed array my $max; for(my $i=0;$i <= @$arrayref; $i++){ ## Dereference the passed array to find number of ele