From abez at abez.ca Fri Jun 6 16:34:50 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Assertions Message-ID: Has any one used a good assertions package which allows for disabling of assertions in perl s.t. the assertions will not be run. or choose what level of assertions to have? I'm thinking of eiffel assertions (pre, post, assert) but I want to be able to disable them for performance reasons. abram -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From Peter at PSDT.com Fri Jun 6 16:42:00 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Assertions In-Reply-To: Message-ID: <5.2.1.1.2.20030606143402.00b84640@shell2.webquarry.com> At 02:34 PM 6/6/2003 -0700, abez wrote: >Has any one used a good assertions package which allows for disabling of >assertions in perl s.t. the assertions will not be run. or choose what >level of >assertions to have? > >I'm thinking of eiffel assertions (pre, post, assert) but I want to be able to >disable them for performance reasons. Let's see, I read about those in this great book, oh, what's it called... ah, "Perl Debugged" :-) Try Carp::Assert. For more O-O variation like you describe, try Class::Contract. It claims it can be selectively disabled. (Page 96, in case you were wondering... :-) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From abez at abez.ca Fri Jun 6 16:53:05 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Assertions In-Reply-To: <5.2.1.1.2.20030606143402.00b84640@shell2.webquarry.com> References: <5.2.1.1.2.20030606143402.00b84640@shell2.webquarry.com> Message-ID: Ahhh stuff like that should be enclosed with tags :). Thanks for the tips. abram On Fri, 6 Jun 2003, Peter Scott wrote: > At 02:34 PM 6/6/2003 -0700, abez wrote: > >Has any one used a good assertions package which allows for disabling of > >assertions in perl s.t. the assertions will not be run. or choose what > >level of > >assertions to have? > > > >I'm thinking of eiffel assertions (pre, post, assert) but I want to be able to > >disable them for performance reasons. > > Let's see, I read about those in this great book, oh, what's it > called... ah, "Perl Debugged" :-) > > Try Carp::Assert. For more O-O variation like you describe, try > Class::Contract. It claims it can be selectively disabled. > > (Page 96, in case you were wondering... :-) > > > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From Peter at PSDT.com Tue Jun 10 19:21:05 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? Message-ID: <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> Shall Victoria.pm meet next week? (Note: I will be out of town the following week.) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From abez at abez.ca Tue Jun 10 19:32:11 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? In-Reply-To: <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> References: <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> Message-ID: Sounds good to me. Who shall present? On Tue, 10 Jun 2003, Peter Scott wrote: > Shall Victoria.pm meet next week? (Note: I will be out of town the > following week.) > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From Peter at PSDT.com Tue Jun 10 19:43:51 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? In-Reply-To: References: <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> Message-ID: <5.2.1.1.2.20030610174248.00b2d698@shell2.webquarry.com> At 05:32 PM 6/10/2003 -0700, abez wrote: >Sounds good to me. Who shall present? Well, the following month I shall be in a position to give a blow-by-blow recounting of the 7th annual Perl Conference. In other words, someone else's turn this month :-) >On Tue, 10 Jun 2003, Peter Scott wrote: > > > Shall Victoria.pm meet next week? (Note: I will be out of town the > > following week.) -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From darren at DarrenDuncan.net Tue Jun 10 20:14:40 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? In-Reply-To: <5.2.1.1.2.20030610172034.00b2d698@shell2.webquarry.com> Message-ID: On Tue, 10 Jun 2003, Peter Scott wrote: > Shall Victoria.pm meet next week? (Note: I will be out of town the > following week.) At this moment, I personally am indifferent. I could just as easily wait until the week after you are gone. (It will also give me more time to improve what I am currently coding.) -- Darren Duncan From nkuipers at uvic.ca Thu Jun 12 18:28:24 2003 From: nkuipers at uvic.ca (Nathanael Kuipers) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? Message-ID: <3EE90DDC@wm2.uvic.ca> I am mildly in favour of postponing the meeting. In my case, this is simply because next week is a 6-day workweek on campus for me, and even the thought of that makes me tired. I may or may not be there if the meeting is on, it depends how I feel. If there is any time left over after peter's Perl Conference review the following week however, I can review Sam Tregar's "Writing Perl Modules for CPAN". Nathanael From abez at abez.ca Thu Jun 12 18:57:44 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? In-Reply-To: <3EE90DDC@wm2.uvic.ca> References: <3EE90DDC@wm2.uvic.ca> Message-ID: Well then lets postpone. It makes very little difference to me as well as it will allow someone to come up with content if they so see fit. abram On Thu, 12 Jun 2003, Nathanael Kuipers wrote: > I am mildly in favour of postponing the meeting. In my case, this is simply > because next week is a 6-day workweek on campus for me, and even the thought > of that makes me tired. I may or may not be there if the meeting is on, it > depends how I feel. If there is any time left over after peter's Perl > Conference review the following week however, I can review Sam Tregar's > "Writing Perl Modules for CPAN". > > Nathanael > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From Peter at PSDT.com Thu Jun 12 19:37:55 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Meeting next week? In-Reply-To: <3EE90DDC@wm2.uvic.ca> Message-ID: <5.2.1.1.2.20030612173639.00ba21f0@shell2.webquarry.com> At 04:28 PM 6/12/2003 -0700, Nathanael Kuipers wrote: >I am mildly in favour of postponing the meeting. In my case, this is simply >because next week is a 6-day workweek on campus for me, and even the thought >of that makes me tired. I may or may not be there if the meeting is on, it >depends how I feel. If there is any time left over after peter's Perl >Conference review the following week however, I can review Sam Tregar's >"Writing Perl Modules for CPAN". My review won't be the following *week*, it'll be the following *month*. I think we are all in general agreement though, so I am hereby cancelling the June Victoria.pm meeting. Next meeting will be approximately the second week of July, to be scheduled shortly before then as usual. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ From abez at abez.ca Thu Jun 26 10:32:03 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection Message-ID: Can anyone direct me to documentation which would allow me dynamically ask classes what methods they fufill in perl? I'm looking for the reflection functionality in java but in perl. At the very least I want a list of available methods an object knows it can execute. abram -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From nkuipers at uvic.ca Thu Jun 26 11:25:49 2003 From: nkuipers at uvic.ca (Nathanael Kuipers) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection Message-ID: <3EFB2153@wm2.uvic.ca> Couldn't you simply access the symbol table for the class for a list of methods/variables? Use can() to double check? From abez at abez.ca Thu Jun 26 13:19:36 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection In-Reply-To: <3EFB2153@wm2.uvic.ca> References: <3EFB2153@wm2.uvic.ca> Message-ID: I found this webpage: http://perl.about.com/library/weekly/aa100900a.htm But is there better online or offline documentation on traversing the symbol tables. I tried traversing packages I made but it didnt produce the output I would expect. abram On Thu, 26 Jun 2003, Nathanael Kuipers wrote: > Couldn't you simply access the symbol table for the class for a list of > methods/variables? Use can() to double check? > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From nkuipers at uvic.ca Thu Jun 26 14:26:21 2003 From: nkuipers at uvic.ca (Nathanael Kuipers) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection Message-ID: <3EFB5033@wm2.uvic.ca> The following should do what you want...if this isn't what you tried, what about the output is not what you expected? #!/usr/bin/perl use File::Find; #example for (keys %File::Find::) { print "$_" if File::Find->can($_); } From abez at abez.ca Thu Jun 26 17:02:53 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection In-Reply-To: <3EFB5033@wm2.uvic.ca> References: <3EFB5033@wm2.uvic.ca> Message-ID: Ok that works I figured out my namespace was the problem. I wasn't looking at an actual package. Ok then thanks for the code, here's the code to grab all the methods and put them in a hash (so you can just use keys to get a list). Since we can have multiple inheritance we have to watch for cycles too. use strict; use Data::Dumper; my @packages = qw( File::Find ); foreach my $p (@packages) { print Dumper(printMethods($p)); } sub printMethods { no strict "refs"; my ($name,$done) = @_; $done = {} unless defined $done; $done->{$name} = 1; eval "use $name;"; my $arr = \@{"${name}::ISA"}; my $methods = { }; for (keys %{"${name}::"}) { $methods->{$_} = 1 if ${name}->can($_); } foreach my $elm (@$arr) { next if $done->{$elm}; #CYCLE my $hash = printMethods($elm,$done); while (my ($key) = each %$hash) { $methods->{$key} = 1; } } return $methods; } On Thu, 26 Jun 2003, Nathanael Kuipers wrote: > The following should do what you want...if this isn't what you tried, what > about the output is not what you expected? > > #!/usr/bin/perl > > use File::Find; #example > for (keys %File::Find::) { > print "$_" if File::Find->can($_); > } > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From yf110 at victoria.tc.ca Thu Jun 26 17:43:41 2003 From: yf110 at victoria.tc.ca (Malcolm Dew-Jones) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection In-Reply-To: Message-ID: On Thu, 26 Jun 2003, abez wrote: > > Ok that works I figured out my namespace was the problem. I wasn't looking at an > actual package. > > Ok then thanks for the code, here's the code to grab all the methods and put > them in a hash (so you can just use keys to get a list). Since we can have > multiple inheritance we have to watch for cycles too. (snip) The caveat being, of course that the code shown (but snipped) lists all the sub's, some of which may not work as methods, and doesn't list anything handled by autoload. So, for your own classes it may be fine, but will not be 100% reliable for classes in general. From darren at DarrenDuncan.net Thu Jun 26 17:56:36 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] new book on Perl 6 is out Message-ID: I discovered this today when looking at Perl.com: http://www.perl.com/pub/a/2003/06/25/perl6essentials.html There is a new book called "Perl 6 Essentials" being published by O'reilly, available in June (now?), written by Allison Randal, Dan Sugalski, Leopold T?tsch. The link I gave you has an excerpt from chapter 3, and other excerpts are available. I am thinking that I might get this book; do any of you think it is worthwhile to do so, considering the language isn't done being made yet? -- Darren Duncan From abez at abez.ca Thu Jun 26 18:31:12 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Reflection In-Reply-To: References: Message-ID: That's totally true. But it's definately a ``given'' seeing how it is impossible for code to be sure as to what code produces. Maybe when computers get to be more non-deterministic we can have a full out perl reflection suite. abram On Thu, 26 Jun 2003, Malcolm Dew-Jones wrote: > > The caveat being, of course that the code shown (but snipped) lists all > the sub's, some of which may not work as methods, and doesn't list > anything handled by autoload. > > So, for your own classes it may be fine, but will not be 100% reliable for > classes in general. > > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From nkuipers at uvic.ca Thu Jun 26 18:52:53 2003 From: nkuipers at uvic.ca (Nathanael Kuipers) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] new book on Perl 6 is out Message-ID: <3EFBC640@wm2.uvic.ca> If you have funny money, are interested in All Things Perl, and don't like reading the Apocalypse/Exegesis articles, this would be a great purchase. I dunno, I for one am not terribly interested in programming Parrot or the intermediate compiler (not yet anyway), we all know the philosophies brought to bear in Perl6 already, and syntax etc. is covered in aforementioned articles in as much detail as you could want for a language that isn't even finalized yet. $0.02 nathanael From darren at DarrenDuncan.net Thu Jun 26 20:11:38 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] new book on Perl 6 is out In-Reply-To: <3EFBC640@wm2.uvic.ca> References: <3EFBC640@wm2.uvic.ca> Message-ID: nathanael said: >If you have funny money, are interested in All Things Perl, and don't like >reading the Apocalypse/Exegesis articles, this would be a great purchase. I >dunno, I for one am not terribly interested in programming Parrot or the >intermediate compiler (not yet anyway), we all know the philosophies brought >to bear in Perl6 already, and syntax etc. is covered in aforementioned >articles in as much detail as you could want for a language that isn't even >finalized yet. >$0.02 Well, I have read all of the Exegesis, and some of the Apocalypses, although I tended to skim over the one on regular expressions after the first few pages. I thought that this book might be good for collecting together what is known so far in a concise manner, and would be mainly useful in bringing newcomers up to speed, in case people want to contribute to further development, or start planning their own extensions. Sort of like how people can start writing apps for a new operating system that isn't ready for casual users to use yet, so that when it is, your app or extension is ready right away. Now, what is "funny money"? Thank you for your feedback. -- Darren Duncan From timothy at telus.net Fri Jun 27 19:13:49 2003 From: timothy at telus.net (Timothy) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Correct List? Message-ID: <20030628001349.GA23262@timothy.thefok.com> Is this the correct list for the Victoria PM? I tried a few list commands and they came back with errors. My apologies if this is not the Perl list. -- -Timothy eMail: timothy@telus.net WebPage: http://mail.asl.bc.ca/~timothy (c) 883 GUE FrobozzCo From darren at DarrenDuncan.net Fri Jun 27 21:54:31 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Correct List? In-Reply-To: <20030628001349.GA23262@timothy.thefok.com> References: <20030628001349.GA23262@timothy.thefok.com> Message-ID: At 5:13 PM -0700 6/27/03, Timothy wrote: >Is this the correct list for the Victoria PM? I tried a few list commands >and they came back with errors. My apologies if this is not the Perl list. >-- >-Timothy Hello Timothy. Yes, this is the Victoria PM list. Since your message got through to me, you must have subscribed successfully. That said, you should receive two copies of my reply; if you do not then there may be an outstanding problem. Have a good day. -- Darren Duncan From Peter at PSDT.com Sat Jun 28 10:09:53 2003 From: Peter at PSDT.com (Peter Scott) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Correct List? In-Reply-To: <20030628012001.GA24374@timothy.thefok.com> References: <4.3.2.7.2.20030627173945.00a9c8b0@shell2.webquarry.com> <20030628001349.GA23262@timothy.thefok.com> <4.3.2.7.2.20030627173945.00a9c8b0@shell2.webquarry.com> Message-ID: <4.3.2.7.2.20030628080844.00ab2f00@shell2.webquarry.com> I don't have any experience with PNG formats. Anyone on the list got any help for Timothy? At 06:20 PM 6/27/2003 -0700, Timothy wrote: >Now a Perl question. I am attempting to read PNG files with Perl. Most >of it is fairly basic. However I am having a heck of a time figuring >out how the IDAT chunk works. I've read in the appropriate chunk from the >file as $strData. > > $strData = uncompress($strData); # <-- from Zlib > @PNGIDAT = unpack("C" x length($strData), $strData); > >So far so good. Now this is a 3x3 image true color, non-interlaced and >a bit depth of 8. The image is simply plain white. However when I print >the RGB values I don't get all 255s I get this: > > 1 255 255 255 0 0 0 0 0 0 > 255 0 0 0 0 0 0 2 0 0 > 0 0 0 0 2 0 0 0 0 0 > >I guess I'm not unpacking them correctly? The rest other chunks I had >no problems with. Any insight? TIA:) -- Peter Scott peter@psdt.com http://www.perldebugged.com From abez at abez.ca Sat Jun 28 10:51:17 2003 From: abez at abez.ca (abez) Date: Wed Aug 4 00:11:23 2004 Subject: [VPM] Correct List? In-Reply-To: <4.3.2.7.2.20030628080844.00ab2f00@shell2.webquarry.com> References: <4.3.2.7.2.20030627173945.00a9c8b0@shell2.webquarry.com> <20030628001349.GA23262@timothy.thefok.com> <4.3.2.7.2.20030627173945.00a9c8b0@shell2.webquarry.com> <4.3.2.7.2.20030628080844.00ab2f00@shell2.webquarry.com> Message-ID: Don't reinvent the wheel. Use GD. On Sat, 28 Jun 2003, Peter Scott wrote: > I don't have any experience with PNG formats. Anyone on the list got any > help for Timothy? > -- abez ------------------------------------------ http://www.abez.ca/ Abram Hindle (abez@abez.ca) ------------------------------------------ abez From timothy at telus.net Sat Jun 28 22:10:34 2003 From: timothy at telus.net (Timothy) Date: Wed Aug 4 00:11:23 2004 Subject: [Re: [VPM] Correct List?] Message-ID: <20030629031034.GA26537@timothy.thefok.com> Thanks for the reply:) However I don't know what GD is. Is it a CPAN module? I was kind of hoping this would be a fairly simple thing to do (like reading bitmaps) and it'd be a few lines of code with no external libraries. I guess I also wanted to understand the format. However at this point I just want it working... ----- Forwarded message from abez ----- > >Don't reinvent the wheel. Use GD. > >On Sat, 28 Jun 2003, Peter Scott wrote: >> >> I don't have any experience with PNG formats. Anyone on the list got >> any help for Timothy? >> -- -Timothy eMail: timothy@telus.net WebPage: http://mail.asl.bc.ca/~timothy (c) 883 GUE FrobozzCo From darren at DarrenDuncan.net Sun Jun 29 00:25:54 2003 From: darren at DarrenDuncan.net (Darren Duncan) Date: Wed Aug 4 00:11:23 2004 Subject: [Re: [VPM] Correct List?] Message-ID: Timothy said: >Thanks for the reply:) However I don't know what GD is. Is it a CPAN >module? I was kind of hoping this would be a fairly simple thing to >do (like reading bitmaps) and it'd be a few lines of code with no >external libraries. I guess I also wanted to understand the format. >However at this point I just want it working... GD is a library for creating bitmap images on the fly or editing existing ones, and it can translate a variety of image formats, especially PNG. The library is written in C for efficiency and it has Perl bindings. Have a look here: http://stein.cshl.org/WWW/software/GD/ And here: http://www.boutell.com/gd/ I don't know from personal experience how to install C extensions to Perl, as I have never compiled Perl myself, but used precompiled binaries. So I'm not exactly sure what is entailed in installing GD, unless it already comes with your distro. Just try saying "use GD" in a Perl program and see if it compiles. If it is already installed, then you have a cakewalk. -- Darren Duncan