From peter at PSDT.com Wed Oct 9 11:52:33 2002 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: The Perl Journal Message-ID: <4.3.2.7.2.20021009095017.00ab3cc0@shell2.webquarry.com> Hi group - please see http://www.tpj.com/ for a possibly limited time offer. They need pledges for subscriptions to bring back The Perl Journal and they're short. The deadline is fast approaching, so this may be the last chance for a while to get TPJ back. If you never saw a TPJ issue - particularly before it became a supplement to Sysadmin magazine - you missed a fascinating and always worthwhile periodical. I saved all mine and reread them from time to time. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From pavel at md5.ca Wed Oct 9 14:02:40 2002 From: pavel at md5.ca (Pavel Zaitsev) Date: Wed Aug 4 00:11:09 2004 Subject: The Perl Journal In-Reply-To: <4.3.2.7.2.20021009095017.00ab3cc0@shell2.webquarry.com> References: <4.3.2.7.2.20021009095017.00ab3cc0@shell2.webquarry.com> Message-ID: <20021009190240.GA31166@md5.ca> Just have subscribed. Good stuff.S p Peter Scott(peter@PSDT.com)@Wed, Oct 09, 2002 at 09:52:33AM -0700: > Hi group - please see http://www.tpj.com/ for a possibly limited time > offer. They need pledges for subscriptions to bring back The Perl > Journal and they're short. The deadline is fast approaching, so this > may be the last chance for a while to get TPJ back. > > If you never saw a TPJ issue - particularly before it became a > supplement to Sysadmin magazine - you missed a fascinating and always > worthwhile periodical. I saved all mine and reread them from time to time. > -- > Peter Scott > Pacific Systems Design Technologies > http://www.perldebugged.com/ > -- Create like god, rule like a king, work like a slave. From darren at DarrenDuncan.net Wed Oct 9 15:17:56 2002 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:09 2004 Subject: The Perl Journal Message-ID: Scott, this subscription is a good idea, but I tried before and I tried today, both times with errors which I think are on the form itself. Were any of you successful with your subscription? For reference, below is my report of a few minutes ago to their webmaster so they can fix the problem. -- Darren Duncan ---------- Forwarded message ---------- Date: Wed, 9 Oct 2002 13:12:27 -0700 (PDT) From: Darren Duncan To: webmaster@sdmediagroup.com Cc: Darren Duncan Subject: problem creating new account Hello. I am trying to create an account so I can subscript to The Perl Journal. But after I enter my information (username, email, password) and click the OK button, I get this error: An error has occured in processing your request Your original request url has been lost, please try again I have tried several times with the same effect, on two different days. While I'm not sure if I was at the same computer last day, today I was using IE 5.0 on a Windows 2000 box. At home I have IE 5.22 on a Mac OS X box. I think that this problem is in the form itself and not at my end. Please let me know when you have fixed it to I can subscribe to the Perl Journal before their fast-approaching deadline. Thank you. -- Darren Duncan From peter at PSDT.com Wed Oct 9 15:31:17 2002 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: The Perl Journal In-Reply-To: Message-ID: <4.3.2.7.2.20021009133055.00af6cb0@shell2.webquarry.com> At 01:17 PM 10/9/02 -0700, Darren Duncan wrote: >Scott, this subscription is a good idea, but I tried before and I tried >today, both times with errors which I think are on the form itself. Were >any of you successful with your subscription? For reference, below is my >report of a few minutes ago to their webmaster so they can fix the >problem. Beats me. I was successful when I went into it a week ago. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From Peter at PSDT.com Wed Oct 9 17:36:00 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting announcement - October 16 Message-ID: <4.3.2.7.2.20021009130419.00af6100@shell2.webquarry.com> Advance notice - our next meeting will be Wednesday, October 16, 7pm at UVic McPherson library (small conference room). Different day from last time to accommodate a new member since the last meeting. Full reminder with directions will be sent the day before. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Wed Oct 9 18:40:14 2002 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting announcement - October 16 In-Reply-To: <4.3.2.7.2.20021009130419.00af6100@shell2.webquarry.com> Message-ID: On Wed, 9 Oct 2002, Peter Scott wrote: > Advance notice - our next meeting will be Wednesday, October 16, 7pm at > UVic McPherson library (small conference room). Different day from > last time to accommodate a new member since the last meeting. Full > reminder with directions will be sent the day before. Can this meeting be earlier in the day, then, so I have time to get over to downtown for an 8:35 bus out of there to Sidney? Thank you -- Darren Duncan From peter at PSDT.com Wed Oct 9 18:45:41 2002 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting announcement - October 16 In-Reply-To: References: <4.3.2.7.2.20021009130419.00af6100@shell2.webquarry.com> Message-ID: <4.3.2.7.2.20021009164450.00aafc40@shell2.webquarry.com> At 04:40 PM 10/9/02 -0700, Darren Duncan wrote: >On Wed, 9 Oct 2002, Peter Scott wrote: > > Advance notice - our next meeting will be Wednesday, October 16, 7pm at > > UVic McPherson library (small conference room). Different day from > > last time to accommodate a new member since the last meeting. Full > > reminder with directions will be sent the day before. > >Can this meeting be earlier in the day, then, so I have time to get over >to downtown for an 8:35 bus out of there to Sidney? Thank you -- Darren >Duncan I'm not sure how many other people could make that - I originally proposed 6:30 as meeting time but got feedback that 7:00 was more appropriate. Certainly I can arrive earlier, though. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From Peter at PSDT.com Tue Oct 15 15:42:00 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting tomorrow Message-ID: <4.3.2.7.2.20021009133643.00ab0700@shell2.webquarry.com> Victoria.pm will meet tomorrow, Wednesday October 16, at UVic's McPherson Library. Meet inside in the art gallery area immediately to the right upon entering between 6:45 and 7:00. At 7:00 we will relocate to one of the small conference rooms on the next floor up. We will leave a note with the room number in the art gallery area; if you don't find it, ask the librarian where the conference rooms are and look through their doors which sport handy windows for this purpose until you find some people having way too much fun. Topic TBD, but this may be the night we finally have the Object-Oriented Perl talk! For those unfamiliar with UVic, see http://www.uvic.ca/maps/index.html 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 http://www.uvic.ca/maps/directions.html. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Tue Oct 15 16:11:40 2002 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting tomorrow In-Reply-To: <4.3.2.7.2.20021009133643.00ab0700@shell2.webquarry.com> Message-ID: On Tue, 15 Oct 2002, Peter Scott wrote: > Victoria.pm will meet tomorrow, Wednesday October 16, at UVic's > McPherson Library. > Meet inside in the art gallery area immediately to the right upon > entering between 6:45 and 7:00. Despite what I said the other week, I should still be able to attend for the whole thing. I will just leave downtown on a 10pm bus rather than the 8:35pm, which should give me time to be at the whole talk and travel from UVIC afterwards. So lookin' good. > At 7:00 we will relocate to one of the small conference rooms on the > next floor up. We will leave a note with the room number in the art > gallery area; if you don't find it, ask the librarian where the > conference rooms are and look through their doors which sport handy > windows for this purpose until you find some people having way too much fun. > > Topic TBD, but this may be the night we finally have the > Object-Oriented Perl talk! Of course, if the last meeting was any indication, we either can only have it if one of the attendees doesn't already have experience with objects, or if we all do and we want to take it to an advanced level. In any event, to give you an idea where I am coming from, I can't think of any specific problems I am having that I need help with, but I welcome the chance to learn other new things through discussion, or to help other people. On the other hand, I am wanting to make a new generic module or set of modules and did want some feedback of whether other people could use this kind of functionality, making it a CPAN candidate. That is, the problem I am trying to solve with these modules, transparent portability over multiple database vendors, has already been addressed by several other distributions on CPAN, but my proposed solution would be significantly different from the others. Or is it unique enough? That is what I would want to ask. Note that I would not be addressing the binary API portability issue that DBI does well, but rather SQL/feature portability, which is higher-level. Details would come verbally, unless it would be a good idea to share a written version first? Have a good day. -- Darren Duncan From Peter at PSDT.com Tue Oct 15 16:17:19 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting tomorrow In-Reply-To: References: <4.3.2.7.2.20021009133643.00ab0700@shell2.webquarry.com> Message-ID: <4.3.2.7.2.20021015141640.00b1add0@shell2.webquarry.com> At 02:11 PM 10/15/02 -0700, Darren Duncan wrote: >On the other hand, I am wanting to make a new generic module or set of >modules and did want some feedback of whether other people could use this >kind of functionality, making it a CPAN candidate. That is, the problem I >am trying to solve with these modules, transparent portability over >multiple database vendors, has already been addressed by several other >distributions on CPAN, but my proposed solution would be significantly >different from the others. Or is it unique enough? That is what I would >want to ask. Note that I would not be addressing the binary API >portability issue that DBI does well, but rather SQL/feature portability, >which is higher-level. Details would come verbally, unless it would be a >good idea to share a written version first? Sounds better to do a written version; there are more people on the mailing list who will see it than will be at the meeting. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Tue Oct 15 16:25:12 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: Meeting tomorrow Message-ID: <3DACA167@wm2.uvic.ca> Right on. >===== Original Message From Peter Scott ===== >Victoria.pm will meet tomorrow, Wednesday October 16, at UVic's >McPherson Library. >Meet inside in the art gallery area immediately to the right upon >entering between 6:45 and 7:00. > >At 7:00 we will relocate to one of the small conference rooms on the >next floor up. We will leave a note with the room number in the art >gallery area; if you don't find it, ask the librarian where the >conference rooms are and look through their doors which sport handy >windows for this purpose until you find some people having way too much fun. > >Topic TBD, but this may be the night we finally have the >Object-Oriented Perl talk! > >For those unfamiliar with UVic, see http://www.uvic.ca/maps/index.html >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 >http://www.uvic.ca/maps/directions.html. >-- >Peter Scott >Pacific Systems Design Technologies >http://www.perldebugged.com/ From nkuipers at uvic.ca Sun Oct 20 14:50:59 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: You down with OOP... Message-ID: <3DB294AA@wm2.uvic.ca> ...yeah you know me. Hi all. Was messing around with Activestate on my PC this afternoon and started diddling with OO. Here's what I wrote. Maybe this will be one of those things that just keeps expanding, that I'll work on when the fit takes me...a hobby, yeah, that's it... ;) *yaaawwwwwnnnn* what am I doing awake anyway... Happy Sunday, nathanael -------------- next part -------------- package DNAParser; use strict; use warnings; my $dnaobj = DNAParser->new( DESCRIPTION => 'human telomere repeat', SEQUENCE => 'TAAGGG' ); my $description = $dnaobj->get_desc(); my $sequence = $dnaobj->get_seq(); print ">$description\n$sequence\n"; sub new { my $caller = shift; my $type = ref($caller) || $caller; my $self = { DESCRIPTION => 'no value entered', SEQUENCE => 'no value entered', @_ }; bless ($self, $type) and return $self } sub get_desc { my $caller = shift; ref($caller) or die "Invoked instance method on a class: $!"; return $caller->{DESCRIPTION}; } sub get_seq { my $caller = shift; ref($caller) or die "Invoked instance method on a class: $!"; return $caller->{SEQUENCE}; } From abez at abez.ca Sun Oct 20 20:35:33 2002 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:09 2004 Subject: You down with OOP... In-Reply-To: <3DB294AA@wm2.uvic.ca> Message-ID: You might want to seperate your main program from the file. E.g. util.pl uses DNAParser.pm? Otherwise when someone uses DNAParser.pm it will run that code you have at the start :) On Sun, 20 Oct 2002, nkuipers wrote: > ...yeah you know me. Hi all. Was messing around with Activestate on my PC > this afternoon and started diddling with OO. Here's what I wrote. Maybe this > will be one of those things that just keeps expanding, that I'll work on when > the fit takes me...a hobby, yeah, that's it... ;) > > *yaaawwwwwnnnn* what am I doing awake anyway... > > Happy Sunday, > nathanael > -- ABeZ------------ ------- ------ - ---------- -- ------------ http://www.indexdirect.com/abez/ Abram Hindle (abez@abez.ca) ---- ------- ----------- ----------- - - ------ --------ABeZ From Peter at PSDT.com Mon Oct 21 12:53:58 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: You down with OOP... In-Reply-To: <3DB294AA@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021021105018.00b4e830@shell2.webquarry.com> Cool. You need to end the file with the magic 1; we discussed. It is a coincidence that it happens to work without it at the moment (and can anyone spot why?) I've never bothered to do the strict type-checking like you're doing with ref($caller) or die "Invoked instance method on a class: $!"; There are modules that automate this and as much additional strictness as you want, I believe. I just don't use them. Anyone got a favourite they'd care to introduce? Incidentally, how much data do you expect to end up storing in one of these objects, and how many instances per execution? -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Mon Oct 21 12:59:46 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: My first module: Blaster.pm Message-ID: <3DB45C81@wm2.uvic.ca> Ok ok, I know this is silly of me, but I just wanted to show you all. Not only does it compile, it works As Intended! :) However, I would like to hear any suggestions anyone has for improving it...after all, it's just my first. TIA, Nathanael -------------- next part -------------- A non-text attachment was scrubbed... Name: Blaster.pm Type: application/octet-stream Size: 2420 bytes Desc: not available Url : http://mail.pm.org/archives/victoria-pm/attachments/20021021/71add8f3/Blaster.obj From nkuipers at uvic.ca Mon Oct 21 13:04:42 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: You down with OOP... Message-ID: <3DB45ED7@wm2.uvic.ca> >Incidentally, how much data do you expect to end up storing in one of >these objects, and how many instances per execution? I am not sure but I think that as a simple object, description and sequence is sufficient, because they are all that is required for biologically relevant operations like masking all occurences of a certain substring, producing the [reverse] complement of the sequence, getting the sequence length, comparing to other sequences, and so forth. I am guessing there would be a severe bottleneck though if I used this in my real work...I typically deal with over 15,000 sequences at a time. Now, I could always populate an array (or something) with objects and wield them en masse, but the overhead of 15,000+ objects, even if they were small like the little driver I showed, would be significant perhaps? Nathanael From Peter at PSDT.com Mon Oct 21 13:35:10 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: You down with OOP... In-Reply-To: <3DB45ED7@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021021113434.00b4cb70@shell2.webquarry.com> At 11:04 AM 10/21/02 -0700, nkuipers wrote: > >Incidentally, how much data do you expect to end up storing in one of > >these objects, and how many instances per execution? > >I am not sure but I think that as a simple object, description and >sequence is >sufficient, because they are all that is required for biologically relevant >operations like masking all occurences of a certain substring, producing the >[reverse] complement of the sequence, getting the sequence length, comparing >to other sequences, and so forth. I am guessing there would be a severe >bottleneck though if I used this in my real work...I typically deal with over >15,000 sequences at a time. Now, I could always populate an array (or >something) with objects and wield them en masse, but the overhead of 15,000+ >objects, even if they were small like the little driver I showed, would be >significant perhaps? Um, probably not. For 15k objects like what you showed, I'd try it first, ought not to be a problem. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From Peter at PSDT.com Mon Oct 21 13:34:06 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: My first module: Blaster.pm In-Reply-To: <3DB45C81@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021021112317.00ab5cd0@shell2.webquarry.com> At 10:59 AM 10/21/02 -0700, nkuipers wrote: >Ok ok, I know this is silly of me, but I just wanted to show you all. Not >only does it compile, it works As Intended! :) However, I would like to hear >any suggestions anyone has for improving it...after all, it's just my first. Well, you can save yourself a bit of typing; since bless returns the reference after blessing the referent, where you say bless ($self, $type) and return $self you can just say return bless ($self, $type); For that matter, you could replace the whole my $self = { TYPE => 'n,x,p etc.', DATABASE => 'some db', INPUT => 'some file', OUTPUT => 'some file', MODE => 'int(0-7)', EVALUE => 'some value', @_ }; bless ($self, $type) and return $self with bless { TYPE => 'n,x,p etc.', DATABASE => 'some db', INPUT => 'some file', OUTPUT => 'some file', MODE => 'int(0-7)', EVALUE => 'some value', @_ }, $type But that's just pruning. if ( $argument eq 'n' or $argument eq 'p' or $argument eq 'x' or $argument eq 'tn' or $argument eq 'tx' ) { $caller->{TYPE} = $argument } else { die "Invalid -blast value: $!" } spells hash test to me: my %valid = map { $_ => 1 } qw(n p x tn tx); $valid{$argument} ? $caller->{TYPE} = $argument : die "Invalid -blast value: $argument"; And you don't really want $! there... that's only for system call failures. sub blast { my $caller = shift; ref($caller) or die "Invoked instance method on a class: $!"; print "Blasting against $caller->{DATABASE} database...\n"; my $command = "blastall -p blast". $caller->{TYPE} . " -d " . $caller->{DATABASE} . " -i " . $caller->{INPUT} . " -o " . $caller->{OUTPUT} . " -m " . $caller->{MODE} . " -e " . $caller->{EVALUE}; system $command; } I think I'd want to know whether this was successful. You've called system(), which means that the STDOUT and STDERR will go to the caller. Maybe that's right; I don't know what blast is. Usually one wants to hide the underlying details from the user since that's the encapsulation part of O-O. So unless this is an interactive program or it outputs messages that you are going to print anyway, I'd captur the stdout and stderr with `` and do some analysis on them to see whether they represented success or failure. Or maybe it's enough just to look at $? for the return code. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Mon Oct 21 14:44:07 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: My first module: Blaster.pm Message-ID: <3DB4A511@wm2.uvic.ca> BLAST is not a perl tool. It's an exectuable in my path, freely downloadable from ncbi.nih.gov ... a standard utility in bioinformatics at any rate. It receives all 15k sequences and compares them one at a time to a database of hundreds of thousands for similarity. It throws an exception for each sequence where appropiate onto STDERR; none of the information is sensitive and it doesn't really matter where it goes. I have a subroutine in my script for handling error sequences specially anyway. Thanks for the pruning advice too. Cheers, Nathanael >===== Original Message From Peter Scott ===== >At 10:59 AM 10/21/02 -0700, nkuipers wrote: >>Ok ok, I know this is silly of me, but I just wanted to show you all. Not >>only does it compile, it works As Intended! :) However, I would like to hear >>any suggestions anyone has for improving it...after all, it's just my first. > >Well, you can save yourself a bit of typing; since bless returns the >reference after blessing the referent, where you say > > bless ($self, $type) and return $self > >you can just say > > return bless ($self, $type); > >For that matter, you could replace the whole > > my $self = { > TYPE => 'n,x,p etc.', > DATABASE => 'some db', > INPUT => 'some file', > OUTPUT => 'some file', > MODE => 'int(0-7)', > EVALUE => 'some value', > @_ > }; > bless ($self, $type) and return $self > >with > > bless { > TYPE => 'n,x,p etc.', > DATABASE => 'some db', > INPUT => 'some file', > OUTPUT => 'some file', > MODE => 'int(0-7)', > EVALUE => 'some value', > @_ > }, $type > >But that's just pruning. > > if ( $argument eq 'n' or > $argument eq 'p' or > $argument eq 'x' or > $argument eq 'tn' or > $argument eq 'tx' ) { $caller->{TYPE} = $argument } > else { die "Invalid -blast value: $!" } > >spells hash test to me: > > my %valid = map { $_ => 1 } qw(n p x tn tx); > $valid{$argument} ? $caller->{TYPE} = $argument > : die "Invalid -blast value: $argument"; > >And you don't really want $! there... that's only for system call failures. > >sub blast { > my $caller = shift; > ref($caller) or die "Invoked instance method on a class: $!"; > print "Blasting against $caller->{DATABASE} database...\n"; > my $command = "blastall -p blast". $caller->{TYPE} . > " -d " . $caller->{DATABASE} . > " -i " . $caller->{INPUT} . > " -o " . $caller->{OUTPUT} . > " -m " . $caller->{MODE} . > " -e " . $caller->{EVALUE}; > system $command; >} > >I think I'd want to know whether this was successful. You've called >system(), which means that the STDOUT and STDERR will go to the >caller. Maybe that's right; I don't know what blast is. Usually one >wants to hide the underlying details from the user since that's the >encapsulation part of O-O. > >So unless this is an interactive program or it outputs messages that >you are going to print anyway, I'd captur the stdout and stderr with `` >and do some analysis on them to see whether they represented success or >failure. Or maybe it's enough just to look at $? for the return code. > >-- >Peter Scott >Pacific Systems Design Technologies >http://www.perldebugged.com/ From nkuipers at uvic.ca Mon Oct 21 19:09:28 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: grrrrr..... Message-ID: <3DB49C67@wm2.uvic.ca> Could someone please explain to me the how-to of grouping modules in a namespace. Here's the situation. I have two modules written, one called Blaster.pm and one called Basic.pm. They were originally placed in the same folder as a driver script for Basic.pm. The driver contained the lines BEGIN { push @INC, '/home/nkuipers/code'; use Basic; my $dnaobj = Basic->new(); And worked beautifully. Then I put both modules in a different folder, BIO. I've diddled with the begin block to reflect the new path, ie., /home/nkuipers/code, home/nkuipers/code/, .../BIO, .../BIO/, etc. I've diddled with the use statment, ie., use Basic, use BIO::Basic, use ... (). I've diddled with the constructor call, ie., ...BIO::Basic->new(), Basic->new(). Nothing works. Depending on the combination of diddling, it dies with a "Cannot locate package BIO::Basic, @INC contains...BEGIN failed at compile time", or "Can't locate object method "new" via package "BIO::basic" or even "Undefined subroutine at &main::get_count called at driver line 14." I realize this is not informative since it doesn't match error to combination, but who cares what I'm doing wrong, how is it done right. What's the missing idiom here? TIA, Nathanael From peter at PSDT.com Mon Oct 21 19:23:31 2002 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: grrrrr..... In-Reply-To: <3DB49C67@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021021171554.00b62530@shell2.webquarry.com> At 05:09 PM 10/21/02 -0700, nkuipers wrote: >Could someone please explain to me the how-to of grouping modules in a >namespace. Here's the situation. > >I have two modules written, one called Blaster.pm and one called Basic.pm. >They were originally placed in the same folder as a driver script for >Basic.pm. The driver contained the lines > >BEGIN { push @INC, '/home/nkuipers/code'; use lib qw(/home/nkuipers/code); >use Basic; >my $dnaobj = Basic->new(); > >And worked beautifully. > >Then I put both modules in a different folder, BIO. > >I've diddled with the begin block to reflect the new path, ie., >/home/nkuipers/code, home/nkuipers/code/, .../BIO, .../BIO/, etc. I've >diddled with the use statment, ie., use Basic, use BIO::Basic, use ... (). >I've diddled with the constructor call, ie., ...BIO::Basic->new(), >Basic->new(). Nothing works. Depending on the combination of diddling, it >dies with a "Cannot locate package BIO::Basic, @INC contains...BEGIN >failed at >compile time", or "Can't locate object method "new" via package "BIO::basic" >or even "Undefined subroutine at &main::get_count called at driver line 14." >I realize this is not informative since it doesn't match error to >combination, >but who cares what I'm doing wrong, how is it done right. What's the missing >idiom here? The package declaration must match the use statement. i.e., use BIO::Basic; looks in @INC for BIO/Basic.pm, which should start with package BIO::Basic; Get that right and you'll be fine. It's a long way down the road before you might want to consider alternatives. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Mon Oct 21 19:51:05 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: grrrrr..... Message-ID: <3DB4B300@wm2.uvic.ca> >The package declaration must match the use statement. i.e., > >use BIO::Basic; That was the main bit of what was wrong. I thought the BIO:: portion was only relevant as a path in @INC and a portion of the use statement, so I didn't prepend it to the value in my package declarations. >Get that right and you'll be fine. It's a long way down the road >before you might want to consider alternatives. It works now. What do you mean by your last statement? Alternatives? Or is this one of those "If you have to ask, you shouldn't be told" sorts of things... :) Thanks again. nathanael From Peter at PSDT.com Mon Oct 21 21:15:45 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: grrrrr..... In-Reply-To: <3DB4B300@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021021191431.00a982b0@shell2.webquarry.com> At 05:51 PM 10/21/2002 -0700, nkuipers wrote: > >The package declaration must match the use statement. i.e., > > > >use BIO::Basic; > >That was the main bit of what was wrong. I thought the BIO:: portion was >only >relevant as a path in @INC and a portion of the use statement, so I didn't >prepend it to the value in my package declarations. > > >Get that right and you'll be fine. It's a long way down the road > >before you might want to consider alternatives. > >It works now. What do you mean by your last statement? Alternatives? Or is >this one of those "If you have to ask, you shouldn't be told" sorts of >things... :) There are occasionally good reasons to put multiple packages in the same file. Before you do that you need enough experience to understand why it's the exception. Peter Scott peter@psdt.com http://www.perldebugged.com From nkuipers at uvic.ca Wed Oct 23 14:01:28 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: update Message-ID: <3DB6F3DC@wm2.uvic.ca> Hello everyone, I'm still testing my BIO::Basic module but I wanted to pass on the documentation I wrote up (just for the experience) for Basic.pm and Blaster.pm. It's supposed to look like CPAN docs, since one can always dream. Enjoy(?), Nathanael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/victoria-pm/attachments/20021023/d3374142/Basic.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/victoria-pm/attachments/20021023/d3374142/Blaster.html From peter at PSDT.com Wed Oct 23 14:12:43 2002 From: peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: update In-Reply-To: <3DB6F3DC@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021023121157.00b0e760@shell2.webquarry.com> At 12:01 PM 10/23/02 -0700, nkuipers wrote: >Hello everyone, > >I'm still testing my BIO::Basic module but I wanted to pass on the >documentation I wrote up (just for the experience) for Basic.pm and >Blaster.pm. It's supposed to look like CPAN docs, since one can always dream. Did you use POD to create these HTML files? If you do, it is remarkably difficult to make the documentation *not* look like CPAN docs :-) (perldoc perlpod) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Tue Oct 29 21:22:11 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: cool use for map Message-ID: <3DBF51EE@wm2.uvic.ca> @found = map { $1 } $searchthis =~ m/($forthis)/g; As written, it's not terribly useful unless you are interested in how many times $forthis matches and put @found in scalar context. But if you substitute a quantified character class for $forthis, suddenly you are extracting from a sequence all runs of hydrophobic amino acid residues, lowercase nucleotides, and so forth, all in one line. I didn't think you could use a regex as the list context construct in map, but decided to try it rather than rolling another clunky "while matches push array and return once finished". Actually it's part of a method that maps to @found differently using if-elsif-elsif... so the one-lining is much nicer on the eyes. Yay Perl. :) Hope everyone is doing well, Nathanael From abez at abez.ca Tue Oct 29 21:30:35 2002 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:09 2004 Subject: cool use for map In-Reply-To: <3DBF51EE@wm2.uvic.ca> Message-ID: For stuff like this remember to give a good comment :) You'll come back to this later and make a doubletake unless you give a reasonable comment. One line is great but your comments will probably have to be pretty large. Ahh, the responsibilities that come with great power :) On Tue, 29 Oct 2002, nkuipers wrote: > @found = map { $1 } $searchthis =~ m/($forthis)/g; > > As written, it's not terribly useful unless you are interested in how many > times $forthis matches and put @found in scalar context. But if you > substitute a quantified character class for $forthis, suddenly you are > extracting from a sequence all runs of hydrophobic amino acid residues, > lowercase nucleotides, and so forth, all in one line. I didn't think you > could use a regex as the list context construct in map, but decided to try it > rather than rolling another clunky "while matches push array and return once > finished". Actually it's part of a method that maps to @found differently > using if-elsif-elsif... so the one-lining is much nicer on the eyes. Yay > Perl. > > :) > > Hope everyone is doing well, > > Nathanael > -- abez----- ----- ------ - ------ -- ------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) --- --- ------ --------- - - ------ --------abez From Peter at PSDT.com Wed Oct 30 10:58:57 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: cool use for map In-Reply-To: <3DBF51EE@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021030085204.00ab0990@shell2.webquarry.com> At 07:22 PM 10/29/2002 -0800, nkuipers wrote: >@found = map { $1 } $searchthis =~ m/($forthis)/g; Um, I do not think this does what you intend. It gives you a copy of the last $1 for each match: % perl -le '@x = map { $1 } "ab12cd3f g" =~ /([a-z])/g; print join " * ", @x' g * g * g * g * g * g Whereas if you do @found = $searchthis =~ /($forthis)/g; since the result of a /g match in list context is the list of all capturing parentheses matches, you get % perl -le '@x = "ab12cd3f g" =~ /([a-z])/g; print join " * ", @x' a * b * c * d * f * g which seems considerably more useful... and less obscure. >As written, it's not terribly useful unless you are interested in how many >times $forthis matches and put @found in scalar context. But if you >substitute a quantified character class for $forthis, suddenly you are >extracting from a sequence all runs of hydrophobic amino acid residues, >lowercase nucleotides, and so forth, all in one line. I didn't think you >could use a regex as the list context construct in map, but decided to try it >rather than rolling another clunky "while matches push array and return once >finished". Actually it's part of a method that maps to @found differently >using if-elsif-elsif... so the one-lining is much nicer on the eyes. Yay >Perl. Peter Scott peter@psdt.com http://www.perldebugged.com From nkuipers at uvic.ca Wed Oct 30 11:40:17 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: cool use for map Message-ID: <3DC0061F@wm2.uvic.ca> well, it may be a vagary of activestate perl, but when I ran this: @array = map {$1} 'aagctGGGGTCAGAtttttacGCATCAaa' =~ m/([A-Z]+)/g; print "Found $_\n" for @array; I got Found GGGGTCAGA Found GCATCA although I agree it's more complex than @found = $searchthis =~ /($forthis)/g; wierd. >===== Original Message From Peter Scott ===== >At 07:22 PM 10/29/2002 -0800, nkuipers wrote: >>@found = map { $1 } $searchthis =~ m/($forthis)/g; > >Um, I do not think this does what you intend. It gives you a copy of the >last $1 for each match: > >% perl -le '@x = map { $1 } "ab12cd3f g" =~ /([a-z])/g; print join " * ", @x' >g * g * g * g * g * g > >Whereas if you do > > @found = $searchthis =~ /($forthis)/g; > >since the result of a /g match in list context is the list of all capturing >parentheses matches, you get > >% perl -le '@x = "ab12cd3f g" =~ /([a-z])/g; print join " * ", @x' >a * b * c * d * f * g > >which seems considerably more useful... and less obscure. > >>As written, it's not terribly useful unless you are interested in how many >>times $forthis matches and put @found in scalar context. But if you >>substitute a quantified character class for $forthis, suddenly you are >>extracting from a sequence all runs of hydrophobic amino acid residues, >>lowercase nucleotides, and so forth, all in one line. I didn't think you >>could use a regex as the list context construct in map, but decided to try it >>rather than rolling another clunky "while matches push array and return once >>finished". Actually it's part of a method that maps to @found differently >>using if-elsif-elsif... so the one-lining is much nicer on the eyes. Yay >>Perl. > >Peter Scott >peter@psdt.com >http://www.perldebugged.com From Peter at PSDT.com Wed Oct 30 11:55:35 2002 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:09 2004 Subject: cool use for map In-Reply-To: <3DC0061F@wm2.uvic.ca> Message-ID: <4.3.2.7.2.20021030094758.00ab4170@shell2.webquarry.com> At 09:40 AM 10/30/02 -0800, nkuipers wrote: >well, it may be a vagary of activestate perl, but when I ran this: > >@array = map {$1} 'aagctGGGGTCAGAtttttacGCATCAaa' =~ m/([A-Z]+)/g; >print "Found $_\n" for @array; > >I got > >Found GGGGTCAGA >Found GCATCA What version of perl? I tried it on ActiveState 5.6.1 and it says Found GCATCA Found GCATCA I get the same results on Solaris perl 5.6.1 and 5.004, and Linux perl 5.6.0 and 5.9.0. I don't have anything in between to try it on. Just to be clear about it, here's a paste from my DOS window: C:\WINDOWS\Desktop>perl -le "@array = map {$1} 'aagctGGGGTCAGAtttttacGCATCAaa'~ m/([A-Z]+)/g;print qq(Found $_) for @array" Found GCATCA Found GCATCA I wonder whether your perl is broken. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From nkuipers at uvic.ca Wed Oct 30 17:31:52 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: Peter was right... Message-ID: <3DC0B554@wm2.uvic.ca> ...about global regexes mapping only the last captured match to a list. My bad. From nkuipers at uvic.ca Thu Oct 31 20:06:38 2002 From: nkuipers at uvic.ca (nkuipers) Date: Wed Aug 4 00:11:09 2004 Subject: Perl interacting with C++ Message-ID: <3DC219F4@wm2.uvic.ca> Hello all, A friend of mine is very interested in Perl but does the bulk of his programming in C++. He's currently writing a game, and he wants to be able to extract information from a (for example) QuakeII config file. He knows enough of Perl to realize that it is ideal for that sort of thing. Is there a way to have C++ sit on (talk to?) Perl or vice versa? Could he shunt out from his C++ to a perl script that does it's thing and returns findings for use in the C++ program? If so, where should I tell him to look for information? Thanks. if ( $halloween ) { print "Happy Halloween!\n" } #Happy Halloween, stay safe :) Nathanael From abez at abez.ca Thu Oct 31 21:32:33 2002 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:09 2004 Subject: Perl interacting with C++ In-Reply-To: <3DC219F4@wm2.uvic.ca> Message-ID: There's a chapter in programming perl regarding using C and Perl together. You can call perl directly from C. I recommend when making a game to use Perl for scripting. perldoc perlembed perldoc perlxs perldoc perlxstut perldoc perlcall perldoc perlapi On Thu, 31 Oct 2002, nkuipers wrote: > Hello all, > > A friend of mine is very interested in Perl but does the bulk of his > programming in C++. He's currently writing a game, and he wants to be able to > extract information from a (for example) QuakeII config file. He knows enough > of Perl to realize that it is ideal for that sort of thing. Is there a way to > have C++ sit on (talk to?) Perl or vice versa? Could he shunt out from his > C++ to a perl script that does it's thing and returns findings for use in the > C++ program? If so, where should I tell him to look for information? > > Thanks. > > if ( $halloween ) { print "Happy Halloween!\n" } #Happy Halloween, stay safe > :) > > Nathanael > -- abez----- ----- ------ - ------ -- ------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) --- --- ------ --------- - - ------ --------abez