From Peter at PSDT.com Tue Apr 1 01:06:18 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting In-Reply-To: <3E892B26@wm2.uvic.ca> Message-ID: <5.2.0.9.2.20030331230601.00b42c58@shell2.webquarry.com> At 07:32 PM 3/31/2003 -0800, nkuipers wrote: > >I wasn't proposing going to those modules. But I thought we hadn't > >gotten halfway through your own modules. That not the case? > >Well...there were several methods that got glossed over. In the meaintime, >I've ended up putting some of Annotate.pm into Basic.pm and throwing the rest >of Annotate away. So now Basic is meatier, and more efficient. We could >spend some time going over it again to cover everything and check out the >changes made already. Actually, I'd appreciate that. This is fine by me unless someone else has something they want to do. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Tue Apr 1 11:43:19 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] monitor process, april meeting Message-ID: <3E89F7AC@wm2.uvic.ca> Hello all, I have a script that connects to a remote database, extracts one DNA sequence, runs it through a BLAST program on a different remote machine, and then updates the database with the new information. Rinse and repeat, for every sequence. I want this to be automated, such that if something goes horribly askew, my script can detect this and attempt to pick up where it left off, until it succeeds in doing so. For example, let's say the BLAST server goes down and my BLAST system call hangs. In this case, I want to pound the server with a "let me in?", say once every five minutes, until it connects, and then restart from the last successful sequence, which is stored in a tempfile. I also want an interruption to be printed to a log file, and I think that both of these tasks could include altering the SIG handlers, though I am not sure if this is the best way, or what SIG handlers would need attention. I suppose a crontab is an option, but I would like to keep everything as contained in my script as possible, rather than having little files flying around here and there, to make it more portable. But if cron is the best way, so be it. So, can anyone enlighten me as to what is involved in having a script "listen" to a process, and facilitate its continuity in the event of interruptions? Oh, and I was thinking that for the April meeting, in the absence of any special topic, we could make this a journal club sort of event, where a couple of people select a favourite article from The Perl Journal or something, and present it. Comments? Thanks, Nathanael From Peter at PSDT.com Tue Apr 1 12:12:21 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] monitor process, april meeting In-Reply-To: <3E89F7AC@wm2.uvic.ca> Message-ID: <5.2.0.9.2.20030401100450.00b9aec8@shell2.webquarry.com> At 09:43 AM 4/1/2003 -0800, nkuipers wrote: >Hello all, > >I have a script that connects to a remote database, extracts one DNA >sequence, >runs it through a BLAST program on a different remote machine, and then >updates the database with the new information. Rinse and repeat, for every >sequence. I want this to be automated, such that if something goes horribly >askew, my script can detect this and attempt to pick up where it left off, >until it succeeds in doing so. For example, let's say the BLAST server goes >down and my BLAST system call hangs. In this case, I want to pound >the server >with a "let me in?", say once every five minutes, until it connects, and then >restart from the last successful sequence, which is stored in a tempfile. I >also want an interruption to be printed to a log file, and I think that both >of these tasks could include altering the SIG handlers, though I am not sure >if this is the best way, or what SIG handlers would need attention. I >suppose >a crontab is an option, but I would like to keep everything as >contained in my >script as possible, rather than having little files flying around here and >there, to make it more portable. But if cron is the best way, so be it. So, >can anyone enlighten me as to what is involved in having a script "listen" to >a process, and facilitate its continuity in the event of interruptions? Basically, perldoc perlipc. It's not clear to me that you need an extra process. You could do this with a single process that runs forever and loops around the operations you need to do. It would timeout the server connection if it might hang (perldoc -q timeout) and so forth. I don't think you need to go the full IPC route. If this process is so important that you want to make sure it restarts no matter what might happen to it, then I'd run it from cron for (say) every hour, and have it quit immediately if it detects that it's already running (write the pid to a .pid file, read that file, check ps to see if that process is still running). If you don't use cron then having another process just to watch the first one means, what if the monitor script quits as well? And it sounds like you need a checkpoint-restart capability, so write out your progress to a file as you complete operations (could get into whole discussion about ACID semantics here, won't) and use that on a restart. Not the easiest thing in the world to get right. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From cconstan at csc.UVic.CA Tue Apr 1 12:48:36 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Text::Table success Message-ID: <20030401184836.GD23600@csc> Well, I've been playing around with the Text::Table class and have had great success with it. I now have it producing the same tables that I was printing out line by line and doing a whack of length checking in my ugly code. Now the Table class handles all that for me and produces some nice tables. wrt the variable formatting I posted here before, scanf seems to be the best solution for the one column in the table that I need it: push @line, scanf "\$%5.2f", $amount which when the table is printed, it looks like this: Page Rate ==> (0.07) (0.07) (0.50) Totals Student: rp rp- rp- test colour ============================================= student1 0 917 0 $ 64.19 student2 66 0 0 $ 4.62 student3 14 391 19 $ 37.85 ============================================= Total Cost: $ 5.60 $ 91.56 $ 9.50 There are other cool things you can do with this table class as well, such as dividers (|) and so forth. There are methods to get the height and width of the table, printing the rules (=== in my case) and more. Now, just to clean up the rest of my code ;-( That's one thing I think would be good for me, as a relatively new perl programmer, is to learn how to write better perl scripts, using my ugly (more C-like) perl code as an example. Since the April meeting is taken for a topic, How about May? -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From peter at PSDT.com Tue Apr 1 13:03:43 2003 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Text::Table success In-Reply-To: <20030401184836.GD23600@csc> Message-ID: <5.2.0.9.2.20030401110304.01c1de08@shell2.webquarry.com> At 10:48 AM 4/1/2003 -0800, Carl B. Constantine wrote: >That's one thing I think would be good for me, as a relatively new perl >programmer, is to learn how to write better perl scripts, using my ugly >(more C-like) perl code as an example. > >Since the April meeting is taken for a topic, How about May? I don't know that we've settled on April's topic yet, have we? Nice work with the table module, BTW. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Tue Apr 1 13:40:59 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Text::Table success Message-ID: <3E8A5FAB@wm2.uvic.ca> >I don't know that we've settled on April's topic yet, have we? I don't think so. We could include Perl style guiding. n From Peter at PSDT.com Tue Apr 1 16:49:25 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Text::Table success In-Reply-To: <3E8A5FAB@wm2.uvic.ca> Message-ID: <5.2.0.9.2.20030401144840.00bcc8f0@shell2.webquarry.com> At 11:40 AM 4/1/2003 -0800, nkuipers wrote: > >I don't know that we've settled on April's topic yet, have we? > >I don't think so. We could include Perl style guiding. Folks want to talk about that, and use Carl's code as a whipping boy^W^Wtest bed? -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Tue Apr 1 17:39:47 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Text::Table success In-Reply-To: <5.2.0.9.2.20030401144840.00bcc8f0@shell2.webquarry.com> Message-ID: On Tue, 1 Apr 2003, Peter Scott wrote: > Folks want to talk about that, and use Carl's code as a whipping > boy^W^Wtest bed? Sounds good to me. Standardizing is good for when you want other people to be able to read your code. Or if you don't do that, at least be self-consistant. You can even scrutinize my module if you want, in case you think I missed anything when I standardized. -- Darren Duncan From nkuipers at uvic.ca Tue Apr 1 17:45:22 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] comments on this code? Message-ID: <3E8B2888@wm2.uvic.ca> Hello again, I wrote earlier about using Perl to automate a script's recovery from server-side troubles (the machine I am thinking of tends to crap out more than the others, and needs to be rebooted). Peter directed me to perlipc, and from reading about pipes and the like, I came up with the following. Please let me know if I am doing anything BAD BAD BAD... sub blast { my $data = shift; my $temp = "$ENV{HOME}/temp/seq.tmp"; my $fifo = "ssh snoopy.ceh.uvic.ca /usr/local/bin/blastall"; my @args = ('-p blastn', '-d nt', '-e 0.0000001', '-m 7'); ### load input file with fasta-formatted queryid/sequence ### open SEQ, ">$temp" or die "Could not open for write:$!"; print SEQ ">",$data->[0],"\n",$data->[1]; close SEQ; ### open a handle to BLAST output, retry if unsuccessful for any reason ### { if (!open BLAST, "$fifo @args <$temp|") { # print LOG "BLAST connection refused, retrying...\n"; # sleep(300); redo; } } ### process the report ### parse(*BLAST); } From Peter at PSDT.com Fri Apr 4 14:54:49 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting suggestion Message-ID: <5.2.0.9.2.20030404125058.00b536f0@shell2.webquarry.com> Idea for next meeting: I can present the session I am going to give at YAPC::Canada: "Using the Debugger for Fun & Profit". It'll give me a chance to practice and I doubt anyone else from Victoria.pm is going to Ottawa. The session is currently scheduled for 45 minutes but I am thinking of requesting 90. Is that okay with folks, or do you want to go with the things we'd been talking about already? -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Fri Apr 4 15:27:42 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting suggestion In-Reply-To: <5.2.0.9.2.20030404125058.00b536f0@shell2.webquarry.com> Message-ID: On Fri, 4 Apr 2003, Peter Scott wrote: > Idea for next meeting: I can present the session I am going to give at > YAPC::Canada: "Using the Debugger for Fun & Profit". It'll give me a > chance to practice and I doubt anyone else from Victoria.pm is going to > Ottawa. The session is currently scheduled for 45 minutes but I am > thinking of requesting 90. > Is that okay with folks, or do you want to go with the things we'd been > talking about already? Actually, I think that this is an excellent idea and I would love to see it. You see, despite all of my Perl experience, I don't know anything about how to use the built-in debugger. This is something that I would like to learn and use. So I at least should stand to learn a lot here. -- Darren Duncan From cconstan at csc.UVic.CA Fri Apr 4 16:56:56 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting suggestion In-Reply-To: <5.2.0.9.2.20030404125058.00b536f0@shell2.webquarry.com> References: <5.2.0.9.2.20030404125058.00b536f0@shell2.webquarry.com> Message-ID: <20030404225656.GB25843@csc> *On Fri Apr 04, 2003 at 12:54:49PM -0800, Peter Scott (Peter@PSDT.com) wrote: > Idea for next meeting: I can present the session I am going to give at > YAPC::Canada: "Using the Debugger for Fun & Profit". It'll give me a > chance to practice and I doubt anyone else from Victoria.pm is going to > Ottawa. The session is currently scheduled for 45 minutes but I am > thinking of requesting 90. > > Is that okay with folks, or do you want to go with the things we'd been > talking about already? I don't have a problem. -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From darren at DarrenDuncan.net Fri Apr 4 17:26:09 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting suggestion In-Reply-To: <20030404225656.GB25843@csc> Message-ID: On Fri, 4 Apr 2003, Carl B. Constantine wrote: > I don't have a problem. Me neither. In fact, if someone's going to be a serious user of any language, it would be very helpful to know to use built-in debuggers. Until now, I've just been littering my code with print like statements, which for some bugs can be really annoying and take several hours to trace something down. -- Darren Duncan From cconstan at csc.UVic.CA Fri Apr 4 17:29:19 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] April meeting suggestion In-Reply-To: References: <20030404225656.GB25843@csc> Message-ID: <20030404232919.GD25843@csc> *On Fri Apr 04, 2003 at 03:26:09PM -0800, Darren Duncan (darren@DarrenDuncan.net) wrote: > On Fri, 4 Apr 2003, Carl B. Constantine wrote: > > I don't have a problem. > > Me neither. In fact, if someone's going to be a serious user of any > language, it would be very helpful to know to use built-in debuggers. > Until now, I've just been littering my code with print like statements, > which for some bugs can be really annoying and take several hours to trace > something down. -- Darren Duncan Particularly in Perl. You can do stuff like: if ($debug) { (do debug stuff); } But, with perl, that symbol is always checked which adds to code bloat for production code. It can't be compiled out like in C (at least not to my knowledge). -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From cconstan at csc.UVic.CA Wed Apr 9 11:32:15 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] april 14 Message-ID: <20030409163215.GB28991@csc> As it turns out, I may not be able to make the April 14 meeting so maybe it's a good idea the Perl debugger is discussed instead of my code ;-) Monday has my oldest daughter at Karate until 6:30 and my younger daughter at Swimming who doesn't get home until 7ish. So I have to do one of two things, bring my oldest daughter with me to the meeting or just not be able to come. Tuesday's are much better for me or the occatinal Friday, but everything else in between is taken up with the kids. So I may have to sit this one out :-( -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From darren at DarrenDuncan.net Wed Apr 9 11:44:19 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] april 14 In-Reply-To: <20030409163215.GB28991@csc> Message-ID: On Wed, 9 Apr 2003, Carl B. Constantine wrote: > Monday has my oldest daughter at Karate until 6:30 and my younger > daughter at Swimming who doesn't get home until 7ish. So I have to do > one of two things, bring my oldest daughter with me to the meeting or > just not be able to come. Maybe you should consider the former. She just might like it. Programmers can start at any age. Although, how old is this daughter. In any event, I'm good either monday or tuesday, as long as its settled this week or so (or maybe it was already settled?). Wednesday I have left the province. Good day. -- Darren Duncan From cconstan at csc.UVic.CA Wed Apr 9 12:35:22 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] april 14 In-Reply-To: References: <20030409163215.GB28991@csc> Message-ID: <20030409173522.GD28991@csc> *On Wed Apr 09, 2003 at 09:44:19AM -0700, Darren Duncan (darren@DarrenDuncan.net) wrote: > On Wed, 9 Apr 2003, Carl B. Constantine wrote: > > Monday has my oldest daughter at Karate until 6:30 and my younger > > daughter at Swimming who doesn't get home until 7ish. So I have to do > > one of two things, bring my oldest daughter with me to the meeting or > > just not be able to come. > > Maybe you should consider the former. She just might like it. > Programmers can start at any age. Although, how old is this daughter. She'll be 8 in Aug. so I think Perl may be a little above her yet ;-) but no time like the present to introduce programming. -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From Peter at PSDT.com Wed Apr 9 12:37:52 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] april 14 In-Reply-To: <20030409173522.GD28991@csc> References: <20030409163215.GB28991@csc> Message-ID: <5.2.0.9.2.20030409103723.00b829e8@shell2.webquarry.com> I'm about to make the announcement. Do we have a room reservation? Abram? -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From abez at abez.ca Wed Apr 9 12:40:52 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] april 14 In-Reply-To: <5.2.0.9.2.20030409103723.00b829e8@shell2.webquarry.com> References: <20030409163215.GB28991@csc> <5.2.0.9.2.20030409103723.00b829e8@shell2.webquarry.com> Message-ID: I'm getting one on Thursday. On Wed, 9 Apr 2003, Peter Scott wrote: > I'm about to make the announcement. Do we have a room reservation? Abram? > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From Peter at PSDT.com Wed Apr 9 14:48:48 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Victoria Perl Mongers meeting April 14 Message-ID: <5.2.0.9.2.20030409103513.00b35e90@shell2.webquarry.com> Victoria.pm will meet Monday, April 14, 7pm, at UVic's Clearihue A206 (location not 100% guaranteed - look for the announcement the day before to be certain). Nathanael, would you update the web page please? I will be giving a dry run of my YAPC::Canada (http://www.yapc.ca) talk, "Using the Debugger for Fun & Profit". Slides and demonstrations of the built-in Perl debugger. For those unfamiliar with UVic, see grid C3. Parking can be found at the top centre of B3. If you don't know how to get to UVic - welcome to Victoria - see . Other topics to be covered as time permits; make requests for anything particular. (Courtesy copy to VLUG members by permission of the list manager. Victoria.pm's home page is .) NB: The following email address is bouncing from victoria.pm and I am going to remove it; if anyone has an alternate address please notify me: george.t.bowden@gems1.gov.bc.ca -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Fri Apr 11 12:12:24 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Synopsis 6 now on perl.com Message-ID: The summary of Apocalypse 6, by Damian Conway and Allison Randal, is now online at perl.com (http://www.perl.com/pub/a/2003/04/09/synopsis.html). For those of you who haven't waded through the Apocalypse 6 itself, or even if you did, this should provide much easier reading. -- Darren Duncan From abez at abez.ca Sat Apr 12 00:13:47 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Idea Message-ID: My girlfriend came up with this idea. Using AUTOLOAD in perl you could query the ``elite user'' that a method was not found using that name and they could essentially write the new method there on the spot to be run.. they'd be entering input then the program would prompt: missing method ``soandso'', the user would then write an anonymous sub and terminate. This sub would be eval'd and added to the namespace. Hmmm You could make a really smart autoload which saved the text you typed in and altered the program text s.t. when you entered a method it was effectively saved. Then once you did that you could start writing code as a program runs. So as needed you could write stubs... abram -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From nkuipers at uvic.ca Sat Apr 12 04:04:05 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] Idea Message-ID: <3E98190F@wm2.uvic.ca> Shucks even I think that's horrendous. :) Security aside, I'm not sure that writing stubs as you go (the elite user development application of the idea) is any substitute for a thorough top-down design pattern to begin with. On the other hand, your girlfriend sounds like a keeper. Nathanael From nkuipers at uvic.ca Sun Apr 13 01:15:32 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:20 2004 Subject: [VPM] About that AUTOLOAD thing... Message-ID: <3E990133@wm2.uvic.ca> ...which I slammed. I stand corrected, apparently. The April issue of Linux Mag has an article on Eclipse, and one of the features mentioned is 'In this example, the method you're trying to call doesn't exist, so the "quick fix" is to create the method. The tip even provides a stub...that will be created for you...invaluable because it allows you to write code in a top-down fashion.' So there you have it. Nathanael From Peter at PSDT.com Sun Apr 13 11:12:55 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] About that AUTOLOAD thing... In-Reply-To: <3E990133@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20030413090455.00ab1dd0@shell2.webquarry.com> At 11:15 PM 4/12/2003 -0700, nkuipers wrote: >...which I slammed. I stand corrected, apparently. The April issue of Linux >Mag has an article on Eclipse, and one of the features mentioned is 'In this >example, the method you're trying to call doesn't exist, so the "quick >fix" is >to create the method. The tip even provides a stub...that will be created >for >you...invaluable because it allows you to write code in a top-down fashion.' > >So there you have it. There's a bit of apples and oranges here. From your description, this article appears to be describing a venerated method of just-in-time method creation; instead of writing a bunch of accessor methods, you put a list of the allowed ones in a hash and then to avoid creating unnecessary ones, create them on demand, something like (may be typos): sub AUTOLOAD { (my $method = our $AUTOLOAD) =~ s/.*://; return if $method eq 'DESTROY'; croak "Invalid method $method" unless $METHOD{$method}; no strict 'refs'; *$method = sub { my $self = shift; $self->{$method} = shift if @_; $self->{method} }; goto &$method; } Whereas the suggestion mooted here was to prompt the user to enter the code... which gives me the willies. I guess something like this, perhaps: sub AUTOLOAD { (my $method = our $AUTOLOAD) =~ s/.*://; return if $method eq 'DESTROY'; croak "Invalid method $method" unless $METHOD{$method}; print "Enter code for sub $method: "; local $/; my $code = ; no strict 'refs'; *$method = eval "sub { $code }"; goto &$method; } although can you read another method from STDIN after already seeing end-of-file for the first one...? -- Peter Scott peter@psdt.com http://www.perldebugged.com From Peter at PSDT.com Sun Apr 13 14:49:00 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Victoria Perl Mongers meeting tonight Message-ID: <5.2.0.9.2.20030409110313.01c264f8@shell2.webquarry.com> Victoria.pm will meet tonight, Monday, April 14, 7pm, at UVic's Clearihue A206. I will be giving a dry run of my YAPC::Canada (http://www.yapc.ca) talk, "Using the Debugger for Fun & Profit". Slides and demonstrations of the built-in Perl debugger. For those unfamiliar with UVic, see grid C3. Parking can be found at the top centre of B3. If you don't know how to get to UVic - welcome to Victoria - see . Other topics to be covered as time permits; make requests for anything particular. (Courtesy copy to VLUG members by permission of the list manager. Victoria.pm's home page is .) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From Peter at psdt.com Sun Apr 13 14:49:00 2003 From: Peter at psdt.com (Peter Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Victoria Perl Mongers meeting tonight Message-ID: <5.2.0.9.2.20030409110313.01c264f8@shell2.webquarry.com> Victoria.pm will meet tonight, Monday, April 14, 7pm, at UVic's Clearihue A206. I will be giving a dry run of my YAPC::Canada (http://www.yapc.ca) talk, "Using the Debugger for Fun & Profit". Slides and demonstrations of the built-in Perl debugger. For those unfamiliar with UVic, see grid C3. Parking can be found at the top centre of B3. If you don't know how to get to UVic - welcome to Victoria - see . Other topics to be covered as time permits; make requests for anything particular. (Courtesy copy to VLUG members by permission of the list manager. Victoria.pm's home page is .) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Tue Apr 15 11:45:59 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Victoria Perl Mongers meeting tonight In-Reply-To: <5.2.0.9.2.20030409110313.01c264f8@shell2.webquarry.com> Message-ID: On Sun, 13 Apr 2003, Peter Scott wrote: > Victoria.pm will meet tonight, Monday, April 14, 7pm, at UVic's Clearihue A206. I don't know why, but this message only appeared in my inbox this tuesday morning, following a message dated for 7:30am this morning. Is there something wrong with the mailing list, or is it at my end? -- Darren Duncan From Peter at PSDT.com Tue Apr 15 12:14:19 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Victoria Perl Mongers meeting tonight In-Reply-To: References: <5.2.0.9.2.20030409110313.01c264f8@shell2.webquarry.com> Message-ID: <5.2.1.1.2.20030415101143.01bff210@shell2.webquarry.com> At 09:45 AM 4/15/2003 -0700, Darren Duncan wrote: >On Sun, 13 Apr 2003, Peter Scott wrote: > > Victoria.pm will meet tonight, Monday, April 14, 7pm, at UVic's > Clearihue A206. > > >I don't know why, but this message only appeared in my inbox this tuesday >morning, following a message dated for 7:30am this morning. Is there >something wrong with the mailing list, or is it at my end? -- Darren >Duncan Hmm, I think you are right. When I sent it it showed up in my mailbox rapidly, but that turned out to be the copy that I sent to VLUG, which I am also subscribed to. This morning I got the one that was sent out yesterday. It appears from the headers to have gotten hung up at the PM mail servers. I will enquire. Thanks. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Wed Apr 16 03:47:04 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Rosetta v0.07 is uploaded Message-ID: FYI, I have just uploaded Rosetta v0.07 to CPAN. This was mainly a documentation update, with lots of updates. For an example, I have included a completely rewritten framework Abstract in the body of this letter, so you can get a much clearer idea what the framework does and does not do from before. And there were numerous changes. Have a good day. -- Darren Duncan --------------------------------------------- Rosetta is a comprehensive framework for database-using applications of any size or function that allows them to be easily portable across multiple database implementations because any proprietary details of each are abstracted away. At the same time, it is designed to be fast and efficient. Applications use Rosetta as a virtual embedded database, whose API is called the "Rosetta Native Interface" or "RNI", and whose feature set is an opaque normalized superset of all common database feature sets. The feature superset includes both data manipulation (with multi-table selects and updates plus subqueries or stored procedure calls) and schema manipulation (tables, views, procedures). Rosetta is designed to work equally well with both embedded and client-server databases; in the latter case, it is the client. The RNI is implemented using mainly a "Command" design pattern, meaning that it has few real functions or methods, but those use objects as input and output, which are flexible enough to define any task or result. The RNI is verbose and intended to provide non-ambiguous structured definitions of all tasks, so that the results of executing them are easy to predict; the definitions are multi-dimensional data structures (or objects) having atomic values (which also have native data type formats). Rosetta has this as an advantage over other database abstractions that use serialized strings like SQL (such as ODBC/JDBC), because each database has its own SQL dialect, and applications using them must be coded differently for each one. Rosetta is especially suited for data-driven applications, since the composite scalar values in their data dictionaries can often be copied directly to RNI structures, saving applications the tedious work of generating SQL themselves. Rosetta also provides native internationalization support, for example allowing system messages to be in multiple user languages simultaneously. Rosetta makes it easy to layer alternative APIs on top of RNI, so that you can simplify or customize it to your specific needs. As practical examples of this, there are several emulators provided for common existing database APIs (such as ODBC/JDBC), so that most applications can simply use Rosetta as a hot-swappable replacement for them; you do not have to "learn yet another language" or re-code your application in order for it to just work with more databases. While the Rosetta core must always be embedded in an application to be used, an extension is available that will allow it to be used in a client-server arrangement instead (as ODBC does), where the server is a proxy for the client; the client is embedded in the main application, and it talks to the server in network-serialized RNI, which then translates the request into native database actions. Some utilities built on Rosetta are also available, for such tasks as cloning or backing up a database (schema and/or data; this includes scanning the database to make a data dictionary), or editing one through a web interface (like PHPPgAdmin or PHPMyAdmin but for any RDBMS). Rosetta is not a complete database by itself and you need to separately have an actual database to use it with. (But there is a new embedded database available, suited for small data sets, that was created just for Rosetta.) Rosetta does not usually implement features that are missing in a database being abstracted (such as foreign key constraints, transactional integrity, or geographical data types), in order to give it an identical feature set to a more capable database; Rosetta just allows for the features that do exist to be called in an identical way. A consequence of this is that your choice of database implementation will indeed affect what features you have available; your application will port without changes only to databases which support the features that you use. The RNI may not interface to every single feature of a particular database (neglecting esoteric ones), so you can't use those features with Rosetta (but support can be added). Rosetta does not automate installation of any separate database software or configure it (like a package manager); you will have to do that yourself. From cconstan at csc.UVic.CA Thu Apr 17 12:09:45 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] listing all perl/cpan modules Message-ID: <20030417170945.GA4623@csc> Is there a nice programatic way to get a listing of all perl and/or CPAN modules that are installed and their versions? I seem to remember WebMin able to do this, but I'm not sure if it was because a module was installed through webmin or if it really did have a away to list it. I want this so I know exactly what CPAN modules I have, what I need to update, and what I would like to add. I can then give a final list to our consultants office so that students know what modules they can use. Thanks. -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From cconstan at csc.UVic.CA Thu Apr 17 12:15:20 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] never mind Message-ID: <20030417171520.GB4623@csc> It might help if I checked the FAQ first I should really know better. Anyway, in case others don't know: perldoc perllocal will show you. But since this is a perldoc file, it would be nice to be able to parse it. I'll come up with or find something for that. -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From cconstan at csc.UVic.CA Thu Apr 17 12:43:10 2003 From: cconstan at csc.UVic.CA (Carl B. Constantine) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] more on installed modules Message-ID: <20030417174310.GC4623@csc> The CPAN FAX also states how to do what I want programmantically using the ExtUtils::Installed module: #!/usr/local/bin/perl use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version = $instmod->version($module) || "???"; print "$module -- $version\n"; } Works like a charm. My only reservation about either of these methods is it does not show custom modules you installed by hand. -- Carl B. Constantine University of Victoria Programmer Analyst http://www.csc.uvic.ca UNIX System Administrator Victoria, BC, Canada cconstan@csc.uvic.ca ELW A220, 721-8753 From nkuipers at uvic.ca Tue Apr 22 18:36:24 2003 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Bio::WebAgent Message-ID: <3EA5E2DD@wm2.uvic.ca> Normally I wouldn't post stuff like this to the list but I just thought it was interesting since we've talked in depth about WWW::Mechanize and BioPerl, and have mentioned LWP at various times. This post to the bioperl list brings them all together. Nice to see integration of such tools. Bio::WebAgent ============= This is a generic module to access web. Inherit from it if you write BioPerl modules accessing Web resources. It is a thin wrapper around LWP::UserAgent which also inherits from Bio::Root::Root. (Can be blessed into WWW::Mechanize). Hope everyone is well, Nathanael From abez at abez.ca Tue Apr 22 19:42:40 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Bio::WebAgent In-Reply-To: <3EA5E2DD@wm2.uvic.ca> References: <3EA5E2DD@wm2.uvic.ca> Message-ID: WWW::Mechanize is a real god send. Currently I'm using to ``cheat'' on http://drunkmenworkhere.org/189.php (they said ``no bots'', but doesn't that just challenge you to make a bot?). :) abram On Tue, 22 Apr 2003, nkuipers wrote: > Normally I wouldn't post stuff like this to the list but I just thought it was > interesting since we've talked in depth about WWW::Mechanize and BioPerl, and > have mentioned LWP at various times. This post to the bioperl list brings > them all together. Nice to see integration of such tools. > > Bio::WebAgent > ============= > > This is a generic module to access web. Inherit from it if you write > BioPerl modules accessing Web resources. It is a thin wrapper around > LWP::UserAgent which also inherits from Bio::Root::Root. (Can be blessed > into WWW::Mechanize). > > Hope everyone is well, > > Nathanael > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From nkuipers at uvic.ca Fri Apr 25 13:57:15 2003 From: nkuipers at uvic.ca (Nathanael Kuipers) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] stupid stupid stupid Message-ID: <3EA98996@wm2.uvic.ca> *sigh* I'm writing a parser module for a research tool that we use. I've sort of been "raised" in OO Perl, so by default I write OO modules. Here is my synopsis for what I want to be able to do: my $struct_ref = BIO::vmatchIO->new(*FH)->parse(); And here's the constructor: sub new () { my ($class, $fh) = @_; bless (\FileHandle->new($fh), (ref($class) || $class)); } Later, the parse method calls a support method, _check_format(), to decide what output format it's looking at, and the following line throws an error ("can't locate object method getline via package BIO::vmatchIO..."): while (my $line = $this->getline()) {} Messing with @ISA (via use base pragma) just gets me a "Not a GLOB reference at ...Handle.pm line 407" when I test the module with a script where I pass a reference to an opened filehandle to the constructor above. Is it clear what I am trying to do and how Perl isn't DWIM? I've never tried re-blessing an object into my own package before, what's the best way to accomplish this? And then in a fit of curiosity I took out all the OO stuff and instead put the parse() method in @EXPORT. In the test script that uses BIO::vmatchIO, calling parse() threw an error because there was no parse method in the main:: package (obviously). I almost flew off the handle (no pun intended) at that point and angrily stuffed my OO features back in. Any ideas on either approach? Thanks. Nathanael From Peter at PSDT.com Sun Apr 27 01:39:41 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] stupid stupid stupid In-Reply-To: <3EA98996@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20030426232851.00abf2f0@shell2.webquarry.com> At 11:57 AM 4/25/2003 -0700, Nathanael Kuipers wrote: >*sigh* > >I'm writing a parser module for a research tool that we use. I've sort of >been "raised" in OO Perl, so by default I write OO modules. Here is my >synopsis for what I want to be able to do: > >my $struct_ref = BIO::vmatchIO->new(*FH)->parse(); > >And here's the constructor: > >sub new () { > my ($class, $fh) = @_; > bless (\FileHandle->new($fh), (ref($class) || $class)); >} > >Later, the parse method calls a support method, _check_format(), to decide >what output format it's looking at, and the following line throws an error >("can't locate object method getline via package BIO::vmatchIO..."): > >while (my $line = $this->getline()) {} > >Messing with @ISA (via use base pragma) just gets me a "Not a GLOB reference >at ...Handle.pm line 407" when I test the module with a script where I pass a >reference to an opened filehandle to the constructor above. > >Is it clear what I am trying to do and how Perl isn't DWIM? I've never tried >re-blessing an object into my own package before, what's the best way to >accomplish this? I thought I saw a reply on this one but if so, accidentally deleted it before reading it. Hope this isn't repetitive or inadequate. It's not entirely clear to me what YM, but the above has certainly reblessed the FileHandle into your class, and therefore it won't find the getline() method. No time to test the @ISA (I'm in the UK... supposedly on vacation), but I would have thought it would have worked. Regardless, I find object composition to be better than object inheritance for handling this sort of thing. I.e., sub new { my ($class, $fh) = @_; bless { fh => $fh }, ref($class) || $class; } sub getline { my $self = shift; $self->{fh}->getline; } with various optimizations if you want to call more FH methods besides getline(). But the inheritance should have worked... you just didn't show us what you tried. Hmm... try taking the \ out of the constructor first perhaps. >And then in a fit of curiosity I took out all the OO stuff and instead put >the >parse() method in @EXPORT. In the test script that uses BIO::vmatchIO, >calling parse() threw an error because there was no parse method in the >main:: >package (obviously). Nah, that's not a good direction to go in, as you realized. -- Peter Scott peter@psdt.com http://www.perldebugged.com From scott at raindog2.no-ip.org Mon Apr 28 20:13:18 2003 From: scott at raindog2.no-ip.org (Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Mysql - Insert question Message-ID: <06b801c30dec$84ddb0b0$0900a8c0@cloverpoint> Hi, I'm only just starting to learn perl so please bare with me. I've written a small script that should update a table on an mysql db. so far I can connect to mysql be autheticated and create the table. I have verified that all the varibles contain what there supposed to have but the INSERT fails with the message "DBD::mysql::db do failed: You have an error in your SQL syntax near ' 22342132)' at line 2 at net-space.pl line 50, line 24." $SQL = "INSERT INTO $tablename ( host, share, jobnum, kbused ) VALUES ( $hostname, $sharename, $jobnum, $kbused)"; $InsertRecord = $dbh->do($SQL); Online examples show that the above should work.. Any help / pointers would be appreciated. Scott From abez at abez.ca Mon Apr 28 21:10:52 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Mysql - Insert question In-Reply-To: <06b801c30dec$84ddb0b0$0900a8c0@cloverpoint> References: <06b801c30dec$84ddb0b0$0900a8c0@cloverpoint> Message-ID: Here try this $SQL = "INSERT INTO $tablename ( host, share, jobnum, kbused ) VALUES ( ?,?,?,?)"; $dbh->prepare($SQL); $dbh->execute($hostname,$sharename,$jobnum,$kbused); What you were doing wrong was not quoting your values for hostname etc. Using prepare and ? syntax you should be able to do what you want For more info: man DBI or perldoc DBI abram On Mon, 28 Apr 2003, Scott wrote: > Hi, > I'm only just starting to learn perl so please bare with me. > > I've written a small script that should update a table on an mysql db. > > so far I can connect to mysql be autheticated and create the table. > I have verified that all the varibles contain what there supposed to have > but the INSERT fails with the message "DBD::mysql::db do failed: You have > an error in your SQL syntax near ' 22342132)' at line 2 at net-space.pl > line 50, line 24." > > > $SQL = "INSERT INTO $tablename ( host, share, jobnum, kbused ) VALUES ( > $hostname, $sharename, $jobnum, $kbused)"; > > $InsertRecord = $dbh->do($SQL); > > > Online examples show that the above should work.. > > Any help / pointers would be appreciated. > > Scott > > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From scott at raindog2.no-ip.org Tue Apr 29 00:20:36 2003 From: scott at raindog2.no-ip.org (Scott) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Mysql - Insert question Message-ID: <002a01c30e0f$18208ab0$47a34118@pesto2> Thanks for the help guys, its dumping data now : ) From darren at DarrenDuncan.net Tue Apr 29 00:27:13 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:21 2004 Subject: [VPM] Mysql - Insert question Message-ID: P.S. I actually wrote this around 7pm, but forgot to send it to the list. Here goes... -------------------- Scott said: >so far I can connect to mysql be autheticated and create the table. >I have verified that all the varibles contain what there supposed to have >but the INSERT fails with the message "DBD::mysql::db do failed: You have >an error in your SQL syntax near ' 22342132)' at line 2 at net-space.pl >line 50, line 24." > > >$SQL = "INSERT INTO $tablename ( host, share, jobnum, kbused ) VALUES ( >$hostname, $sharename, $jobnum, $kbused)"; > >$InsertRecord = $dbh->do($SQL); > Hello Scott. I have a large amount of interest in using databases with Perl, and some experience, so I have a couple suggestions or pointers to make. First of all, when you are using strings as data values in a SQL statement, they need to be quoted and escaped so that the database can parse the SQL statement properly; you don't seem to be doing this, which is why you got the error. Here is an example that does quoting but not escaping (but to escape, just replace every "'" with a "''" in the $hostname and $sharename). $SQL = "INSERT INTO $tablename (host, share, jobnum, kbused) VALUES ('$hostname', '$sharename', $jobnum, $kbused)"; $rv = $dbh->do($SQL); Second of all, a better aproach in general that will save you the above worries and more, and still make things work, and make them work faster (especially when inserting multiple rows), is to do your variable binding separately, like this: $SQL = "INSERT INTO $tablename (host, share, jobnum, kbused) VALUES (?, ?, ?, ?)"; $sth = $dbh->prepare($SQL); $rv = $sth->execute($hostname, $sharename, $jobnum, $kbused); Personally, I recommend the second approach every time. That said, there is one catch, which is if you are debugging and want to print out the sql statement that is being run, this statement won't show the 4 values, but the question marks instead. -- Darren Duncan