From dbii at interaction.net Thu Sep 11 08:40:06 2003 From: dbii at interaction.net (David Bluestein II) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Next Week's Meeting Topic? Message-ID: The website isn't updated yet, but I know Mark announced the meeting topic at the last meeting (and the topic for October too). Can someone post the topic to the list and update the website? Thanks- David ---------- David H. Bluestein II President & Lead Developer dbii@interaction.net ii, inc. http://www.interaction.net - Specializing in Designing Interactive Websites - - and Searchable Internet Databases - From wwalker at broadq.com Thu Sep 11 09:02:42 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI helper packages Message-ID: <20030911140242.GA1735@broadq.com> Until this week I was sold on Class::DBI. It creates a nice clean object wrapper around a database table for you in 3 lines of code. I've found a few things in it that I don't like about Class::DBI. SELECT return data is an array of objects rather than an array of hashrefs. (used to be the latter) Complex, multi-table SELECTs are near impossible to handle. I'm leaning towards going back to DBIx::Broker which simply removesall instances of this in your code: # Now retrieve data from the table. my $sth = $dbh->prepare("SELECT * FROM foo"); $sth->execute(); while (my $ref = $sth->fetchrow_hashref()) { push @results, $ref; } $sth->finish(); (and all the missing checks for prepare or execute failure) and replaces it with things like: @query_results = $db->select_all( \@desired_tables, $WHERE_clause, $hash_or_not ); Does anyone have something else that they use that makes more sense? Remember - big ugly multiple table SELECTs. -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Thu Sep 11 09:19:43 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Next Week's Meeting Topic? In-Reply-To: References: Message-ID: <20030911141943.GA2187@broadq.com> I believe that the speaker one week from yesterday is me. I think the topic was "Building Web Applications using HTML::Template and CGI::Application". Not sure how, but I will be ready for the talk, assuming I'm correct above. The title might have included Class::DBI but I'm no longer enamored with it. Actually, it's made me look pretty stupid on my current project. My fault more than that of the package, but again reminds me that OO programming is good, IN MODERATION. On Thu, Sep 11, 2003 at 08:40:06AM -0500, David Bluestein II wrote: > The website isn't updated yet, but I know Mark announced the meeting topic > at the last meeting (and the topic for October too). Can someone post the > topic to the list and update the website? > > Thanks- > > David > > ---------- > David H. Bluestein II President & Lead Developer > dbii@interaction.net ii, inc. > > http://www.interaction.net > - Specializing in Designing Interactive Websites - > - and Searchable Internet Databases - > > > > > > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From erik at debill.org Thu Sep 11 09:53:56 2003 From: erik at debill.org (erik@debill.org) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI helper packages In-Reply-To: <20030911140242.GA1735@broadq.com> References: <20030911140242.GA1735@broadq.com> Message-ID: <20030911145356.GA18275@debill.org> On Thu, Sep 11, 2003 at 09:02:42AM -0500, Wayne Walker wrote: > Does anyone have something else that they use that makes more sense? > Remember - big ugly multiple table SELECTs. No wonderpackage, but a couple little things that at least make the manual bits better... $sth->fetchall_arrayref() will at least get rid of the while loop. setting $dbh->{RaiseError} = 1; means code will basically do a die() if there is a problem - so wrapping db access in an eval saves you from having to check if the prepare or execute failed. At least that way you've got the error handling all in one place (and you can print out $DBI::errstr to have the db error for the logs). I haven't found a great big all in one package either - but I'd love to hear of one if someone else has. Erik -- Consumerism: the one true path to world peace. From wwalker at broadq.com Sat Sep 13 10:21:17 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Data::Dumper won't build on FreeBSD (4.6) Message-ID: <20030913152117.GC5015@broadq.com> Anyone running FreeBSD? I can't get Data::Dumper to build (via perl -MCPAN -e shell) on a 4.6 FreeBSD box. I see in google that there is a p5-DataDumper port, but I don't know how to get the port (not currently on the box. I tried: bash-2.05a# CVSROOT="anoncvs@anoncvs.FreeBSD.org:/cvs"; export CVSROOT bash-2.05a# portcheckout p5-DataDumper but this asks for a password... -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Sat Sep 13 19:31:44 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: OOP question Message-ID: <20030914003144.GB8846@broadq.com> I have an issue about inheritance and Class methods (rather than object methods). Any help would be appreciated. For those of you who didn't ace telepathy 305, here's the code: $miracle = Foo::Bar::get_data(); package Foo; sub get_data { my $class = shift; # this will = Foo::Bar at runtime $magic_dust = $class::get_dust(); $miracle = convert($magic_dust); return $miracle; } package Foo::Bar sub get_dust { # stuff.... return convert($beans); } The problem is that I cannot get the syntax right to run Foo::Bar::get_dust() inside Foo::get_data(). There will also be Foo::Baz::get_dust(). Applications will call the non-existant Foo::Baz::get_data Foo::Bar::get_data, etc... -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Sat Sep 13 20:47:21 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: OOP question In-Reply-To: <20030914003144.GB8846@broadq.com> References: <20030914003144.GB8846@broadq.com> Message-ID: <20030914014721.GD8846@broadq.com> In my example, Foo::Bar and Foo::Baz are sub classes of Foo. They would have "@ISA = qw(Foo)" or "use base 'Foo';" in them. I just accidentally left that out of my example below. On Sat, Sep 13, 2003 at 07:31:44PM -0500, Wayne Walker wrote: > I have an issue about inheritance and Class methods (rather than object > methods). Any help would be appreciated. > > For those of you who didn't ace telepathy 305, here's the code: > > > $miracle = Foo::Bar::get_data(); > > > package Foo; > > sub get_data > { > my $class = shift; # this will = Foo::Bar at runtime > $magic_dust = $class::get_dust(); > $miracle = convert($magic_dust); > return $miracle; > } > > package Foo::Bar > > sub get_dust > { > # stuff.... > return convert($beans); > } > > > The problem is that I cannot get the syntax right to run > Foo::Bar::get_dust() inside Foo::get_data(). > > There will also be Foo::Baz::get_dust(). > > Applications will call the non-existant Foo::Baz::get_data > Foo::Bar::get_data, etc... > > -- > > Wayne Walker > > www.broadq.com :) Bringing digital video and audio to the living room > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From eharris at puremagic.com Sun Sep 14 03:29:48 2003 From: eharris at puremagic.com (Evan Harris) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Apache mod_perl and large memory data cache Message-ID: I have a mod_perl application that I need to store a large amount of data in ram, in the form of a huge multilevel hash. The problem is that apache seems to store this data in each child process, meaning I have apache child processes with a larger than 50meg memory footprint, which is way too big. It's my understanding that I can use a startup file to preload things, but the functions to load the data use many of the request r-> functions, which I don't have access to in the startup file. I may be able to rewrite my functions not to use the request functions, but I don't want to embark on that task unless I know for sure that the resulting data structure will reside in shared memory space. Does anyone know for sure? Is there another (better) way to do this? Evan From wwalker at broadq.com Sun Sep 14 11:34:18 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Clarified OOP problem Message-ID: <20030914163418.GA26526@broadq.com> I have an issue about dynamically calling Class methods (rather than object methods) from a derived Class. Any help would be appreciated. The most important note here is that these are Class methods, NOT object methods. Therefore, there is no object. There is no object, no $self, the methods are being called by full name. Because of the ISA relationship, calling Foo::::get_data will call Foo::get_data, since get_data is not defined in any of the subclasses. That part is working as advertised. $class IS being properly set to the Name of the class (not a blessed referent, just the text string name of the class). Therefore, I thought that perl would handle: # $class = 'Foo::Bar' $class::get_dust() by executing Foo::Bar::get_dust() What syntax would replace $class::get and do what I want it to. $miracle = Foo::Bar::get_data(); package Foo; sub get_data { my $class = shift; # this will = Foo::Bar at runtime $magic_dust = $class::get_dust(); $miracle = convert($magic_dust); return $miracle; } package Foo::Bar use base 'Foo'; sub get_dust { # stuff.... return convert($beans); } The problem is that I cannot get the syntax right to run Foo::Bar::get_dust() inside Foo::get_data(). There will also be Foo::Baz::get_dust(). Applications will call the non-existant Foo::Baz::get_data Foo::Bar::get_data, etc... -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Sun Sep 14 11:47:28 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Apache mod_perl and large memory data cache In-Reply-To: References: Message-ID: <20030914164728.GC26526@broadq.com> On Sun, Sep 14, 2003 at 03:29:48AM -0500, Evan Harris wrote: > > I have a mod_perl application that I need to store a large amount of data in > ram, in the form of a huge multilevel hash. The problem is that apache > seems to store this data in each child process, meaning I have apache child > processes with a larger than 50meg memory footprint, which is way too big. > > It's my understanding that I can use a startup file to preload things, > but the functions to load the data use many of the request r-> functions, > which I don't have access to in the startup file. > > I may be able to rewrite my functions not to use the request functions, but > I don't want to embark on that task unless I know for sure that the > resulting data structure will reside in shared memory space. Does anyone > know for sure? Is there another (better) way to do this? If you are on apache 1.x, every child process will have a private copy of the hash data because Apache 1.x uses fork. You could get gutsy and try mod_perl under Apache2 and select multithreading instead of forking, but we just had to downgrade a server from Apache 2 to Apache 1.3.x because mod_perl was segfaulting children at random. I would think about moving the big hash into a helper daemon. Then you could get at the data via some network protocol, via a local named pipe, of possibly via shared memory (I've never tried to do shared mem stuff in perl). worst case, you could write a C based Apache Perl module that gives perl access to a hash in a shared memorty C program that is spawned at Apache startup. BUT. I would recommend one of the following work arounds that might prevent _any_ code changes. 1. Use internal Proxy stuff in a lightweight non mod_perl apache to forward the huge request to another apache that is running mod_perl, does have a huge footprint, but ONLY handles the requests that require access to the hash data. or 2. Based on traffic patterns, keep everything in the current setup, but limit the number of Apache children and make Keep-Alive very short or non-existant so that fewer children are needed. -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From mike at stok.co.uk Sun Sep 14 11:57:23 2003 From: mike at stok.co.uk (Mike Stok) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Clarified OOP problem In-Reply-To: <20030914163418.GA26526@broadq.com> Message-ID: On Sun, 14 Sep 2003, Wayne Walker wrote: > I have an issue about dynamically calling Class methods (rather than > object methods) from a derived Class. Any help would be appreciated. I'm not quite sure where the convert ought to live, but does this help any? #!/usr/bin/perl $miracle = Foo::Bar->get_data(); package Foo; sub get_data { my $class = shift; # this will = Foo::Bar at runtime $magic_dust = $class->get_dust(); $miracle = $class->convert($magic_dust); return $miracle; } package Foo::Bar; use base 'Foo'; sub get_dust { my $class = shift; return convert($beans); } sub convert { print "foo bar convert\n"; } Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA From wwalker at bybent.com Sun Sep 14 12:08:48 2003 From: wwalker at bybent.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Clarified OOP problem In-Reply-To: References: <20030914163418.GA26526@broadq.com> Message-ID: <20030914170848.GD26526@broadq.com> THANK YOU! But I sure feel stupid On Sun, Sep 14, 2003 at 12:57:23PM -0400, Mike Stok wrote: > On Sun, 14 Sep 2003, Wayne Walker wrote: > > > I have an issue about dynamically calling Class methods (rather than > > object methods) from a derived Class. Any help would be appreciated. > > I'm not quite sure where the convert ought to live, but does this help > any? < Mike set the calling sytax to $class->get_dust() > Yes, I swear that I started with $class->get_dust(); and it didn't work. I must have had something else wrong and thought it was an issue with how I was dynamically calling a subroutine from another package. Here's the test program (Mike's version but trimmed to the essentials in showing the solution to my stupid problem. #!/usr/bin/perl use strict; my $miracle = Foo::Bar->get_data(); print $miracle, "\n"; exit; package Foo; sub get_data { my $class = shift; # this will = Foo::Bar at runtime my $magic_dust = $class->get_dust(); print $magic_dust, "\n"; return $magic_dust . "via Foo::get_data()"; } package Foo::Bar; use base 'Foo'; sub get_dust { return "Got dust from Foo::Bar"; } -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Sun Sep 14 20:16:37 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI "bug" Message-ID: <20030915011637.GC29767@broadq.com> Given the following SQL: SELECT b.ID, c.ID, c.ID from Bugs as b, Clients as c, Projects as p WHERE b.project = p.ID AND p.client = c.ID; fetchall_arrayref() (or anything that uses fetchrow_arrayref()) works fine, but I dislike using array references, and prefer hashrefs. fetchrow_hashref returns only one result per row because all 3 fields have different tables but the same column name. Is there a switch in DBI to use table.column instead of just column when building hashrefs? I couldn't find one.... -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From wwalker at broadq.com Sun Sep 14 20:27:50 2003 From: wwalker at broadq.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI "bug" In-Reply-To: <20030915011637.GC29767@broadq.com> References: <20030915011637.GC29767@broadq.com> Message-ID: <20030915012750.GA30389@broadq.com> I've since found a reference in the man page that specifies that this works as I describe and I just have to live with it. :( On Sun, Sep 14, 2003 at 08:16:37PM -0500, Wayne Walker wrote: > Given the following SQL: > > SELECT b.ID, c.ID, c.ID > from Bugs as b, Clients as c, Projects as p > WHERE b.project = p.ID AND p.client = c.ID; > > fetchall_arrayref() (or anything that uses fetchrow_arrayref()) works > fine, but I dislike using array references, and prefer hashrefs. > > fetchrow_hashref returns only one result per row because all 3 fields > have different tables but the same column name. > > Is there a switch in DBI to use table.column instead of just column when > building hashrefs? I couldn't find one.... > > > -- > > Wayne Walker > > www.broadq.com :) Bringing digital video and audio to the living room > _______________________________________________ > Austin mailing list > Austin@mail.pm.org > http://mail.pm.org/mailman/listinfo/austin -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From dbii at interaction.net Sun Sep 14 21:37:34 2003 From: dbii at interaction.net (David Bluestein II) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI "bug" Message-ID: Wayne- How about this to get your ref: SELECT b.ID as bID, c.ID as cID, c.ID as cID2 from Bugs as b, Clients as c, Projects as p ... Does that give you what you need? I use that when doing hashrefs with similarly named fields in different tables. And you can decide which one to not rename and leave it under ID key. David >I've since found a reference in the man page that specifies that this >works as I describe and I just have to live with it. :( > >On Sun, Sep 14, 2003 at 08:16:37PM -0500, Wayne Walker wrote: >> Given the following SQL: >> >> SELECT b.ID, c.ID, c.ID >> from Bugs as b, Clients as c, Projects as p >> WHERE b.project = p.ID AND p.client = c.ID; >> >> fetchall_arrayref() (or anything that uses fetchrow_arrayref()) works >> fine, but I dislike using array references, and prefer hashrefs. >> >> fetchrow_hashref returns only one result per row because all 3 fields >> have different tables but the same column name. >> >> Is there a switch in DBI to use table.column instead of just column when >> building hashrefs? I couldn't find one.... >> >> >> -- >> >> Wayne Walker >> >> www.broadq.com :) Bringing digital video and audio to the living room >> _______________________________________________ >> Austin mailing list >> Austin@mail.pm.org >> http://mail.pm.org/mailman/listinfo/austin > >-- > >Wayne Walker > >www.broadq.com :) Bringing digital video and audio to the living room >_______________________________________________ >Austin mailing list >Austin@mail.pm.org >http://mail.pm.org/mailman/listinfo/austin ---------- David H. Bluestein II President & Lead Developer dbii@interaction.net ii, inc. http://www.interaction.net - Specializing in Designing Interactive Websites - - and Searchable Internet Databases - From wwalker at bybent.com Sun Sep 14 22:29:33 2003 From: wwalker at bybent.com (Wayne Walker) Date: Mon Aug 2 21:23:20 2004 Subject: APM: DBI "bug" In-Reply-To: <16229.10422.617724.956159@cs241759-235.austin.rr.com> References: <20030915011637.GC29767@broadq.com> <20030915012750.GA30389@broadq.com> <16229.10422.617724.956159@cs241759-235.austin.rr.com> Message-ID: <20030915032933.GA30408@broadq.com> THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!! It does work in DBI!!!! On Sun, Sep 14, 2003 at 09:49:26PM -0500, woody@realtime.net wrote: > > Wayne Walker writes: > > I've since found a reference in the man page that specifies that this > > works as I describe and I just have to live with it. :( > > > > On Sun, Sep 14, 2003 at 08:16:37PM -0500, Wayne Walker wrote: > > > Given the following SQL: > > > > > > SELECT b.ID, c.ID, c.ID > > > from Bugs as b, Clients as c, Projects as p > > > WHERE b.project = p.ID AND p.client = c.ID; > > I haven't tried it with DBI, but in SQL you can rename those columns: > > SELECT b.ID bug_id, c.ID client_id, p.ID project_id > > -- > woody@realtime.net -- Wayne Walker www.broadq.com :) Bringing digital video and audio to the living room From tom.bakken at tx.usda.gov Mon Sep 15 15:31:12 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm Message-ID: <000401c37bc8$538274c0$920e9dc7@agwest.one.usda.gov> I recompiled perl on a red hat linux 6.1 server going from version 5.00503 to 5.8.0. Now that it's installed and working well my Pg.pm isn't working. It's been a long time since I set it up and I can't remember if I used rpm, cpan or compiled it. When my code hits use Pg, the perl script complains that it can't find Pg.pm in any of my @INC directories. Right now I'm trying to compile pgsql_perl5-1.9.0 but the README says I need to run the perl Makefile.PL as a regular user, but then when I do when it tries to install it get Permission denied at /usr/local/lib/perl5/5.8.0 ExtUtils/MakeMaker.pm Any help would be appreciated. Tom Bakken From jeremyb at univista.com Mon Sep 15 15:44:48 2003 From: jeremyb at univista.com (jeremyb@univista.com) Date: Mon Aug 2 21:23:20 2004 Subject: APM: RE: Pg.pm Message-ID: <7D92A44098B1E64A99E9C36C9189231904B6BE@MINIBOX> First, is Pg.pm in any of the directories in @INC? If not you can either make a sym. link or copy it to a dir that is in @INC. Second, does the user have whatever permissions are needed to access the file in question? -J -----Original Message----- From: Tom Bakken [mailto:tom.bakken@tx.usda.gov] Sent: Monday, September 15, 2003 3:31 PM To: Austin Perl Mongers Subject: APM: Pg.pm I recompiled perl on a red hat linux 6.1 server going from version 5.00503 to 5.8.0. Now that it's installed and working well my Pg.pm isn't working. It's been a long time since I set it up and I can't remember if I used rpm, cpan or compiled it. When my code hits use Pg, the perl script complains that it can't find Pg.pm in any of my @INC directories. Right now I'm trying to compile pgsql_perl5-1.9.0 but the README says I need to run the perl Makefile.PL as a regular user, but then when I do when it tries to install it get Permission denied at /usr/local/lib/perl5/5.8.0 ExtUtils/MakeMaker.pm Any help would be appreciated. Tom Bakken _______________________________________________ Austin mailing list Austin@mail.pm.org http://mail.pm.org/mailman/listinfo/austin From tom.bakken at tx.usda.gov Mon Sep 15 16:24:41 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: APM: RE: Pg.pm In-Reply-To: <7D92A44098B1E64A99E9C36C9189231904B6BE@MINIBOX> Message-ID: <000501c37bcf$c6f5cc70$920e9dc7@agwest.one.usda.gov> Jeremy, I should have mentioned that I'd already tried copying Pg.pm from the old @INC to /usr/local/lib/perl5/5.8.0, which is part of the new @INC. I checked the permissions and they're identical to the old existing Pg.pm. I think we're getting warm. Under the auto directory there are 3 files. I copies them over to the corresponding /usr/local/lib/perl5/5.8.0/auto/Pg directory and things are starting to work again, but I'm still getting some errors. Tom Bakken -----Original Message----- From: jeremyb@univista.com [mailto:jeremyb@univista.com] Sent: Monday, September 15, 2003 3:45 PM To: tom.bakken@tx.usda.gov; austin-pm@pm.org Subject: RE: Pg.pm First, is Pg.pm in any of the directories in @INC? If not you can either make a sym. link or copy it to a dir that is in @INC. Second, does the user have whatever permissions are needed to access the file in question? -J -----Original Message----- From: Tom Bakken [mailto:tom.bakken@tx.usda.gov] Sent: Monday, September 15, 2003 3:31 PM To: Austin Perl Mongers Subject: APM: Pg.pm I recompiled perl on a red hat linux 6.1 server going from version 5.00503 to 5.8.0. Now that it's installed and working well my Pg.pm isn't working. It's been a long time since I set it up and I can't remember if I used rpm, cpan or compiled it. When my code hits use Pg, the perl script complains that it can't find Pg.pm in any of my @INC directories. Right now I'm trying to compile pgsql_perl5-1.9.0 but the README says I need to run the perl Makefile.PL as a regular user, but then when I do when it tries to install it get Permission denied at /usr/local/lib/perl5/5.8.0 ExtUtils/MakeMaker.pm Any help would be appreciated. Tom Bakken _______________________________________________ Austin mailing list Austin@mail.pm.org http://mail.pm.org/mailman/listinfo/austin From mlehmann at marklehmann.com Mon Sep 15 22:31:28 2003 From: mlehmann at marklehmann.com (Mark Lehmann) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Meeting Wednesday September 17th, 7:00pm at ServerGraph Message-ID: <16230.33808.534735.644003@lehmbrain.marklehmann.com> When ==== The next APM meeting is Wednesday, September 17 at 7:00 pm (ending at 8:30pm). What ==== Bill's Perl tricks Bill will demonstrate a couple of useful perl tricks. Bill will also share a couple of perl OO techniques. If time permits Bill will show how to serve remote resources via RPC thru perl. * how to pickup environment settings from a third party supplied script without having to reimplement shell syntax * how to use tie to determine what code is clobbering your default scalar * how to avoid infinite recursion on overloaded DESTROY methods. Where ===== ServerGraph, 1717 W. Sixth Street, Suite 234 Directions to ServerGraph ========================= Heading south on MoPac, exit 1/5 streets. Take the 5th street ramp, turn east at the stop sign. Take the first left at Campbell Street, then turn left on 6th street. Take the first entrance to the left. >From I-35, take the 6th street exit. Head west on 6th street. After passing Campbell Street, take the first entrance to the left. There is a decent sized free parking lot next to the bank building that ServerGraph resides in. Follow the signs to suite 234. Socializing =========== David Bluestein is coordinating the pre-meeting dinner and after meeting socializing. Expect his note soon. -- Mark Lehmann email mlehmann@marklehmann.com | phone 512 689-7705 From tom.bakken at tx.usda.gov Tue Sep 16 07:54:42 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: FW: APM: RE: Pg.pm Message-ID: <000d01c37c51$b2fbafa0$920e9dc7@agwest.one.usda.gov> Tom Bakken Information Resource Manager USDA, Rural Development 101 South Main, Suite 102 Temple, TX 76501 Phone: 254-742-9726 Fax: 254-742-9709 Email: tom.bakken@tx.usda.gov -----Original Message----- From: Philip Molter [mailto:hrunting@texas.net] Sent: Monday, September 15, 2003 5:42 PM To: Tom Bakken Subject: RE: APM: RE: Pg.pm On Mon, 15 Sep 2003, Tom Bakken wrote: : Phil, : : Making progress, but still not there yet. I believe I'm now accessing : postgres because I get complaints from postgres that root doesn't have : access to certain tables, but now I'm getting a perl error: : : Perl: error in loading shared libraries: : /usr/local/lib/perl5/5.8.0/auto/Pg/Pg.so: undefined symbol: Perl_safefree This definitely means you need to recompile. : I set up root as a user in postgres and am now attempting to recompile but : when I run make, it returns: : : Pg.xs:16: libpq-fe.h: No such file or directory. I'm not sure what kind of system you're installed on. Make sure you have the Postgres header files. If you have a RedHat system, you need to install the pgsql-devel RPM. If you have a hand-install, the header files should be installed already. : I've set them and exported the two variables that the README talks about. To cover all bases, they're set to the correct values, right? Specifically, the INC-type variable should point to an include directory of some sort, and the libpq-fe.h file should be in there. : Maybe some of these clues will help those of you fluent in this sort of : thing to pinpoint where the problem is. I think you may want to resend this to the list. I accidentally replied to you off-list earlier. From tom.bakken at tx.usda.gov Tue Sep 16 10:19:14 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm Message-ID: <001301c37c65$e6c77bc0$920e9dc7@agwest.one.usda.gov> I appreciate the help that Philip M and Jeremy B have been so far. The web server I upgraded perl on is Red Hat 6.1. I moved the Postgres database off this machine some time ago and have upgraded postgres to version 7.1. I did try to upgrade the postgres header files from RPM to version 7.1 but the version of RPM on my Red Hat 6.1 system won't accept them. When I run an rpm -q on my postgres installation it shows that all the proper packages are installed. I think the problem may be with my environmental variables. The pgsql_perl5 readme file says that I need an environmental variable named POSTGRES_INCLUDE and POSTGRES_LIB to find the library libpq.so and the include file libpq-fe.h. I found libpg.so in /usr/lib so I set POSTGRES_INCLUDE to /usr/lib and POSTGRES_LIB to /usr/include/pgsql for libpq-fe.h. I added root as a user with the ability to create databases in postgres and ran perl Makefile.pl, then make. Make still complains: Pg.xs:16: libpg-fe.h: No such file or directory. Philip asked if the INC-type variable should point to an include directory. I'm not sure where to set that. Any help is appreciated. Tom Bakken From erik at debill.org Tue Sep 16 11:02:37 2003 From: erik at debill.org (erik@debill.org) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm In-Reply-To: <001301c37c65$e6c77bc0$920e9dc7@agwest.one.usda.gov> References: <001301c37c65$e6c77bc0$920e9dc7@agwest.one.usda.gov> Message-ID: <20030916160237.GA27595@debill.org> On Tue, Sep 16, 2003 at 10:19:14AM -0500, Tom Bakken wrote: > I think the problem may be with my environmental variables. The pgsql_perl5 > readme file says that I need an environmental variable named > POSTGRES_INCLUDE and POSTGRES_LIB to find the library libpq.so and the > include file libpq-fe.h. I found libpg.so in /usr/lib so I set > POSTGRES_INCLUDE to /usr/lib and POSTGRES_LIB to /usr/include/pgsql for > libpq-fe.h. I'd grep for libpq-fe.h in Pg.xs and see what it asks for. If it does #include then you need to point to the exact directory where the header file lives. if it does: #include you need the location of that "something" directory (my Debian stable box with stock postgres packages has them in /usr/include/postgresql/libpq-fe.h) Odds are it's doing: #include and I'd set POSTGRES_INCLUDE=/usr/include Does this get any closer? Erik -- Consumerism: the one true path to world peace. From dbii at interaction.net Tue Sep 16 11:51:31 2003 From: dbii at interaction.net (David Bluestein II) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pre-Meeting Dinner Location Message-ID: For those who want to socialize over dinner before tomorrow's meeting, we're heading to Pok-E Jo's downtown, at 1603 W. 5th Street. Same food, different location. Meet there around 6:00 for dinner. After meeting socializing will be determined at the meeting based on where people would like to go. David ---------- David H. Bluestein II President & Lead Developer dbii@interaction.net ii, inc. http://www.interaction.net - Specializing in Designing Interactive Websites - - and Searchable Internet Databases - From tom.bakken at tx.usda.gov Tue Sep 16 13:13:13 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm In-Reply-To: <20030916160237.GA27595@debill.org> Message-ID: <001b01c37c7e$332fccc0$920e9dc7@agwest.one.usda.gov> Tom Bakken -----Original Message----- From: erik@debill.org [mailto:erik@debill.org] Sent: Tuesday, September 16, 2003 11:03 AM To: Tom Bakken Cc: austin-pm@pm.org Subject: Re: APM: Pg.pm On Tue, Sep 16, 2003 at 10:19:14AM -0500, Tom Bakken wrote: > I think the problem may be with my environmental variables. The > pgsql_perl5 readme file says that I need an environmental variable > named POSTGRES_INCLUDE and POSTGRES_LIB to find the library libpq.so > and the include file libpq-fe.h. I found libpg.so in /usr/lib so I > set POSTGRES_INCLUDE to /usr/lib and POSTGRES_LIB to > /usr/include/pgsql for libpq-fe.h. I'd grep for libpq-fe.h in Pg.xs and see what it asks for. If it does #include then you need to point to the exact directory where the header file lives. if it does: #include you need the location of that "something" directory (my Debian stable box with stock postgres packages has them in /usr/include/postgresql/libpq-fe.h) Odds are it's doing: #include and I'd set POSTGRES_INCLUDE=/usr/include >>I modified the Pg.xs file and that eliminated the complaint. Also changed the POSTGRES_INCLUDE to >>/usr/include. It compiled, but I still get the error: >>Perl: error in loading shared libraries: /usr/local/lib/perl5/5.8.0/auto/Pg/Pg.so: undefined symbol: >>Perl_safefree. Philip Molter thought I should recompile. Now that I've succeeded and I still get the same error, I'm. Stumped. When I run make test, I do get an error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection refused because it's trying to connect to postgres on the local server when I've moved it over to another. I wouldn't thing that would be a problem. I've googled the error and found a number of posts there I'm looking into. Does this get any closer? Yes... Just don't know how far there is left to go. I appreciate the help. Erik -- Consumerism: the one true path to world peace. From erik at debill.org Tue Sep 16 14:37:55 2003 From: erik at debill.org (erik@debill.org) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm In-Reply-To: <001b01c37c7e$332fccc0$920e9dc7@agwest.one.usda.gov> References: <20030916160237.GA27595@debill.org> <001b01c37c7e$332fccc0$920e9dc7@agwest.one.usda.gov> Message-ID: <20030916193754.GA27906@debill.org> On Tue, Sep 16, 2003 at 01:13:13PM -0500, Tom Bakken wrote: > > >>I modified the Pg.xs file and that eliminated the complaint. Also changed > the POSTGRES_INCLUDE to >>/usr/include. It compiled, but I still get the > error: > > >>Perl: error in loading shared libraries: > /usr/local/lib/perl5/5.8.0/auto/Pg/Pg.so: undefined symbol: >>Perl_safefree. Is it possible that the header files from your old version of perl are still present and getting used? Pg.so for Perl 5.6.1 (Debian stable) has a Perl_safefree in it. Pg.so for 5.8.0 (Debian unstable) doesn't. It has Perl_safesysfree instead. I checked by running strings(1) and grepping. I'm guessing that either Pg hasn't been updated to the new 5.8.0 APIs yet, or you Makefile.PL found the wrong headers and thinks you're compiling against the older version. Normally the compile would fail if the headers didn't at least promise that Perl_safefree was there (but I don't know if XS does something extra weird in it's compile step to avoid those checks). Odds are the RH base install had some headers in /usr/include that supercede the ones you just added in /usr/local/include (I'm guessing you built 5.8.0 from source). If that's what's happening you can probably just rename them and try configuring and compiling again. > Philip Molter thought I should recompile. Now that I've succeeded and I > still get the same error, I'm. Stumped. When I run make test, I do get an > error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection > refused because it's trying to connect to postgres on the local server when > I've moved it over to another. I wouldn't thing that would be a problem. > I've googled the error and found a number of posts there I'm looking into. Yeah, I'd ignore this. Erik -- Consumerism: the one true path to world peace. From msouth at shodor.org Tue Sep 16 14:44:29 2003 From: msouth at shodor.org (Mike South) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm Message-ID: <200309161944.h8GJiTSk029580@scan.shodor.org> >From austin-bounces@mail.pm.org Tue Sep 16 14:18:12 2003 >From: "Tom Bakken" [snip] > >Philip Molter thought I should recompile. Now that I've succeeded and I >still get the same error, I'm. Stumped. When I run make test, I do get an >error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection >refused because it's trying to connect to postgres on the local server when >I've moved it over to another. I wouldn't thing that would be a problem. >I've googled the error and found a number of posts there I'm looking into. > Actually if you are getting that you might, theoretically, be done--the "make test" won't succeed because it needs a server running on localhost to succeed, but if you just do the "make install" and set up a script to connect to the right machine it would work. You might be able to look in the t/ directory (I think that's where the tests would be) and see where it connects to the database and set the parameters to point to the server on the other machine. Or you might be able to set (more) environment variables before you do the "make test" that set the database host and port (I can't remember if Postgres looks in the env. for those parameters or not). I'm out on a limb here, but I'm guessing that if you got error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection refused that probably means that the extension compiled ok. But if you are googling that you may already know all this :). mike From tom.bakken at tx.usda.gov Tue Sep 16 17:45:48 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Pg.pm In-Reply-To: <200309161944.h8GJiTSk029580@scan.shodor.org> Message-ID: <002e01c37ca4$46de2430$920e9dc7@agwest.one.usda.gov> Persistence pays off. Removed the 5.8.0 directories. Recompiled perl and pgsql_perl5 and it worked! Thanks so much for all of your help. I'm going home and celebrate. Tom Bakken -----Original Message----- From: austin-bounces@mail.pm.org [mailto:austin-bounces@mail.pm.org] On Behalf Of Mike South Sent: Tuesday, September 16, 2003 2:44 PM To: erik@debill.org; tom.bakken@tx.usda.gov Cc: austin-pm@pm.org Subject: RE: APM: Pg.pm >From austin-bounces@mail.pm.org Tue Sep 16 14:18:12 2003 >From: "Tom Bakken" [snip] > >Philip Molter thought I should recompile. Now that I've succeeded and >I still get the same error, I'm. Stumped. When I run make test, I do >get an >error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection >refused because it's trying to connect to postgres on the local server when >I've moved it over to another. I wouldn't thing that would be a problem. >I've googled the error and found a number of posts there I'm looking into. > Actually if you are getting that you might, theoretically, be done--the "make test" won't succeed because it needs a server running on localhost to succeed, but if you just do the "make install" and set up a script to connect to the right machine it would work. You might be able to look in the t/ directory (I think that's where the tests would be) and see where it connects to the database and set the parameters to point to the server on the other machine. Or you might be able to set (more) environment variables before you do the "make test" that set the database host and port (I can't remember if Postgres looks in the env. for those parameters or not). I'm out on a limb here, but I'm guessing that if you got error: Pg::connectdb.....not ok: connectDB() == connect() failed: Connection refused that probably means that the extension compiled ok. But if you are googling that you may already know all this :). mike _______________________________________________ Austin mailing list Austin@mail.pm.org http://mail.pm.org/mailman/listinfo/austin From mlehmann at marklehmann.com Wed Sep 17 11:11:01 2003 From: mlehmann at marklehmann.com (Mark Lehmann) Date: Mon Aug 2 21:23:20 2004 Subject: APM: Reminder: Meeting Tonight 7:00pm - Time Saving Perl Programming Tricks Message-ID: <16232.34709.994664.886029@lehmbrain.marklehmann.com> When ==== The next APM meeting is Wednesday, September 17 at 7:00 pm (ending at 8:30pm). What ==== Bill's Perl tricks Bill will demonstrate a couple of useful perl tricks. Bill will also share a couple of perl OO techniques. If time permits Bill will show how to serve remote resources via RPC thru perl. * how to pickup environment settings from a third party supplied script without having to reimplement shell syntax * how to use tie to determine what code is clobbering your default scalar * how to avoid infinite recursion on overloaded DESTROY methods. Where ===== ServerGraph, 1717 W. Sixth Street, Suite 234 Directions to ServerGraph ========================= Heading south on MoPac, exit 1/5 streets. Take the 5th street ramp, turn east at the stop sign. Take the first left at Campbell Street, then turn left on 6th street. Take the first entrance to the left. >From I-35, take the 6th street exit. Head west on 6th street. After passing Campbell Street, take the first entrance to the left. There is a decent sized free parking lot next to the bank building that ServerGraph resides in. Follow the signs to suite 234. Socializing =========== For those who want to socialize over dinner before tomorrow's meeting, we're heading to Pok-E Jo's downtown, at 1603 W. 5th Street. Same food, different location. Meet there around 6:00 for dinner. After meeting socializing will be determined at the meeting based on where people would like to go. -- Mark Lehmann email mlehmann@marklehmann.com | phone 512 689-7705 From tom.bakken at tx.usda.gov Wed Sep 17 14:24:38 2003 From: tom.bakken at tx.usda.gov (Tom Bakken) Date: Mon Aug 2 21:23:21 2004 Subject: APM: ESQL/C Version 5 or CLIENT SDK Message-ID: <001601c37d51$56ab3670$920e9dc7@agwest.one.usda.gov> Does anybody know where to get ESQL/C Version 5 or CLIENT SDK? The README file for DBD::Informix lists it as a required package and lists sites where it can be gotten, but I'm not finding it there. Tom Bakken From woody at realtime.net Sun Sep 14 21:49:26 2003 From: woody at realtime.net (woody@realtime.net) Date: Mon Aug 2 21:23:21 2004 Subject: APM: DBI "bug" In-Reply-To: <20030915012750.GA30389@broadq.com> References: <20030915011637.GC29767@broadq.com> <20030915012750.GA30389@broadq.com> Message-ID: <16229.10422.617724.956159@cs241759-235.austin.rr.com> Wayne Walker writes: > I've since found a reference in the man page that specifies that this > works as I describe and I just have to live with it. :( > > On Sun, Sep 14, 2003 at 08:16:37PM -0500, Wayne Walker wrote: > > Given the following SQL: > > > > SELECT b.ID, c.ID, c.ID > > from Bugs as b, Clients as c, Projects as p > > WHERE b.project = p.ID AND p.client = c.ID; I haven't tried it with DBI, but in SQL you can rename those columns: SELECT b.ID bug_id, c.ID client_id, p.ID project_id -- woody@realtime.net From randysleek at hotmail.com Fri Sep 26 08:19:14 2003 From: randysleek at hotmail.com (Randall Hennig) Date: Mon Aug 2 21:23:21 2004 Subject: APM: Test and Question Message-ID: I have been having trouble sending to the newsgroup. This is a test. I am also interested in Bill's tips and tricks materal from the last meeting. I'm a novitiate Perl programmer, so I could use all the wisdom I can get. Randy _________________________________________________________________ Frustrated with dial-up? Get high-speed for as low as $29.95/month (depending on the local service providers in your area). https://broadband.msn.com From jeremyb at univista.com Fri Sep 26 10:28:04 2003 From: jeremyb at univista.com (jeremyb@univista.com) Date: Mon Aug 2 21:23:21 2004 Subject: APM: debugging a seg fault Message-ID: <7D92A44098B1E64A99E9C36C9189231904B702@MINIBOX> One of my cgi scripts is seg faulting after test execution in a shell. Using -w only mentioned a couple warnings about variables not being shared. I've run the script with strace and didn't see anything helpful. Now I'm trying to use sigtrap but the script doesn't exit with 'use sigtrap'. It just races at 98-99% CPU.... wtf? Frustrated and out of coffee, Jeremy From msouth at shodor.org Fri Sep 26 12:54:21 2003 From: msouth at shodor.org (Mike South) Date: Mon Aug 2 21:23:21 2004 Subject: APM: debugging a seg fault Message-ID: <200309261754.h8QHsLT9013992@scan.shodor.org> hard for anyone to help without seeing the source code. If it's not small, then I would suggest that you cut it down to the smallest fraction of the program that reproduces the problem, and then post that. If the script is already short enough to reasonably post in email, post it. That "no longer shared" warning, I think, has something to do with having a shared variable in nested subroutines. That could be the part of your code you want to look at if that's throwing a warning. But, again, it's too hard to guess without some idea of the code. mike From jeremyb at univista.com Fri Sep 26 13:02:44 2003 From: jeremyb at univista.com (jeremyb@univista.com) Date: Mon Aug 2 21:23:21 2004 Subject: APM: debugging a seg fault Message-ID: <7D92A44098B1E64A99E9C36C9189231904B703@MINIBOX> I should have been more clear this morning. What I meant to ask was why sigtrace might be causing the script to race forever. The script is 3355 lines.... -----Original Message----- From: Mike South [mailto:msouth@shodor.org] Sent: Friday, September 26, 2003 12:54 PM To: austin@mail.pm.org; jeremyb@univista.com Subject: Re: APM: debugging a seg fault hard for anyone to help without seeing the source code. If it's not small, then I would suggest that you cut it down to the smallest fraction of the program that reproduces the problem, and then post that. If the script is already short enough to reasonably post in email, post it. That "no longer shared" warning, I think, has something to do with having a shared variable in nested subroutines. That could be the part of your code you want to look at if that's throwing a warning. But, again, it's too hard to guess without some idea of the code. mike From jeremyb at univista.com Fri Sep 26 13:25:47 2003 From: jeremyb at univista.com (jeremyb@univista.com) Date: Mon Aug 2 21:23:21 2004 Subject: APM: debugging a seg fault Message-ID: <7D92A44098B1E64A99E9C36C9189231904B707@MINIBOX> Found it... I had terminated a line inside a of ?: conditional just before an undef. Thank Mike -----Original Message----- From: Jeremy Brooks Sent: Friday, September 26, 2003 1:18 PM To: Jeremy Brooks Subject: RE: APM: debugging a seg fault Ok, I'm a little confused now... I just placed a print statement just below the bang in the script and it doesn't print before the seg fault occurs. The print statement is: Print "Beginning Execution\n"; A little about the system and the script. Redhat 9.0 with stock kernel, Perl 5.8, DBI v. 11.23, CGI.pm v 1.75 Any thoughts on this? -----Original Message----- From: jeremyb@univista.com [mailto:jeremyb@univista.com] Sent: Friday, September 26, 2003 1:03 PM To: austin@mail.pm.org Subject: RE: APM: debugging a seg fault I should have been more clear this morning. What I meant to ask was why sigtrace might be causing the script to race forever. The script is 3355 lines.... -----Original Message----- From: Mike South [mailto:msouth@shodor.org] Sent: Friday, September 26, 2003 12:54 PM To: austin@mail.pm.org; jeremyb@univista.com Subject: Re: APM: debugging a seg fault hard for anyone to help without seeing the source code. If it's not small, then I would suggest that you cut it down to the smallest fraction of the program that reproduces the problem, and then post that. If the script is already short enough to reasonably post in email, post it. That "no longer shared" warning, I think, has something to do with having a shared variable in nested subroutines. That could be the part of your code you want to look at if that's throwing a warning. But, again, it's too hard to guess without some idea of the code. mike _______________________________________________ Austin mailing list Austin@mail.pm.org http://mail.pm.org/mailman/listinfo/austin From jeremyb at univista.com Tue Sep 30 09:15:05 2003 From: jeremyb at univista.com (jeremyb@univista.com) Date: Mon Aug 2 21:23:21 2004 Subject: APM: a project Message-ID: <7D92A44098B1E64A99E9C36C9189231904B720@MINIBOX> I'm looking for help on a rather large project I've been soloing for the last year or so. In general it's a content delivery system for mobile devices. I need help finishing up some loose ends so I can release in a month. If anyone's interested in working with me please email me off list. -Jeremy Brooks