From canetguy at home.com Tue Nov 21 15:23:27 2000 From: canetguy at home.com (Garrett Casey) Date: Thu Aug 5 00:20:13 2004 Subject: Perl Mongers Meeting Message-ID: <200011211323270330.007A65C2@mail> ~sdpm~ Our monthly meeting has been moved to tomorrow, the 22nd of November. The driving directions are on the web site http://SanDiego.pm.org Robert, would you email the M-J. Dominus stuff again, my HD failed. Bruce or Michael: Would you update the web page to reflect the new meeting date. I lost all my ftp settings... arg. -Garrett Casey ---- Well this just sucks. I just got home to find that this message had BOUNCED. I am not sure if you all got it.... ------ Hey folks! Because of an overwhelming attendance at COMDEX in Las Vegas this year, Garrett is trapped in Las Vegas with no open flights retuning to San Diego before 10 pm Wed. Unfortunately, the meeting tonight will be postponed until next Wednesday, November 22. Garrett will e-mail everyone tomorrow with updates and plans for next week's meeting. I apologize for the last minute announcement. Cyrus p.s. Bruce or Michael: Garret asked if one of you might be willing to update the Web-site. ------ Anyway, I am sorry for any confusion that may have ensued. I was in Las Vegas and at the last minute, I could not get an available flight out until 9:15pm. This, of course, is not good for our meeting. I called Cyrus and asked him to email the group (my laptop was not working, arg!) informinging everyone that we had to push tonight's meeting to NEXT WED. I will email THU or FRI with details.. -Garrett Casey http://www.garrettcasey.com http://SanDiego.pm.org ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From mike.vasquez at akamai.com Mon Nov 27 17:41:57 2000 From: mike.vasquez at akamai.com (Vasquez, Mike) Date: Thu Aug 5 00:20:13 2004 Subject: function call and fetchrow->array or fetchall->arrayref (newbie) Message-ID: ~sdpm~ Not sure to which user group to ask this question. Here's the scenerio: I have 31 machines, each machine has a name ("machine 01", "machine 02", etc.), each machine has an ip address. All of this is in an oracle db. I've connected to the db. I call: sub{my (@num) = (0, 1, 5); &whatever(@num)}->(), #####This sub will be called 6 times with different values sub whatever{ $a = @_[0]; $b = @_[1]; $c = @_[2]; $location = dbh->quote("machine" . " " . $a . '%'); ###my sql statement is so -- $sth = $dbh->prepare(" SELECT machine_name, ip_address FROM machines where machine_name like $location order by machine_name "); #### This will return machines 01-09 $sth->execute(); while(($macinename, $ip) = $sth->fetchrow_array){ $testname = $q->param('loc') . ' ' . $a . $b; ###$q->pram('loc') value is "machine" if( $testname eq $encname && $b lt $c){ print $machinename . ' ' $ip . '
'; } $b++; } } This prints out ... machine 01 machine 02 machine 03 machine 04 Problem that I am having is when I try to call this function again like this: sub{my (@num) = (0, 5, 9); &whatever(@num)}->(), I get the first call returned and this function call returns nothing. I'm getting the results from the first function call with the same values. I want to be able to call the first function with specific values and then call it again with another set of values So the print out result would be like this: machine 01 machine 02 machine 03 machine 04 machine 05 machine 06 machine 07 machine 08 Am I using $sth->fetchrow_array correctly or should I be using fetchall->arrayref instead? Any help would be appreciated. Mike Vasquez ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rkleeman at neta.com Mon Nov 27 18:50:53 2000 From: rkleeman at neta.com (Bobby Kleemann) Date: Thu Aug 5 00:20:13 2004 Subject: function call and fetchrow->array or fetchall->arrayref (newbie) In-Reply-To: Message-ID: ~sdpm~ There's several things in your code that I'd rewrite. Look for my comments below. _ _ _ Bobby Kleemann http://www.neta.com/~rkleeman/ On Mon, 27 Nov 2000, Vasquez, Mike wrote: > ~sdpm~ > Not sure to which user group to ask this question. > > Here's the scenerio: > > I have 31 machines, each machine has a name ("machine 01", "machine 02", > etc.), each machine has an ip address. > All of this is in an oracle db. > > I've connected to the db. > > I call: sub{my (@num) = (0, 1, 5); &whatever(@num)}->(), #####This sub > will be called 6 times with different values > > sub whatever{ > $a = @_[0]; > $b = @_[1]; > $c = @_[2]; Use either my $a = shift; ... or my $a = $_[0]; ... or even my ($a, $b, $c) = @_; but *not* $a = @_[0]; In this case I think your syntax would put 1 in $a because that's the number of elements in the array you referenced. (@_ has three elements, but you asked for the slice with only one element, the 0th element, in it.) > $location = dbh->quote("machine" . " " . $a . '%'); Why the seperation? You don't save anything here by pulling them apart here except for readablity. $location = $dbh->quote("machine $a%"); > ###my sql statement is so -- > $sth = $dbh->prepare(" > SELECT machine_name, ip_address > FROM machines > where machine_name like $location > order by machine_name > "); > #### This will return machines 01-09 > > $sth->execute(); > while(($macinename, $ip) = $sth->fetchrow_array){ > $testname = $q->param('loc') . ' ' . $a . $b; Here you may gain a little speed, but is the expense of readability worth it? $testname = $q->param('loc') . " $a$b"; > ###$q->pram('loc') value is "machine" > if( $testname eq $encname && $b lt $c){ You are using $b and $c as numbers, so you probably want to use the numeric comparison, < instead of lt. To make this even clearer, drop the second half of this test and use the statement proveded below. > print $machinename . ' ' $ip . '
'; See the above comments on readability. If you were looking for that little bit of speed you'd want commas instead of periods. > } > $b++; How about "last if (++$b > $c);" so you don't go through some unneccessary itterations. > } > } > > This prints out ... > machine 01 > machine 02 > machine 03 > machine 04 > > Problem that I am having is when I try to call this function again like > this: > sub{my (@num) = (0, 5, 9); &whatever(@num)}->(), Why not like this? "sub { whatever(0, 5, 9) }->();" > > I get the first call returned and this function call returns nothing. > > I'm getting the results from the first function call with the same values. > I want to be able to call the first function with specific values and then > call it again with another set of values So the print out result would be > like this: > machine 01 > machine 02 > machine 03 > machine 04 > > machine 05 > machine 06 > machine 07 > machine 08 > > Am I using $sth->fetchrow_array correctly or should I be using > fetchall->arrayref instead? It looks like you are doing the right thing in the fetchrow_array vs fetchall->arrayref question. Try the some of the changes mentioned above and see if that fixes your problem. > > Any help would be appreciated. > > Mike Vasquez ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rkleeman at neta.com Tue Nov 28 13:28:49 2000 From: rkleeman at neta.com (Bobby Kleemann) Date: Thu Aug 5 00:20:13 2004 Subject: Web Instructor (fwd) Message-ID: ~sdpm~ Can anyone help Melissa out? I have a day job so I can't. _ _ _ Bobby Kleemann http://www.neta.com/~rkleeman/ ---------- Forwarded message ---------- Date: Tue, 28 Nov 2000 14:12:34 -0500 From: M Labell To: 'Bobby Kleemann' Subject: RE: Web Instructor Bobby, I was wondering if you might be able to help me out with something. Our regular instructor who teaches CGI/Perl for our Web program just broke his arm and is unable to teach. We are in need of an instructor to teach the CGI/Perl/Linux modules for our current day program. The classes start Monday, 12/4 and run for 2 weeks, Monday through Friday 9-5 PM. I thought I'd check to see if you might be available to help us out or if you know of anyone who might be. Thanks so much for your help! Melissa Labell College & University Partnerships Educational Resource Manager Linkage, Inc. (781)402-5576 MLabell@linkage-inc.com http://www.linkageinc.com The mediocre teacher tells The good teacher explains The superior teacher demonstrates The great teacher inspires William Arthur Ward ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human.