From extasia at gmail.com Fri Mar 11 18:11:11 2005 From: extasia at gmail.com (David Alban) Date: Fri Mar 11 19:06:22 2005 Subject: [sf-perl] hostname "unknown" Message-ID: <4c714a9c05031118116f68c426@mail.gmail.com> Greetings, I find myself in the position of having written a tool or two to be run both on machines getting their IP info using dhcp and machines not doing so. The machines in question happen to be running solaris. I get the following for hostname on the dhcp clients: Sys::Hostname::hostname(): unknown Net::Domain::hostfqdn(): unknown.my.domain Net::Domain::hostname(): unknown "unknown" is unacceptable because if more than one machine "uses" it, we don't have unique hostfqdn's. One solution is to use a machine's hostid as its hostname. Another option, which is what I did, also used hostid. Say my current host, a dhcp client, has hostid "8012abcd". I check for the existence of $ENV{ _0812abcd }. If defined, I use its value as hostname. If it isn't defined, or if I can't determine the hostid of the current host, the hostname remains "unknown". Heh heh. As soon as I write this, I realize that what I *should* have done is: if I can get a hostid but the appropriate $ENV{ _nnnnnnnn } variable isn't set, I should have used the hostid as the hostname. And if I couldn't get a hostid, I should have (it would be O.K. for my application) had the the tool die. Hmmm... Maybe I'll fix it. The reason I look for a $ENV{ _nnnnnnnn } environment variable is that some of the hosts running dhcp clients have informal hostnames. For instance, we might think of a host as "foobarbat" even though it's hostname() returns "unknown". If $_nnnnnnnn is set to "foobarbat" in the environment, then my tool can report foobarbat as the host's hostname. I don't mean to present my solution as good, bad, or ugly, but for the sake of discussion, I thought it might be interesting to see if others had been in the situation where they didn't want to use "unknown" as a hostname for dhcp clients, and to see what they did. Thanks, David -- Live in a world of your own, but always welcome visitors. From vlb at cfcl.com Sun Mar 13 11:27:16 2005 From: vlb at cfcl.com (Vicki Brown) Date: Sun Mar 13 11:27:44 2005 Subject: [sf-perl] Administrivia: implicit addresses Message-ID: The mailman program gets picky about what it calls "implicit addresses". What this means is that it requires the list address to be in the To: or Cc: fields. What this means is: Do not Bcc: this list It is possible to set "acceptable aliases" for the list. Up until this morning, there were no acceptable aliases (please accept my apologies). If this mail reaches the list, it means that I have successfully informed mailman that sfpug@sf.pm.org is an acceptable address. -- Vicki Brown ZZZ Journeyman Sourceror: zz |\ _,,,---,,_ Code, Docs, Process, Scripts & Philtres zz /,`.-'`' -. ;-;;,_ Perl, WWW, Mac OS X http://cfcl.com/vlb |,4- ) )-,_. ,\ ( `'-' SF Bay Area, CA USA _______________________ '---''(_/--' `-'\_) ___________________________ From extasia at gmail.com Sun Mar 13 15:06:28 2005 From: extasia at gmail.com (David Alban) Date: Sun Mar 13 15:06:36 2005 Subject: [sf-perl] Re: hostname "unknown" In-Reply-To: <4c714a9c05031118116f68c426@mail.gmail.com> References: <4c714a9c05031118116f68c426@mail.gmail.com> Message-ID: <4c714a9c050313150670a8e12e@mail.gmail.com> Greetings, I find myself in the position of having written a tool or two to be run both on machines getting their IP info using dhcp and machines not doing so. The machines in question happen to be running solaris. I get the following for hostname on the dhcp clients: Sys::Hostname::hostname(): unknown Net::Domain::hostfqdn(): unknown.my.domain Net::Domain::hostname(): unknown "unknown" is unacceptable because if more than one machine "uses" it, we don't have unique hostfqdn's. One solution is to use a machine's hostid as its hostname. Another option, which is what I did, also used hostid. Say my current host, a dhcp client, has hostid "8012abcd". I check for the existence of $ENV{ _0812abcd }. If defined, I use its value as hostname. If it isn't defined, or if I can't determine the hostid of the current host, the hostname remains "unknown". Heh heh. As soon as I write this, I realize that what I *should* have done is: if I can get a hostid but the appropriate $ENV{ _nnnnnnnn } variable isn't set, I should have used the hostid as the hostname. And if I couldn't get a hostid, I should have (it would be O.K. for my application) had the the tool die. Hmmm... Maybe I'll fix it. The reason I look for a $ENV{ _nnnnnnnn } environment variable is that some of the hosts running dhcp clients have informal hostnames. For instance, we might think of a host as "foobarbat" even though it's hostname() returns "unknown". If $_nnnnnnnn is set to "foobarbat" in the environment, then my tool can report foobarbat as the host's hostname. I don't mean to present my solution as good, bad, or ugly, but for the sake of discussion, I thought it might be interesting to see if others had been in the situation where they didn't want to use "unknown" as a hostname for dhcp clients, and to see what they did. Thanks, David -- Live in a world of your own, but always welcome visitors. From garth at perijove.com Sun Mar 13 15:28:36 2005 From: garth at perijove.com (Garth Winter Webb) Date: Sun Mar 13 15:39:18 2005 Subject: [sf-perl] hostname "unknown" In-Reply-To: <4c714a9c05031118116f68c426@mail.gmail.com> References: <4c714a9c05031118116f68c426@mail.gmail.com> Message-ID: <1110756516.27397.32432.camel@jackson.perijove.com> I'm a little confused...is this email a question or an answer? And if its an answer, what was the original problem? If this is a question, why do you need a unique hostname? In what subset of machines does it have to be unique (LAN, WAN, just application servers, etc). Why would %ENV be populated with "_$hostid" in the first place? Why can't you make sure that all your hosts are setup with proper hostnames? It seems like an easier solution to fix the DHCP server settings to always give out a unique hostname, or give each machine its own host name manually. Signed, Missing Context in SF On Fri, 2005-03-11 at 18:11, David Alban wrote: > Greetings, > > I find myself in the position of having written a tool or two to be > run both on machines getting their IP info using dhcp and machines not > doing so. The machines in question happen to be running solaris. I > get the following for hostname on the dhcp clients: > > Sys::Hostname::hostname(): unknown > Net::Domain::hostfqdn(): unknown.my.domain > Net::Domain::hostname(): unknown > > "unknown" is unacceptable because if more than one machine "uses" it, > we don't have unique hostfqdn's. One solution is to use a machine's > hostid as its hostname. > > Another option, which is what I did, also used hostid. Say my current > host, a dhcp client, has hostid "8012abcd". I check for the existence > of $ENV{ _0812abcd }. If defined, I use its value as hostname. If it > isn't defined, or if I can't determine the hostid of the current host, > the hostname remains "unknown". > > Heh heh. As soon as I write this, I realize that what I *should* have > done is: if I can get a hostid but the appropriate $ENV{ _nnnnnnnn } > variable isn't set, I should have used the hostid as the hostname. > And if I couldn't get a hostid, I should have (it would be O.K. for my > application) had the the tool die. Hmmm... Maybe I'll fix it. > > The reason I look for a $ENV{ _nnnnnnnn } environment variable is that > some of the hosts running dhcp clients have informal hostnames. For > instance, we might think of a host as "foobarbat" even though it's > hostname() returns "unknown". If $_nnnnnnnn is set to "foobarbat" in > the environment, then my tool can report foobarbat as the host's > hostname. > > I don't mean to present my solution as good, bad, or ugly, but for the > sake of discussion, I thought it might be interesting to see if others > had been in the situation where they didn't want to use "unknown" as a > hostname for dhcp clients, and to see what they did. > > Thanks, > David -- Garth Winter Webb From qw at sf.pm.org Wed Mar 16 12:39:01 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Wed Mar 16 12:35:20 2005 Subject: [sf-perl] Please respond: testing Message-ID: <20050316203901.GB51809@cfcl.com> I'm testing whether sfpug@sf.pm.org still works. Someone please email me if you get this. (I'll deal with the spam of multiple responses.) Thanks, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From ds94103 at earthlink.net Wed Mar 16 12:36:33 2005 From: ds94103 at earthlink.net (David Scott) Date: Wed Mar 16 12:36:53 2005 Subject: [sf-perl] Got it Message-ID: <423898D1.7000905@earthlink.net> From aldis at ratdog.com Wed Mar 16 12:38:15 2005 From: aldis at ratdog.com (aldis) Date: Wed Mar 16 12:38:37 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316203901.GB51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> Message-ID: <6.0.1.1.1.20050316123811.01c1e700@mail.ratdog.com> got it At 12:39 PM 3/16/2005, you wrote: >I'm testing whether sfpug@sf.pm.org still works. Someone please email >me if you get this. (I'll deal with the spam of multiple responses.) > >Thanks, > >-- >qw (Quinn Weaver); #President, San Francisco Perl Mongers >=for information, visit http://sf.pm.org/weblog =cut > >_______________________________________________ >SanFrancisco-pm mailing list >SanFrancisco-pm@pm.org >http://mail.pm.org/mailman/listinfo/sanfrancisco-pm From qw at sf.pm.org Wed Mar 16 13:03:52 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Wed Mar 16 13:00:05 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316203901.GB51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> Message-ID: <20050316210352.GC51809@cfcl.com> On Wed, Mar 16, 2005 at 12:39:01PM -0800, Quinn Weaver wrote: > I'm testing whether sfpug@sf.pm.org still works. Someone please email > me if you get this. (I'll deal with the spam of multiple responses.) Thanks for responding. I'm glad to see that mail is getting through. Next question: Did y'all get the DBI-link meeting announcement? I sent it once today and once on Saturday. I've attached copies for reference. I don't see it in my own inbox, which makes me suspicious. Engage spam torpedoes... fire! -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut -------------- next part -------------- An embedded message was scrubbed... From: Quinn Weaver Subject: Next meeting: DBI-Link talk, March 22 Date: Sat, 12 Mar 2005 09:19:24 -0800 Size: 1173 Url: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20050316/9a47b0d0/attachment.eml -------------- next part -------------- An embedded message was scrubbed... From: Quinn Weaver Subject: Next meeting: DBI-Link talk, March 22 Date: Wed, 16 Mar 2005 12:16:39 -0800 Size: 1238 Url: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20050316/9a47b0d0/attachment-0001.eml From bob.goolsby at gmail.com Wed Mar 16 13:00:48 2005 From: bob.goolsby at gmail.com (Bob goolsby) Date: Wed Mar 16 13:01:03 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <6.0.1.1.1.20050316123811.01c1e700@mail.ratdog.com> References: <20050316203901.GB51809@cfcl.com> <6.0.1.1.1.20050316123811.01c1e700@mail.ratdog.com> Message-ID: <1a208dd05031613005d7cf422@mail.gmail.com> Received and read. B On Wed, 16 Mar 2005 12:38:15 -0800, aldis wrote: > got it > > At 12:39 PM 3/16/2005, you wrote: > >I'm testing whether sfpug@sf.pm.org still works. Someone please email > >me if you get this. (I'll deal with the spam of multiple responses.) > > > >Thanks, > > > >-- > >qw (Quinn Weaver); #President, San Francisco Perl Mongers > >=for information, visit http://sf.pm.org/weblog =cut > > > >_______________________________________________ > >SanFrancisco-pm mailing list > >SanFrancisco-pm@pm.org > >http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm@pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > From bob.goolsby at gmail.com Wed Mar 16 13:02:44 2005 From: bob.goolsby at gmail.com (Bob goolsby) Date: Wed Mar 16 13:02:55 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316210352.GC51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> Message-ID: <1a208dd050316130277cdceac@mail.gmail.com> rsvp. I will make a concerted effort to keep Tuesday Next free. B On Wed, 16 Mar 2005 13:03:52 -0800, Quinn Weaver wrote: > On Wed, Mar 16, 2005 at 12:39:01PM -0800, Quinn Weaver wrote: > > I'm testing whether sfpug@sf.pm.org still works. Someone please email > > me if you get this. (I'll deal with the spam of multiple responses.) > > Thanks for responding. I'm glad to see that mail is getting through. > > Next question: Did y'all get the DBI-link meeting announcement? > I sent it once today and once on Saturday. I've attached copies > for reference. I don't see it in my own inbox, which makes me > suspicious. > > Engage spam torpedoes... fire! > > -- > qw (Quinn Weaver); #President, San Francisco Perl Mongers > =for information, visit http://sf.pm.org/weblog =cut > > > > ---------- Forwarded message ---------- > From: Quinn Weaver > To: sanfrancisco-pm@sf.pm.org > Date: Sat, 12 Mar 2005 09:19:24 -0800 > Subject: Next meeting: DBI-Link talk, March 22 > Hey, all you Perl Mongers, > > I hope you've recovered from the abundant Thai food of last month's meeting. > ;) > > For this month, long-time Perl Monger David Fetter will present DBI-Link, > a PostgreSQL extension that enables "treating any data source you can reach > with DBI as a PostgreSQL table." (Stop and think about that for a minute. > The implications are huge.) Dave is the author and lead maintainer. > > I am working on lining up pizza sponsorship. To be included, RSVP to > qw@sf.pm.org. :) (Also, please include your name[s] so I can > fast-track you past building security.) > > The meeting is March 22; that's a week from Tuesday. Location details > are at http://sf.pm.org/weblog . We're meeting at BGI as usual. > > -- > qw (Quinn Weaver); #President, San Francisco Perl Mongers > =for information, visit http://sf.pm.org/weblog =cut > > > > ---------- Forwarded message ---------- > From: Quinn Weaver > To: sanfrancisco-pm@sf.pm.org > Date: Wed, 16 Mar 2005 12:16:39 -0800 > Subject: Next meeting: DBI-Link talk, March 22 > It appears this didn't reach the list before. Trying again... > > Hey, all you Perl Mongers, > > I hope you've recovered from the abundant Thai food of last month's meeting. > ;) > > For this month, long-time Perl Monger David Fetter will present DBI-Link, > a PostgreSQL extension that enables "treating any data source you can reach > with DBI as a PostgreSQL table." (Stop and think about that for a minute. > The implications are huge.) Dave is the author and lead maintainer. > > I am working on lining up pizza sponsorship. To be included, RSVP to > qw@sf.pm.org. :) (Also, please include your name[s] so I can > fast-track you past building security.) > > The meeting is March 22; that's a week from Tuesday. Location details > are at http://sf.pm.org/weblog . We're meeting at BGI as usual. > > -- > qw (Quinn Weaver); #President, San Francisco Perl Mongers > =for information, visit http://sf.pm.org/weblog =cut > > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm@pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > > > From qw at sf.pm.org Wed Mar 16 13:23:13 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Wed Mar 16 13:19:23 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316210352.GC51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> Message-ID: <20050316212313.GG51809@cfcl.com> Thanks for the RSVPs, everyone. Keep 'em coming in! However, I'm still interested in knowing if the original messages reached y'all. They sure didn't reach me. :( Can anyone confirm (or deny) having received them? Thanks, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From rdacker at pacbell.net Wed Mar 16 13:34:39 2005 From: rdacker at pacbell.net (ackerman) Date: Wed Mar 16 13:34:53 2005 Subject: [in] Re: [sf-perl] Please respond: testing In-Reply-To: <20050316210352.GC51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> Message-ID: <0532dedd7181a2e31bc9a24fb8d7e2a0@pacbell.net> On Mar 16, 2005, at 1:03 PM, Quinn Weaver wrote: > Next question: Did y'all get the DBI-link meeting announcement? > i didn't get the original announcements. i will be attending the meeting. bob ackerman From qw at sf.pm.org Wed Mar 16 14:09:57 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Wed Mar 16 14:06:08 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316212313.GG51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> <20050316212313.GG51809@cfcl.com> Message-ID: <20050316220957.GA72744@cfcl.com> All right, the consensus is that the original messages did not arrive. Staring at them, I suddenly realized why: I sent to sanfrancisco-pm@sf.pm.org, not sanfrancisco-pm@pm.org . The former failed with no bounce message. At this point I'd like to apologize to David for getting his talk announced so late, and to the list for all the fuss. Sorry, everyone. I should have noticed that address difference. :( It's especially important that you RSVP now; please keep the RSVP's coming in to qw@sf.pm.org. I will write back tomorrow with food details. Thanks, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From wsanders at cruzio.com Wed Mar 16 16:20:44 2005 From: wsanders at cruzio.com (Walt Sanders) Date: Wed Mar 16 16:21:00 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316210352.GC51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> Message-ID: <6.2.1.2.2.20050316162017.02341a18@mail.cruzio.com> At 01:03 PM 3/16/2005, you wrote: >On Wed, Mar 16, 2005 at 12:39:01PM -0800, Quinn Weaver wrote: > > I'm testing whether sfpug@sf.pm.org still works. Someone please email > > me if you get this. (I'll deal with the spam of multiple responses.) Got it! From josh at agliodbs.com Wed Mar 16 16:28:18 2005 From: josh at agliodbs.com (Josh Berkus) Date: Wed Mar 16 16:24:02 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316212313.GG51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> <20050316212313.GG51809@cfcl.com> Message-ID: <200503161628.18966.josh@agliodbs.com> Quinn, Well, I didn't get this message. ;-) But I'll probably (80%) be at the meeting. --Josh -- __Aglio Database Solutions_______________ Josh Berkus Consultant josh@agliodbs.com www.agliodbs.com Ph: 415-752-2500 Fax: 415-752-2387 2166 Hayes Suite 200 San Francisco, CA From squid at panix.com Wed Mar 16 19:19:35 2005 From: squid at panix.com (Yeoh Yiu) Date: Wed Mar 16 19:19:45 2005 Subject: [sf-perl] Please respond: testing In-Reply-To: <20050316210352.GC51809@cfcl.com> References: <20050316203901.GB51809@cfcl.com> <20050316210352.GC51809@cfcl.com> Message-ID: Quinn Weaver writes: > On Wed, Mar 16, 2005 at 12:39:01PM -0800, Quinn Weaver wrote: > > I'm testing whether sfpug@sf.pm.org still works. Someone please email > > me if you get this. (I'll deal with the spam of multiple responses.) > > Thanks for responding. I'm glad to see that mail is getting through. > > Next question: Did y'all get the DBI-link meeting announcement? > I sent it once today and once on Saturday. I've attached copies > for reference. I don't see it in my own inbox, which makes me > suspicious. > > Engage spam torpedoes... fire! No, didn't see DBI item. From vlb at cfcl.com Wed Mar 16 23:15:45 2005 From: vlb at cfcl.com (Vicki Brown) Date: Wed Mar 16 23:16:05 2005 Subject: [sf-perl] Administrivia: implicit addresses In-Reply-To: References: Message-ID: Gentle People - Could we all agree to stop responding to the list for Quinn's test? Before I have to add a spam filter? :/ I fixed this problem on Sunday, honest I did. (If y'all want to keep writing to Quinn, hey, that's OK with me, but please don't cc: the list anymore. :-) -- Vicki Brown ZZZ Journeyman Sourceror: zz |\ _,,,---,,_ Code, Docs, Process, Scripts & Philtres zz /,`.-'`' -. ;-;;,_ Perl, WWW, Mac OS X http://cfcl.com/vlb |,4- ) )-,_. ,\ ( `'-' SF Bay Area, CA USA _______________________ '---''(_/--' `-'\_) ___________________________ From qw at sf.pm.org Thu Mar 17 20:10:58 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Thu Mar 17 20:06:59 2005 Subject: [sf-perl] Food arrangements for Tuesday Message-ID: <20050318041058.GA71094@cfcl.com> OK, I haven't been able to get a sponsor for this particular meeting. So, on Tuesday, I'll just order pizza for those who are interested and we can split the cost (just like in the old days). If you've RSVP'ed, there's no need to re-RSVP, unless you're really picky about toppings. If you haven't RSVP'ed, get with the program already. ;) We now return you to your regularly scheduled programming. Thanks, -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From deloreanx at yahoo.co.uk Sun Mar 20 21:40:00 2005 From: deloreanx at yahoo.co.uk (Mitch Washington) Date: Sun Mar 20 21:40:10 2005 Subject: [sf-perl] Food arrangements for Tuesday In-Reply-To: 6667 Message-ID: <20050321054000.70691.qmail@web26208.mail.ukl.yahoo.com> Where is the meeting? --- Quinn Weaver wrote: > OK, I haven't been able to get a sponsor for this > particular meeting. > So, on Tuesday, I'll just order pizza for those who > are interested and > we can split the cost (just like in the old days). > > If you've RSVP'ed, there's no need to re-RSVP, > unless you're really > picky about toppings. > > If you haven't RSVP'ed, get with the program > already. ;) > > We now return you to your regularly scheduled > programming. > > Thanks, > > -- > qw (Quinn Weaver); #President, San Francisco Perl > Mongers > =for information, visit http://sf.pm.org/weblog =cut > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm@pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ From qw at sf.pm.org Sun Mar 20 23:22:05 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Sun Mar 20 23:19:55 2005 Subject: [sf-perl] Food arrangements for Tuesday In-Reply-To: <20050321054000.70691.qmail@web26208.mail.ukl.yahoo.com> References: <20050321054000.70691.qmail@web26208.mail.ukl.yahoo.com> Message-ID: <20050321072205.GB37567@cfcl.com> On Mon, Mar 21, 2005 at 05:40:00AM +0000, Mitch Washington wrote: > Where is the meeting? It's at Barclays Global Investors, at 45 Fremont St. (between Market and Mission). These details and others (e.g. parking info) are at http://sf.pm.org/weblog/archives/00000023.html . -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From qw at sf.pm.org Mon Mar 21 11:05:08 2005 From: qw at sf.pm.org (Quinn Weaver) Date: Mon Mar 21 11:02:56 2005 Subject: [sf-perl] Reminder: Meeting Tuesday Message-ID: <20050321190508.GA14193@cfcl.com> This is a reminder that we're meeting tomorrow for David Fetter's presentation on DBI-Link. If you haven't yet, please RSVP please to qw@sf.pm.org. DBI-Link is a PostgreSQL extension, written in Perl, that enables "treating any data source you can reach with DBI as a PostgreSQL table." So you can treat CSVs as Postgres data. And, as David points out, you can finally do real joins against a MySQL table. ;) Time, location, and transit details are all at http://sf.pm.org/weblog/archives/00000023.html . Hope to see you there! -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut From deloreanx at yahoo.co.uk Tue Mar 22 09:28:43 2005 From: deloreanx at yahoo.co.uk (Mitch Washington) Date: Tue Mar 22 09:28:56 2005 Subject: [sf-perl] Food arrangements for Tuesday In-Reply-To: 6667 Message-ID: <20050322172843.27049.qmail@web26206.mail.ukl.yahoo.com> Thx for emailing me back Quinn Weaver wrote:On Mon, Mar 21, 2005 at 05:40:00AM +0000, Mitch Washington wrote: > Where is the meeting? It's at Barclays Global Investors, at 45 Fremont St. (between Market and Mission). These details and others (e.g. parking info) are at http://sf.pm.org/weblog/archives/00000023.html . -- qw (Quinn Weaver); #President, San Francisco Perl Mongers =for information, visit http://sf.pm.org/weblog =cut _______________________________________________ SanFrancisco-pm mailing list SanFrancisco-pm@pm.org http://mail.pm.org/mailman/listinfo/sanfrancisco-pm Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20050322/8a90038a/attachment.htm From doom at kzsu.stanford.edu Wed Mar 23 19:26:22 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Wed Mar 23 19:26:31 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <20050321190508.GA14193@cfcl.com> Message-ID: <200503240326.j2O3QMP97903@mail0.rawbw.com> Before the last meeting, Rich Morin and Josh Berkus were talking about the issues involved with translating data structures between XML to SQL. I just came across something on CPAN that looks relevent, DBIx::DBStag::Cookbook: http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm This will give an outline of how to build a normalised relational database from XML source data, set up SQL templates, issue relational queries that return hierarchical results (as XML or as perl objects), and autogenerate a web query front end for this data. Why would you want to do this? Well, it gives you the full power of the relational model and SQL, combined with the convenience of representations which allow for the nesting of data entities (SQL query results are typically flat relations which are inconvenient for complex hierarchical data). The "Stag" concept is funny... a generalization of XML and sexps: http://stag.sourceforge.net/ Data::Stag This perl module is for querying and manipulating complex data as recursively nested tag/value pairs (Structured tags or Simple Tree aggreggates). Procedural and object-oriented modes are supported. Tags can be accessed by autogenerated accessor methods. XML is a hierarchical data format, so this module can be used as an XML parser/writer. Other hierarchical formats are supported, including lisp S-Expressions (i.e. SXML) and indented-text. From doom at kzsu.stanford.edu Wed Mar 23 19:26:22 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Wed Mar 23 19:26:46 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <20050321190508.GA14193@cfcl.com> Message-ID: <200503240326.j2O3QMP97903@mail0.rawbw.com> Before the last meeting, Rich Morin and Josh Berkus were talking about the issues involved with translating data structures between XML to SQL. I just came across something on CPAN that looks relevent, DBIx::DBStag::Cookbook: http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm This will give an outline of how to build a normalised relational database from XML source data, set up SQL templates, issue relational queries that return hierarchical results (as XML or as perl objects), and autogenerate a web query front end for this data. Why would you want to do this? Well, it gives you the full power of the relational model and SQL, combined with the convenience of representations which allow for the nesting of data entities (SQL query results are typically flat relations which are inconvenient for complex hierarchical data). The "Stag" concept is funny... a generalization of XML and sexps: http://stag.sourceforge.net/ Data::Stag This perl module is for querying and manipulating complex data as recursively nested tag/value pairs (Structured tags or Simple Tree aggreggates). Procedural and object-oriented modes are supported. Tags can be accessed by autogenerated accessor methods. XML is a hierarchical data format, so this module can be used as an XML parser/writer. Other hierarchical formats are supported, including lisp S-Expressions (i.e. SXML) and indented-text. From cjm at fruitfly.org Thu Mar 24 07:43:16 2005 From: cjm at fruitfly.org (Chris Mungall) Date: Thu Mar 24 07:43:29 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <200503240326.j2O3QMP97903@mail0.rawbw.com> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> Message-ID: Hi Joseph I'm the author of this, and as it happens I'm an occasional lurker on sfpm. Glad you found the module interesting. It is being actively used in a number of bioinformatics projects at the moment. Yes, lots of people find the stag concept a bit funny, I'm emphasising that less these days, the module can be used as a general SQL<->XML mapping tools. The whole module is here: http://search.cpan.org/~cmungall/DBIx-DBStag/ I haven't made it out to an sfpug event yet but I'm always happy to chat about SQLy-XMLy-perly stuff. Cheers Chris On Wed, 23 Mar 2005, Joseph Brenner wrote: > > Before the last meeting, Rich Morin and Josh Berkus were talking > about the issues involved with translating data structures > between XML to SQL. I just came across something on CPAN that > looks relevent, DBIx::DBStag::Cookbook: > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > > This will give an outline of how to build a normalised > relational database from XML source data, set up SQL > templates, issue relational queries that return hierarchical > results (as XML or as perl objects), and autogenerate a web > query front end for this data. > > Why would you want to do this? Well, it gives you the full > power of the relational model and SQL, combined with the > convenience of representations which allow for the nesting of > data entities (SQL query results are typically flat relations > which are inconvenient for complex hierarchical data). > > The "Stag" concept is funny... a generalization of XML and sexps: > > http://stag.sourceforge.net/ > > Data::Stag > > This perl module is for querying and manipulating complex data > as recursively nested tag/value pairs (Structured tags or > Simple Tree aggreggates). Procedural and object-oriented modes > are supported. Tags can be accessed by autogenerated accessor > methods. > > XML is a hierarchical data format, so this module can be used > as an XML parser/writer. Other hierarchical formats are > supported, including lisp S-Expressions (i.e. SXML) and > indented-text. > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm@pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > From cjm at fruitfly.org Thu Mar 24 07:43:16 2005 From: cjm at fruitfly.org (Chris Mungall) Date: Thu Mar 24 07:43:38 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <200503240326.j2O3QMP97903@mail0.rawbw.com> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> Message-ID: Hi Joseph I'm the author of this, and as it happens I'm an occasional lurker on sfpm. Glad you found the module interesting. It is being actively used in a number of bioinformatics projects at the moment. Yes, lots of people find the stag concept a bit funny, I'm emphasising that less these days, the module can be used as a general SQL<->XML mapping tools. The whole module is here: http://search.cpan.org/~cmungall/DBIx-DBStag/ I haven't made it out to an sfpug event yet but I'm always happy to chat about SQLy-XMLy-perly stuff. Cheers Chris On Wed, 23 Mar 2005, Joseph Brenner wrote: > > Before the last meeting, Rich Morin and Josh Berkus were talking > about the issues involved with translating data structures > between XML to SQL. I just came across something on CPAN that > looks relevent, DBIx::DBStag::Cookbook: > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > > This will give an outline of how to build a normalised > relational database from XML source data, set up SQL > templates, issue relational queries that return hierarchical > results (as XML or as perl objects), and autogenerate a web > query front end for this data. > > Why would you want to do this? Well, it gives you the full > power of the relational model and SQL, combined with the > convenience of representations which allow for the nesting of > data entities (SQL query results are typically flat relations > which are inconvenient for complex hierarchical data). > > The "Stag" concept is funny... a generalization of XML and sexps: > > http://stag.sourceforge.net/ > > Data::Stag > > This perl module is for querying and manipulating complex data > as recursively nested tag/value pairs (Structured tags or > Simple Tree aggreggates). Procedural and object-oriented modes > are supported. Tags can be accessed by autogenerated accessor > methods. > > XML is a hierarchical data format, so this module can be used > as an XML parser/writer. Other hierarchical formats are > supported, including lisp S-Expressions (i.e. SXML) and > indented-text. > > _______________________________________________ > SanFrancisco-pm mailing list > SanFrancisco-pm@pm.org > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm > From doom at kzsu.stanford.edu Thu Mar 24 10:10:43 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Thu Mar 24 10:10:53 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: References: <200503240326.j2O3QMP97903@mail0.rawbw.com> Message-ID: <200503241810.j2OIAhP89485@mail0.rawbw.com> Chris Mungall wrote: > Joseph Brenner wrote: > > Before the last meeting, Rich Morin and Josh Berkus were talking > > about the issues involved with translating data structures > > between XML to SQL. I just came across something on CPAN that > > looks relevent, DBIx::DBStag::Cookbook: > > > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > I'm the author of this, and as it happens I'm an occasional lurker on > sfpm. Glad you found the module interesting. It is being actively used in > a number of bioinformatics projects at the moment. > > Yes, lots of people find the stag concept a bit funny, I'm emphasising > that less these days, the module can be used as a general SQL<->XML > mapping tools. What I meant was that sometimes you get the usual technical religious wars going with the XML vs. lisp s-expressions. Your answer is something like "what's the difference?", that's what makes it funny. > I haven't made it out to an sfpug event yet but I'm always happy to chat > about SQLy-XMLy-perly stuff. Well you know, if you feel like giving a little presentation on DBIx::DBStag sometime, I'd certainly be interested. From doom at kzsu.stanford.edu Thu Mar 24 10:10:43 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Thu Mar 24 10:11:06 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: References: <200503240326.j2O3QMP97903@mail0.rawbw.com> Message-ID: <200503241810.j2OIAhP89485@mail0.rawbw.com> Chris Mungall wrote: > Joseph Brenner wrote: > > Before the last meeting, Rich Morin and Josh Berkus were talking > > about the issues involved with translating data structures > > between XML to SQL. I just came across something on CPAN that > > looks relevent, DBIx::DBStag::Cookbook: > > > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > I'm the author of this, and as it happens I'm an occasional lurker on > sfpm. Glad you found the module interesting. It is being actively used in > a number of bioinformatics projects at the moment. > > Yes, lots of people find the stag concept a bit funny, I'm emphasising > that less these days, the module can be used as a general SQL<->XML > mapping tools. What I meant was that sometimes you get the usual technical religious wars going with the XML vs. lisp s-expressions. Your answer is something like "what's the difference?", that's what makes it funny. > I haven't made it out to an sfpug event yet but I'm always happy to chat > about SQLy-XMLy-perly stuff. Well you know, if you feel like giving a little presentation on DBIx::DBStag sometime, I'd certainly be interested. From josh at agliodbs.com Thu Mar 24 10:17:48 2005 From: josh at agliodbs.com (Josh Berkus) Date: Thu Mar 24 10:13:17 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <200503241810.j2OIAhP89485@mail0.rawbw.com> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> <200503241810.j2OIAhP89485@mail0.rawbw.com> Message-ID: <200503241017.48444.josh@agliodbs.com> > Well you know, if you feel like giving a little presentation on > DBIx::DBStag sometime, I'd certainly be interested. Me too! Pleeeeeeeeeeease? -- --Josh Josh Berkus Aglio Database Solutions San Francisco From david at fetter.org Thu Mar 24 11:37:40 2005 From: david at fetter.org (David Fetter) Date: Thu Mar 24 11:37:51 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <200503241810.j2OIAhP89485@mail0.rawbw.com> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> <200503241810.j2OIAhP89485@mail0.rawbw.com> Message-ID: <20050324193740.GA23549@fetter.org> On Thu, Mar 24, 2005 at 10:10:43AM -0800, Joseph Brenner wrote: > > Chris Mungall wrote: > > > Joseph Brenner wrote: > > > > Before the last meeting, Rich Morin and Josh Berkus were talking > > > about the issues involved with translating data structures > > > between XML to SQL. I just came across something on CPAN that > > > looks relevent, DBIx::DBStag::Cookbook: > > > > > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > > > I'm the author of this, and as it happens I'm an occasional lurker > > on sfpm. Glad you found the module interesting. It is being > > actively used in a number of bioinformatics projects at the > > moment. > > > > Yes, lots of people find the stag concept a bit funny, I'm > > emphasising that less these days, the module can be used as a > > general SQL<->XML mapping tools. > > What I meant was that sometimes you get the usual technical > religious wars going with the XML vs. lisp s-expressions. Your > answer is something like "what's the difference?", that's what makes > it funny. > > > I haven't made it out to an sfpug event yet but I'm always happy > > to chat about SQLy-XMLy-perly stuff. > > Well you know, if you feel like giving a little presentation on > DBIx::DBStag sometime, I'd certainly be interested. Me, too! BTW, do you have any plans to integrate this with the SQL:2003 standard WITH RECURSIVE syntax, or is it orthogonal, or...? Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! From josh at agliodbs.com Thu Mar 24 14:39:32 2005 From: josh at agliodbs.com (Josh Berkus) Date: Thu Mar 24 14:35:12 2005 Subject: [sf-perl] Can't remember who, who, who? Message-ID: <200503241439.32353.josh@agliodbs.com> Folks, Hey, at SFPerl on Tuesday, I was talking to someone who is currently freelancing his skills at Perl/Mason/SQL, had PostgreSQL experience, and was looking for work. But I can't remember who it was. Please speak up, I remembered the project I knew about .... -- --Josh Josh Berkus Aglio Database Solutions San Francisco From doom at kzsu.stanford.edu Thu Mar 24 17:05:56 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Thu Mar 24 17:06:08 2005 Subject: [sf-perl] Can't remember who, who, who? In-Reply-To: <200503241439.32353.josh@agliodbs.com> References: <200503241439.32353.josh@agliodbs.com> Message-ID: <200503250105.j2P15vP48851@mail0.rawbw.com> Josh Berkus wrote: > Hey, at SFPerl on Tuesday, I was talking to someone who is currently > freelancing his skills at Perl/Mason/SQL, had PostgreSQL experience, and was > looking for work. But I can't remember who it was. > > Please speak up, I remembered the project I knew about .... I believe that was me. http://obsidianrook.com/resume.html From doom at kzsu.stanford.edu Thu Mar 24 17:05:56 2005 From: doom at kzsu.stanford.edu (Joseph Brenner) Date: Thu Mar 24 17:06:23 2005 Subject: [sf-perl] Can't remember who, who, who? In-Reply-To: <200503241439.32353.josh@agliodbs.com> References: <200503241439.32353.josh@agliodbs.com> Message-ID: <200503250105.j2P15vP48851@mail0.rawbw.com> Josh Berkus wrote: > Hey, at SFPerl on Tuesday, I was talking to someone who is currently > freelancing his skills at Perl/Mason/SQL, had PostgreSQL experience, and was > looking for work. But I can't remember who it was. > > Please speak up, I remembered the project I knew about .... I believe that was me. http://obsidianrook.com/resume.html From extasia at gmail.com Fri Mar 25 11:04:28 2005 From: extasia at gmail.com (David Alban) Date: Fri Mar 25 11:04:40 2005 Subject: [sf-perl] Line number confusion Message-ID: <4c714a9c050325110413d2f0ff@mail.gmail.com> Greetings, Perl seems to be reporting an error for a line which is a comment. Perhaps someone can tell me why this is happening. I'm confused. Thanks, David P.S. I'm not asking for help debugging the code. No problem doing that. I just want to understand why perl is reporting an error at a comment line. Thanks. $ uname -a ; perl -v SunOS myhost 5.8 Generic_117350-18 sun4u sparc SUNW,Ultra-Enterprise This is perl, v5.8.0 built for sun4-solaris Copyright 1987-2002, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. Errors: Date::Calc::Date_to_Time(): date out of range at /usr/local/bin/shadrpt.pl line 746. Date::Calc::Date_to_Time(): date out of range at /usr/local/bin/shadrpt.pl line 746. Date::Calc::Date_to_Time(): date out of range at /usr/local/bin/shadrpt.pl line 754. Code: 732 # return epoch time (seconds from 1-01-1970 GMT) represented by 733 # $days, which is given as days since 1-01-1970. the shadow 734 # file lists dates in terms of days since 1-01-1970. 735 sub time_from_days { 736 my $func = ( caller 0 )[ 3 ]; 737 my $days = shift; 738 739 not defined $days and logdie "$func(): \$days undefined\n"; 740 741 $days =~ /^\s*$/ and $days = 0; 742 743 # Date::Calc::Add_Delta_Days is expecting "absolute days" 744 # (i.e., days starting January 1, Year 1 A.D., but the units stored 745 # in the shadow file are days since epoch (i.e., days since 746 # 1-01-1970), so we "convert" the input days from days since 747 # epoch to absolute days. 748 my $abs_day = $epoch_abs_day + $days; 749 750 # Then we use Add_Delta_Days to determine a year, month, and day 751 # corresponding to the date represented by the absolute days. 752 my ( $year, $month, $day ) = Add_Delta_Days( 1, 1, 1, $abs_day - 1 ); 753 754 Date_to_Time( $year, $month, $day, 0, 0, 0 ); 755 } # time_from_days Line 754 is the *only* place in the program from which Date::Calc::Date_to_Time() is called. Code seen from debugger's perspective: DB<1> l 735+20 735==> sub time_from_days { 736: my $func = ( caller 0 )[ 3 ]; 737: my $days = shift; 738 739: not defined $days and logdie "$func(): \$days undefined\n"; 740 741: $days =~ /^\s*$/ and $days = 0; 742 743 # Date::Calc::Add_Delta_Days is expecting "absolute days" 744 # (i.e., days starting January 1, Year 1 A.D., but the units stored 745 # in the shadow file are days since epoch (i.e., days since 746 # 1-01-1970), so we "convert" the input days from days since 747 # epoch to absolute days. 748: my $abs_day = $epoch_abs_day + $days; 749 750 # Then we use Add_Delta_Days to determine a year, month, and day 751 # corresponding to the date represented by the absolute days. 752: my ( $year, $month, $day ) = Add_Delta_Days( 1, 1, 1, $abs_day - 1 ); 753 754: Date_to_Time( $year, $month, $day, 0, 0, 0 ); 755 } # time_from_days -- Live in a world of your own, but always welcome visitors. From cjm at fruitfly.org Mon Mar 28 14:37:37 2005 From: cjm at fruitfly.org (Chris Mungall) Date: Mon Mar 28 14:37:51 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <20050324193740.GA23549@fetter.org> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> <200503241810.j2OIAhP89485@mail0.rawbw.com> <20050324193740.GA23549@fetter.org> Message-ID: On Thu, 24 Mar 2005, David Fetter wrote: > On Thu, Mar 24, 2005 at 10:10:43AM -0800, Joseph Brenner wrote: > > > > Chris Mungall wrote: > > > > > Joseph Brenner wrote: > > > > > > Before the last meeting, Rich Morin and Josh Berkus were talking > > > > about the issues involved with translating data structures > > > > between XML to SQL. I just came across something on CPAN that > > > > looks relevent, DBIx::DBStag::Cookbook: > > > > > > > > http://search.cpan.org/~cmungall/DBIx-DBStag-0.06/DBIx/DBStag/Cookbook.pm > > > > > I'm the author of this, and as it happens I'm an occasional lurker > > > on sfpm. Glad you found the module interesting. It is being > > > actively used in a number of bioinformatics projects at the > > > moment. > > > > > > Yes, lots of people find the stag concept a bit funny, I'm > > > emphasising that less these days, the module can be used as a > > > general SQL<->XML mapping tools. > > > > What I meant was that sometimes you get the usual technical > > religious wars going with the XML vs. lisp s-expressions. Your > > answer is something like "what's the difference?", that's what makes > > it funny. > > > > > I haven't made it out to an sfpug event yet but I'm always happy > > > to chat about SQLy-XMLy-perly stuff. > > > > Well you know, if you feel like giving a little presentation on > > DBIx::DBStag sometime, I'd certainly be interested. > > Me, too! OK! I'll give it some thought; this month is a bit busy, perhaps in April? > BTW, do you have any plans to integrate this with the SQL:2003 > standard WITH RECURSIVE syntax, or is it orthogonal, or...? No plans as yet. DBIx::DBStag doesn't really help you with recursive queries, that's something that is best handled by the DBMS. I'd love to see this in MySQL and PostgreSQL but I'm not sure when it'll arrive... > Cheers, > D > From josh at agliodbs.com Mon Mar 28 15:09:29 2005 From: josh at agliodbs.com (Josh Berkus) Date: Mon Mar 28 15:04:52 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: References: <200503240326.j2O3QMP97903@mail0.rawbw.com> <20050324193740.GA23549@fetter.org> Message-ID: <200503281509.30139.josh@agliodbs.com> Chris, > No plans as yet. DBIx::DBStag doesn't really help you with recursive > queries, that's something that is best handled by the DBMS. I'd love to > see this in MySQL and PostgreSQL but I'm not sure when it'll arrive... Well, you can do it in Postgres now, it's just now SQL-standard yet. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From Jeff.Thalhammer at barclaysglobal.com Wed Mar 30 17:22:18 2005 From: Jeff.Thalhammer at barclaysglobal.com (Thalhammer, Jeffrey BGI SF) Date: Wed Mar 30 23:58:56 2005 Subject: [sf-perl] Mucking with the Symbol Table Message-ID: <5489416797D9C546B92C7C787523B205079EA9@calnte2k036.insidelive.net> On some level, I assume that the perl symbol table is just a hash. Is it possible to redefine that hash (by tie-ing it, for example)? Thanks. -Jeff From shanehill00 at gmail.com Thu Mar 31 17:59:39 2005 From: shanehill00 at gmail.com (Shane Hill) Date: Thu Mar 31 17:59:47 2005 Subject: [sf-perl] Going from XML to SQL In-Reply-To: <200503281509.30139.josh@agliodbs.com> References: <200503240326.j2O3QMP97903@mail0.rawbw.com> <20050324193740.GA23549@fetter.org> <200503281509.30139.josh@agliodbs.com> Message-ID: <7637e21505033117591e0889e5@mail.gmail.com> Hey folks, I hope all are well. I am using the DBI with postgres and all is good except that when I use the last_insert_id function. I simply cannot get it work when I use it according to the docs. I am using it in the form : my $id = $self->connection->last_insert_id(undef,undef,$table_name,undef); $table_name is defined and assigned. the docs say this is ok, how am I screwing up? -Shane From shanehill00 at gmail.com Thu Mar 31 18:03:44 2005 From: shanehill00 at gmail.com (Shane Hill) Date: Thu Mar 31 18:03:52 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post Message-ID: <7637e21505033118035f6a057c@mail.gmail.com> Hey folks, I hope all are well. I am using the DBI with postgres and all is good except that when I use the last_insert_id function. I simply cannot get it work when I use it according to the docs. I am using it in the form : my $id = $self->connection->last_insert_id(undef,undef,$table_name,undef); $table_name is defined and assigned. the docs say this is ok, how am I screwing up? -Shane From david at fetter.org Thu Mar 31 18:44:15 2005 From: david at fetter.org (David Fetter) Date: Thu Mar 31 18:44:28 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <7637e21505033118035f6a057c@mail.gmail.com> References: <7637e21505033118035f6a057c@mail.gmail.com> Message-ID: <20050401024414.GC3674@fetter.org> On Thu, Mar 31, 2005 at 06:03:44PM -0800, Shane Hill wrote: > Hey folks, > > I hope all are well. > > I am using the DBI with postgres and all is good except that when I > use the last_insert_id function. I simply cannot get it work when I > use it according to the docs. > > I am using it in the form : > > my $id = $self->connection->last_insert_id(undef,undef,$table_name,undef); Looking at the DBI docs, it says, "For some drivers the $catalog, $schema, $table, and $field parameters are required (e.g., Pg)..." Actually, $catalog should be undef (no such concept in Pg), but the schema is probably 'public' or your username, unless you're using different schemas. Anyhow, I'm puzzled, but I have a fix. After you've checked whether the INSERT succeeded (you're doing that anyway, RIGHT?!? ;) just do: SELECT currval('the_name_of_the_appropriate_seq'); Not quite as convenient, and I've got a query in to the DBD::Pg dev team, but it will work. > $table_name is defined and assigned. > > the docs say this is ok, how am I screwing up? You're not :) You're asking for help. Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! From shanehill00 at gmail.com Thu Mar 31 19:41:46 2005 From: shanehill00 at gmail.com (Shane Hill) Date: Thu Mar 31 19:41:57 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <20050401024414.GC3674@fetter.org> References: <7637e21505033118035f6a057c@mail.gmail.com> <20050401024414.GC3674@fetter.org> Message-ID: <7637e21505033119413988ac40@mail.gmail.com> > Looking at the DBI docs, it says, "For some drivers the $catalog, > $schema, $table, and $field parameters are required (e.g., Pg)..." That is from the DBI docs but looking at the docs for DBD::Pg it says: "If you do not know the name of the sequence, you can provide a table name and DBD::Pg will attempt to return the correct value." and an example from the DBD::Pg docs is: $dbh->last_insert_id(undef,undef,"lii2",undef) well, that is what I am doing and I get an undefined return value. and yes, I am calling this immediately after I do an insert, as the DBD::Pg docs suggest. > Actually, $catalog should be undef (no such concept in Pg), but the > schema is probably 'public' or your username, unless you're using > different schemas. I tried both 'public' and my username and I get the same result. nada. > Anyhow, I'm puzzled, but I have a fix. After > you've checked whether the INSERT succeeded (you're doing that anyway, > RIGHT?!? ;) just do: > > SELECT currval('the_name_of_the_appropriate_seq'); > > Not quite as convenient, and I've got a query in to the DBD::Pg dev > team, but it will work. not convenient at all and yes I am checking for errors. I have been doing this successfully for years with the Pg module / class using: $result->oidStatus but I switch to the DBI in an effort to "standardize" my code and my system takes a steaming dump on me. lovely. Not only will having to use the seq name be inconvenient, it will also be completely antithetical to the rest of the code which is generalized and abstracted from any particular data source. I guess I can make it an optional parameter to my method, but that seems a bit lame. Maybe I am doing something wrong. I will continue to investigate, thanks for the info. cheers, -Shane From josh at agliodbs.com Thu Mar 31 20:00:55 2005 From: josh at agliodbs.com (Josh Berkus) Date: Thu Mar 31 20:01:46 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <7637e21505033119413988ac40@mail.gmail.com> References: <7637e21505033118035f6a057c@mail.gmail.com> <20050401024414.GC3674@fetter.org> <7637e21505033119413988ac40@mail.gmail.com> Message-ID: <200503312000.55898.josh@agliodbs.com> Shane, > well, that is what I am doing and I get an undefined return value. > and yes, I am calling this immediately after I do an insert, as the > DBD::Pg docs suggest. Hmmm. I assume that you're not starting a new database handle, or doing this on a 2nd database handle? -- Josh Berkus Aglio Database Solutions San Francisco From shanehill00 at gmail.com Thu Mar 31 20:49:31 2005 From: shanehill00 at gmail.com (Shane Hill) Date: Thu Mar 31 20:49:40 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <200503312000.55898.josh@agliodbs.com> References: <7637e21505033118035f6a057c@mail.gmail.com> <20050401024414.GC3674@fetter.org> <7637e21505033119413988ac40@mail.gmail.com> <200503312000.55898.josh@agliodbs.com> Message-ID: <7637e215050331204916769eda@mail.gmail.com> > Hmmm. I assume that you're not starting a new database handle, or doing this > on a 2nd database handle? no, no 2nd db handle. The context for this is that I am creating a new object like so: my $obj = ObjClass->new(); I then get an object *without* an identifying value and then when I call: $obj->save; the object should get an identifying value (previously, via the oidStatus method in Pg) and be committed to the DB. This happened when I was using the Pg module, but now that I have switched to the DBI (DBD::Pg) I am getting an undefined value for the unique id. The objects are being saved in the DB but my system has no immediate knowledge of them because the id is coming back as undefined. Like I said, maybe I am screwing up, but it does not look like it. I will do more investigation and see what I turn up. thanks for your time, -Shane > > -- > Josh Berkus > Aglio Database Solutions > San Francisco > From david at fetter.org Thu Mar 31 20:56:14 2005 From: david at fetter.org (David Fetter) Date: Thu Mar 31 20:56:29 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <7637e21505033119413988ac40@mail.gmail.com> References: <7637e21505033118035f6a057c@mail.gmail.com> <20050401024414.GC3674@fetter.org> <7637e21505033119413988ac40@mail.gmail.com> Message-ID: <20050401045614.GA21529@fetter.org> On Thu, Mar 31, 2005 at 07:41:46PM -0800, Shane Hill wrote: > > Looking at the DBI docs, it says, "For some drivers the $catalog, > > $schema, $table, and $field parameters are required (e.g., Pg)..." > > That is from the DBI docs but looking at the docs for DBD::Pg it > says: > > "If you do not know the name of the sequence, you can provide a > table name and DBD::Pg will attempt to return the correct value." > > and an example from the DBD::Pg docs is: > > $dbh->last_insert_id(undef,undef,"lii2",undef) > > well, that is what I am doing and I get an undefined return value. > and yes, I am calling this immediately after I do an insert, as the > DBD::Pg docs suggest. The following worked for me on DBD::Pg 1.40, DBI 1.43, PostgreSQL 8.0.1: test=# \d foo_tab Table "public.foo_tab" Column | Type | Modifiers ----------+---------+------------------------------------------------------------- foo_id | integer | not null default nextval('public.foo_tab_foo_id_seq'::text) foo_text | text | not null Indexes: "foo_tab_pkey" PRIMARY KEY, btree (foo_id) 8<------- code starts here #!/usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI->connect( 'dbi:Pg:dbname=test', 'postgres', '', { AutoCommit => 0, RaiseError => 1, PrintError => 1 } ); my $sql = <prepare($sql); $sth->execute('I love the smell of Napalm in the morning'); my $id = $dbh->last_insert_id(undef, undef, 'foo_tab', undef); if (defined $id) { print "Id is >$id<\n"; } else { print "d00d! wtf?!?\n"; } $dbh->commit; $dbh->disconnect; 8<------- code ends here > > Actually, $catalog should be undef (no such concept in Pg), but > > the schema is probably 'public' or your username, unless you're > > using different schemas. > > I tried both 'public' and my username and I get the same result. > nada. Does the above work for you? > > Anyhow, I'm puzzled, but I have a fix. After > > you've checked whether the INSERT succeeded (you're doing that anyway, > > RIGHT?!? ;) just do: > > > > SELECT currval('the_name_of_the_appropriate_seq'); > > > > Not quite as convenient, and I've got a query in to the DBD::Pg dev > > team, but it will work. > > not convenient at all and yes I am checking for errors. I have been > doing this successfully for years with the Pg module / class using: > > $result->oidStatus I suspect that Pg gets less maintenance than DBD::Pg. > but I switch to the DBI in an effort to "standardize" my code and my > system takes a steaming dump on me. lovely. Bummer. It works at least one place. Let's see about getting it working for you :) Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote! From josh at agliodbs.com Thu Mar 31 22:05:52 2005 From: josh at agliodbs.com (Josh Berkus) Date: Thu Mar 31 22:06:43 2005 Subject: [sf-perl] PostgreSQL DBD ---- repost: sorry, I had the wrong subject in my previous post In-Reply-To: <7637e21505033119413988ac40@mail.gmail.com> References: <7637e21505033118035f6a057c@mail.gmail.com> <20050401024414.GC3674@fetter.org> <7637e21505033119413988ac40@mail.gmail.com> Message-ID: <200503312205.52882.josh@agliodbs.com> Shane, > not convenient at all and yes I am checking for errors. ?I have been > doing this successfully for years with the Pg module / class using: > > $result->oidStatus Um, you're not using the OID as your key, are you? That's no longer supported ... -- Josh Berkus Aglio Database Solutions San Francisco