From rjbs-perl-abe at lists.manxome.org Sat May 6 20:11:09 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sat, 6 May 2006 23:11:09 -0400 Subject: [ABE.pm] $beer->next->drink while sober; Message-ID: <20060507031109.GP22336@zodiac.codesimply.com> Who wasn't at McGrady's on Wednesday? If you are not Faber, Tom, John, or me, you were not at McGrady's. Apparently we got there just in time for happy hour: $4 pitchers, $2.75 appetizers, and no blaring sports events. Don't get me wrong, though, despite my endless talk of beer: nobody was sloshed. I just never drink the stuff apart from geek meetings, so I get a bit enthusiastic, you see. Tom, who took over for me at IQE, said that my code sometimes makes him wonder what the hell I was thinking. John noted that everyone likes Lisp but nobody seems to have ever really done anything with it. I found myself trying to explain why Microsoft's new command line looks cool, and Faber humored me as I tried to explain the awesome power of closures with code scribbled on the back of a placemat. I think this is a feat worth repeating, and Faber suggested the first Wednesday of next month. That would be June 7, two and a half weeks before YAPC. Maybe I'll try to perform my talk, for practice -- or maybe I'll just have another burger. Objections or rescheduling requests? -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060506/369f8145/attachment.bin From rjbs-perl-abe at lists.manxome.org Sat May 6 20:40:05 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Sat, 6 May 2006 23:40:05 -0400 Subject: [ABE.pm] Sub::Exporter! Message-ID: <20060507034005.GQ22336@zodiac.codesimply.com> So, the one Perl thing that we did talk about a good bit was one of my current projects, Sub::Exporter. It's a replacement for Exporter.pm, the default (but boring and antiquated symbol exporter. The exporter is what makes this work: use LWP::Simple qw(get); my $contents = get 'http://www.cnn.com'; Sub::Exporter would let you support something like this: use LWP::Simple::SE; get => { proxy => 'http://10.2.0.1:8080' }, get => { -as => 'get_direct }; die "proxy and direct are different!" unless get($ARGV[0]) eq get_direct($ARGV[0]); The setup to use Sub::Exporter, above, might look something like this: package LWP::Simple::SE; use Sub::Exporter -setup => { exports => { get => \&get_builder }, }; sub get_builder { my ($class, $name, $arg) = @_; my $custom_get = sub { my ($url) = @_; get($url, $arg); } return $custom_get; } sub get { ... } Then, our call to the get built with a proxy would really be a call to: LWP:Simple::SE::get($url, { proxy => ... }); This is largely through the magic of closures: usually-anonymous subroutines that include hidden variables. Closure factories let you build little tools that behave just like you want and that can go away when you're done. If you think this sounds cool, you should consider looking into one of three things: * Sub::Exporter http://search.cpan.org/dist/Sub-Exporter This is the distribution of Sub::Exporter. Its docs may be demonstrative; it's free and right there. * Intermediate Perl This is basically "Learning Perl, vol 2" from O'Reilly. It just came out, and I received a copy in the mail. It covers references, objects, and modules. If you understand the contents of Learning Perl, you should give Intermediate Perl a go. It's where Perl starts to shine for a programmer, in my opinion. I was a technical reviewer on this book, and I can say that it's Darn Good. Chapter 7 is all about closures! * Higher-Order Perl If you totally understand closures and how to build and use them, pick up this fantastic book and find out that you have a lot more to learn. It's a book about using functional programming techniques (like closures) to make your Perl 100% more awesome. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060506/5ef26c3d/attachment.bin From faber at linuxnj.com Tue May 9 16:35:23 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 9 May 2006 19:35:23 -0400 Subject: [ABE.pm] $beer->next->drink while sober; In-Reply-To: <20060507031109.GP22336@zodiac.codesimply.com> References: <20060507031109.GP22336@zodiac.codesimply.com> Message-ID: <20060509233523.GC6043@neptune.faber.nom> On 06/05/06 23:11 -0400, Ricardo SIGNES wrote: > > Who wasn't at McGrady's on Wednesday? If you are not Faber, Tom, John, or me, > you were not at McGrady's. Apparently we got there just in time for happy > hour: $4 pitchers, $2.75 appetizers, and no blaring sports events. > > Don't get me wrong, though, despite my endless talk of beer: nobody was > sloshed. We're just gonna have to work harder next time then! > Tom, who took over for me at IQE, said that my code sometimes makes him wonder > what the hell I was thinking. John noted that everyone likes Lisp but nobody > seems to have ever really done anything with it. I found myself trying to > explain why Microsoft's new command line looks cool, and Faber humored me as I > tried to explain the awesome power of closures with code scribbled on the back > of a placemat. Good explanation, BTW. I happened to be reading up on continuation servers after our beerfest and the whole idea is based on closures. Made perfect sense to me! > I think this is a feat worth repeating, and Faber suggested the first Wednesday > of next month. That would be June 7, two and a half weeks before YAPC. Maybe > I'll try to perform my talk, for practice -- or maybe I'll just have another > burger. > > Objections or rescheduling requests? Unfortunately, I'm booked for the evening of June 7 (working). Other than that, I still vote for the first Wednesday of the month. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Thu May 11 11:37:14 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Thu, 11 May 2006 14:37:14 -0400 Subject: [ABE.pm] Report/HTML generation Message-ID: <20060511183714.GB14336@neptune.faber.nom> I've got to put together a report. Gathering the data together is no big deal. The presentation OTOH is. I want to run it past youse [sic] guys to see what you think and for suggestions for coding/modules and if Ruby On Rails could do something like this. In HTML terms, the report consists of a bunch of tables containing aggregate data inside of a outer table. The outer table is a two column table with two rows of tho outer table spanning columns. For the two rows that span columns, there is a barchart associated with each inner table. A cool feature would be the ability to click on a piece of aggregate data in one of the inner tables and have a popup window showing the constituent data. And/or double clicking the aggregate data to open the constituent data in another window. The possibilities are endless. And I have to be able to send the whole kit-n-kaboodle to a client who will not have access to our database. So here's how I'm thinking of doing it: Have Perl (Ruby?) gather up all the data and write an XHTML file that is entirely self-contained, e.g. the file consists of the aggregate data tables, the data for the popup tables, the CSS for the layout, etc.. Good idea? Bad idea? Any suggestion(s) to make my programming life easier to do this (other than outsourcing the job)? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From john-abe at apt202.net Thu May 11 14:57:52 2006 From: john-abe at apt202.net (John Cappiello) Date: Thu, 11 May 2006 17:57:52 -0400 Subject: [ABE.pm] Report/HTML generation Message-ID: <20060511215751.GC14018@apt202.net> Faber J. Fedor wrote: >A cool feature would be the ability to click on a piece of aggregate >data in one of the inner tables and have a popup window showing the >constituent data. And/or double clicking the aggregate data to open the >constituent data in another window. The possibilities are endless. One way to accomplish this, and in my opinion a nice way to present the data, /and/ keep it all in one file, is to use some javascript and some hidden html elements. I'm a little fuzzy on the two layers you have, but it doesn't matter really. Let's assume 1 data set, with 1 aggregated graph, and lots of subparts. Put the top level graph in a div (id='agg1') with an onclick event something like "document.getElementById('parts1').style.display='block'" The default style on parts1 would include {display: none}. So now, all your images for said page, can be included in your mail. The images inside the mail can refer to the attched format, the exact syntax escapes me at the moment. You don't have to worry about dealing with popups (something I doubt would be easy to finagle). And you get your sort of minimal view with hidden details. Something I like. >So here's how I'm thinking of doing it: Have Perl (Ruby?) gather up all >the data and write an XHTML file that is entirely self-contained, e.g. >the file consists of the aggregate data tables, the data for the popup >tables, the CSS for the layout, etc.. Yep, and I think my above suggestions will help with the details hidden aspect. I would just use TT. >Good idea? Bad idea? Any suggestion(s) to make my programming life easier >to do this (other than outsourcing the job)? I was going to recomment Mime::Lite for the email generation, but this seems like it might be even nicer, if you use TT, Mime::Lite::TT::HTML. -- jcap From faber at linuxnj.com Wed May 17 09:35:29 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 12:35:29 -0400 Subject: [ABE.pm] Report/HTML generation In-Reply-To: <20060511215751.GC14018@apt202.net> References: <20060511215751.GC14018@apt202.net> Message-ID: <20060517163529.GA405@neptune.faber.nom> On 11/05/06 17:57 -0400, John Cappiello wrote: > Faber J. Fedor wrote: > >A cool feature would be the ability to click on a piece of aggregate > >data in one of the inner tables and have a popup window showing the > >constituent data. And/or double clicking the aggregate data to open the > >constituent data in another window. The possibilities are endless. > > One way to accomplish this, and in my opinion a nice way to present the > data, /and/ keep it all in one file, is to use some javascript and some > hidden html elements. Cute. I like that. > >Good idea? Bad idea? Any suggestion(s) to make my programming life easier > >to do this (other than outsourcing the job)? > > I was going to recomment Mime::Lite for the email generation, but this > seems like it might be even nicer, if you use TT, Mime::Lite::TT::HTML. I was just going to use the system mail command to send it out, but I'll look into this Mime::Lite thingie. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Wed May 17 10:05:17 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 13:05:17 -0400 Subject: [ABE.pm] Finding my own objects Message-ID: <20060517170517.GB405@neptune.faber.nom> I'm finally getting around to writing the HTML report I mentioned in a previous thread. First thing I need to do is to generate the data and to do that, I want to write my own objects. So let me run my design past you guys and then tell you what my problem is then you can tell me if I'm on the right track. The final output is an aggregation of smaller reports. Each report is going to do an SQL stmt and format the resulting dataset. There are three types of repors: a SummaryReport, a ExposureReport and a SectorReport. Each of these will inherit common methods from TransparencyReport. Some common methods include style of output (ASCII, HTML, XHTML) , database handling, etc. My program is going to call the *Report objects, combine them with CSS and Javascript to form a final HTML output using the ideas John mentioned in a previous thread. So, am I totally off the wall here or what? And now, for my current problem... I like to keep my Perl modules in the $MY_LIBPATH directory. In each of my programs I have use lib $ENV{MY_LIBPATH} || die "\n$MY_LIBPATH is not set! Arrgh!\n"; use mymodule; at the top. I created my TransparencyReport.pm, put it in $MY_LIBPATH and used it. That worked. What I really want is to "use SummaryReport" in my program (where SummaryReport.pm is an empty subclass in $MY_LIBPATH) and have SummaryReport.pm inherit from TransparencyReport.pm. Unfortunately, I get Can't locate package TransparencyReport for @SummaryReport::ISA at ./runTransparencyReport.pl line 31 How do I get $MY_LIBPATH/SummaryReport.pm to inherit from $MY_LIBPATH/TransparencyReport.pm? Do I need to modify the ISA path in all of my modules/objects? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From mct at toren.net Wed May 17 10:17:46 2006 From: mct at toren.net (Michael C. Toren) Date: Wed, 17 May 2006 13:17:46 -0400 Subject: [ABE.pm] Finding my own objects In-Reply-To: <20060517170517.GB405@neptune.faber.nom> References: <20060517170517.GB405@neptune.faber.nom> Message-ID: <20060517171746.GA16690@netisland.net> On Wed, May 17, 2006 at 01:05:17PM -0400, Faber J. Fedor wrote: > I like to keep my Perl modules in the $MY_LIBPATH directory. In each of > my programs I have > > use lib $ENV{MY_LIBPATH} || die "\n$MY_LIBPATH is not set! Arrgh!\n"; Any reason not to just use $PERL5LIB, or $PERLLIB? -mct From faber at linuxnj.com Wed May 17 10:30:31 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 13:30:31 -0400 Subject: [ABE.pm] Finding my own objects In-Reply-To: <20060517171746.GA16690@netisland.net> References: <20060517170517.GB405@neptune.faber.nom> <20060517171746.GA16690@netisland.net> Message-ID: <20060517173031.GC405@neptune.faber.nom> On 17/05/06 13:17 -0400, Michael C. Toren wrote: > On Wed, May 17, 2006 at 01:05:17PM -0400, Faber J. Fedor wrote: > > I like to keep my Perl modules in the $MY_LIBPATH directory. In each of > > my programs I have > > > > use lib $ENV{MY_LIBPATH} || die "\n$MY_LIBPATH is not set! Arrgh!\n"; > > Any reason not to just use $PERL5LIB, or $PERLLIB? The reason is that moving from development to QA to production entails moving the code from one home dir to another. IOW, development is done by user 'faber', testing is done by 'qa' and production is run by 'prodn' all on the same machine so I need separate paths for each. BTW, should $PERL5LIB or $PERLLIB be empty? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From mct at toren.net Wed May 17 10:46:35 2006 From: mct at toren.net (Michael C. Toren) Date: Wed, 17 May 2006 13:46:35 -0400 Subject: [ABE.pm] Finding my own objects In-Reply-To: <20060517173031.GC405@neptune.faber.nom> References: <20060517170517.GB405@neptune.faber.nom> <20060517171746.GA16690@netisland.net> <20060517173031.GC405@neptune.faber.nom> Message-ID: <20060517174635.GB16690@netisland.net> On Wed, May 17, 2006 at 01:30:31PM -0400, Faber J. Fedor wrote: > The reason is that moving from development to QA to production entails > moving the code from one home dir to another. IOW, development is done > by user 'faber', testing is done by 'qa' and production is run by > 'prodn' all on the same machine so I need separate paths for each. Perhaps I don't understand your specific environment, but how does that prevent you from using the $PERL5LIB or $PERLLIB environmental variable? > BTW, should $PERL5LIB or $PERLLIB be empty? If you haven't set them, sure... -mct From faber at linuxnj.com Wed May 17 14:16:09 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 17:16:09 -0400 Subject: [ABE.pm] Finding my own objects In-Reply-To: <20060517174635.GB16690@netisland.net> References: <20060517170517.GB405@neptune.faber.nom> <20060517171746.GA16690@netisland.net> <20060517173031.GC405@neptune.faber.nom> <20060517174635.GB16690@netisland.net> Message-ID: <20060517211609.GD405@neptune.faber.nom> On 17/05/06 13:46 -0400, Michael C. Toren wrote: > On Wed, May 17, 2006 at 01:30:31PM -0400, Faber J. Fedor wrote: > > The reason is that moving from development to QA to production entails > > moving the code from one home dir to another. IOW, development is done > > by user 'faber', testing is done by 'qa' and production is run by > > 'prodn' all on the same machine so I need separate paths for each. > > Perhaps I don't understand your specific environment, but how does that > prevent you from using the $PERL5LIB or $PERLLIB environmental variable? Let me ask you this: why should I be using PERL[5]+LIB? Or, what are they used for? I took a guess and set them equal to $MY_LIBPATH and nothing changed wrt to the error I mentioned previously. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Wed May 17 14:30:33 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 17:30:33 -0400 Subject: [ABE.pm] Finding my own objects In-Reply-To: <20060517211609.GD405@neptune.faber.nom> References: <20060517170517.GB405@neptune.faber.nom> <20060517171746.GA16690@netisland.net> <20060517173031.GC405@neptune.faber.nom> <20060517174635.GB16690@netisland.net> <20060517211609.GD405@neptune.faber.nom> Message-ID: <20060517213033.GE405@neptune.faber.nom> On 17/05/06 17:16 -0400, Faber J. Fedor wrote: > Let me ask you this: why should I be using PERL[5]+LIB? Or, what are > they used for? > > I took a guess and set them equal to $MY_LIBPATH and nothing changed wrt > to the error I mentioned previously. Never mind. I found the answer ot the first and the typo with the second. Any comments about my OO design? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Wed May 17 16:34:04 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 19:34:04 -0400 Subject: [ABE.pm] debug() from perltoot Message-ID: <20060517233404.GF405@neptune.faber.nom> I'm working through the perltoot; mostly copying and pasting code snippets and trying to get them to work. There's one debug routine in perltoot that I don't get. In the "Overridden Methods" section, the author says to add the following to the subclass: use Carp; my $Debugging = 0; sub debug { my $self = shift; confess "usage: thing->debug(level)" unless @_ == 1; my $level = shift; if (ref($self)) { $self->{"_DEBUG"} = $level; } else { $Debugging = $level; # whole class } $self->SUPER::debug($Debugging); } Further down in my subclass code, I have things like carp $stmt."\n" if($Debugging); In my calling program, I do this: my $newTable = SummaryTable->new(); $newTable->debug(1); and my carp-ing statement never get called. After working through this, I've come to one of two conclusions: either every subclass has a $self->{_DEBUG} defined (which means it should go into the superclass) or I replace if (ref($self)) { $self->{"_DEBUG"} = $level; } else { $Debugging = $level; # whole class } with simply $Debugging = $level; So how is this overriding method supposed to work? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Wed May 17 17:15:08 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Wed, 17 May 2006 20:15:08 -0400 Subject: [ABE.pm] And another thing... Message-ID: <20060518001508.GA984@neptune.faber.nom> How do I pass a variable from the superclass to the subclass? Nothing I've tried works. Specifically, I want to make a DB connection in my superclass which all of the subclasses would use (ideally, it should be the same connection for all subclasses, but that's a nicetie right now). One ofthe simplest things I've done in my superclass is this: $dbh = connectToDB(); sub dbh { return $dbh; } and in my subclass, I've tried print "in subclass, dbh is ". $dbh ."\n"; print "in subclass, dbh is ". dbh() ."\n"; print "in subclass, dbh is ". $self->dbh() ."\n"; print "in subclass, dbh is ". $self->{dbh} ."\n"; print "in subclass, dbh is ". $self->SUPER::dbh() ."\n"; and numerous other things but I get various errors at the print statement. How is this thing supposed to work? -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From phil at five-lawrences.com Fri May 19 10:41:23 2006 From: phil at five-lawrences.com (Phil Lawrence) Date: Fri, 19 May 2006 12:41:23 -0500 Subject: [ABE.pm] And another thing... In-Reply-To: <20060518001508.GA984@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> Message-ID: On May 17, 2006, at 7:15 PM, Faber J. Fedor wrote: > How do I pass a variable from the superclass to the subclass? Nothing > I've tried works. > > Specifically, I want to make a DB connection in my superclass which > all > of the subclasses would use (ideally, it should be the same connection > for all subclasses, but that's a nicetie right now). One ofthe > simplest > things I've done in my superclass is this: See connect_cached in the DBI perldoc and see if it helps. Phil From faber at linuxnj.com Fri May 19 11:29:02 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Fri, 19 May 2006 14:29:02 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: References: <20060518001508.GA984@neptune.faber.nom> Message-ID: <20060519182902.GD5957@neptune.faber.nom> On 19/05/06 12:41 -0500, Phil Lawrence wrote: > > On May 17, 2006, at 7:15 PM, Faber J. Fedor wrote: > > > How do I pass a variable from the superclass to the subclass? Nothing > > I've tried works. I made it work, but I'm not sure if it's the Right Way; in my subclass I created a constructor which called the superclass constructor. > > Specifically, I want to make a DB connection in my superclass which > > all > > of the subclasses would use (ideally, it should be the same connection > > for all subclasses, but that's a nicetie right now). One of the > > simplest > > things I've done in my superclass is this: > > See connect_cached in the DBI perldoc and see if it helps. I'll look into that. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Fri May 19 11:31:37 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Fri, 19 May 2006 14:31:37 -0400 Subject: [ABE.pm] printing to a variable Message-ID: <20060519183137.GE5957@neptune.faber.nom> Can I print TO a variable? I want to use Perl's report formatting capability to generate text output but I want to store the output in a variable as opposed to printing to a file. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Fri May 19 17:51:09 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Fri, 19 May 2006 20:51:09 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060519183137.GE5957@neptune.faber.nom> References: <20060519183137.GE5957@neptune.faber.nom> Message-ID: <20060520005109.GJ13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-19T14:31:37] > Can I print TO a variable? > > I want to use Perl's report formatting capability to generate text > output but I want to store the output in a variable as opposed to > printing to a file. by "report formatting" do you mean "format"? Format is the devil. Avoid it. Consider using a real templating system, like Template.pm, instead. ...but yet. You need to create a filehandle that can write to a scalar. use IO::String; my $string; my $io = IO::String->new($string); print {$io} "This will be appended to the string."; -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060519/916f6b74/attachment.bin From fiedlert at gmail.com Mon May 22 03:24:43 2006 From: fiedlert at gmail.com (Ted Fiedler) Date: Mon, 22 May 2006 06:24:43 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060520005109.GJ13012@zodiac.codesimply.com> References: <20060519183137.GE5957@neptune.faber.nom> <20060520005109.GJ13012@zodiac.codesimply.com> Message-ID: <814422ce0605220324q15e8af19ob8591a57e293993c@mail.gmail.com> Perl6::Form - This is also a pretty nice module, althought I have not used it yet, I have been quite eager to. It runs on Perl5. http://search.cpan.org/~dconway/Perl6-Form-0.04/Form.pm BTW - Ive been lurking on this list for quite some time, do you have regular meetings? Ted Fiedler On 5/19/06, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2006-05-19T14:31:37] > > Can I print TO a variable? > > > > I want to use Perl's report formatting capability to generate text > > output but I want to store the output in a variable as opposed to > > printing to a file. > > by "report formatting" do you mean "format"? Format is the devil. Avoid it. > Consider using a real templating system, like Template.pm, instead. > > ...but yet. You need to create a filehandle that can write to a scalar. > > use IO::String; > > my $string; > my $io = IO::String->new($string); > > print {$io} "This will be appended to the string."; > > -- > rjbs > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (GNU/Linux) > > iD8DBQFEbmf95IEwYcR13KMRAoG3AJ9irtbT1903ulhC6lV3UWiE9xTDIgCfeoWH > 7NVDmPBm20zjYaBhLAHKndQ= > =9DNq > -----END PGP SIGNATURE----- > > > _______________________________________________ > ABE-pm mailing list > ABE-pm at pm.org > http://mail.pm.org/mailman/listinfo/abe-pm > > -- One of my most productive days was throwing away 1000 lines of code. -- Ken Thompson From rjbs-perl-abe at lists.manxome.org Mon May 22 04:33:41 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 07:33:41 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <814422ce0605220324q15e8af19ob8591a57e293993c@mail.gmail.com> References: <20060519183137.GE5957@neptune.faber.nom> <20060520005109.GJ13012@zodiac.codesimply.com> <814422ce0605220324q15e8af19ob8591a57e293993c@mail.gmail.com> Message-ID: <20060522113341.GT13012@zodiac.codesimply.com> * Ted Fiedler [2006-05-22T06:24:43] > Perl6::Form - This is also a pretty nice module, althought I have not > used it yet, I have been quite eager to. It runs on Perl5. > > http://search.cpan.org/~dconway/Perl6-Form-0.04/Form.pm Blech. While I like the concept, it's got typical Conway-an problems. Its implementation is hairy, and it uses Perl6::Export, which is a source filter. > BTW - Ive been lurking on this list for quite some time, do you have > regular meetings? Our meetings have traditionally been irregular, but hopefully we will now be meeting on the first Wednesday of the month. That would make our next meeting June 7, tentatively at JP McGrady's. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/6ba18a5f/attachment.bin From rjbs-perl-abe at lists.manxome.org Mon May 22 04:40:14 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 07:40:14 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060518001508.GA984@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> Message-ID: <20060522114014.GU13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-17T20:15:08] > How do I pass a variable from the superclass to the subclass? Nothing > I've tried works. I think your phrasing of the question here is confusing and/or confused. I think you mean this, but I might be wrong: How do I make a base class store data that is shared by its derived classes? I would do something like this: package ParentClass; my $dbh; sub get_dbh { # If we've already gotten the connection, return it. return $dbh if defined $dbh; $dbh = DBI->connect(...); return $dbh; } package ChildClass; use base qw(ParentClass); sub do_stuff { my ($self, $arg) = @_; my $dbh = $self->get_dbh; ... } Any child of ParentClass can call its own get_dbh and will be handed back a connection created by the parent and shared for all children. Is any part of the above unclear? It's early, so I'm not sure whether it should be confusing or not! ;) -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/d2634f4a/attachment.bin From rjbs-perl-abe at lists.manxome.org Mon May 22 04:40:14 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 07:40:14 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060518001508.GA984@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> Message-ID: <20060522114014.GU13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-17T20:15:08] > How do I pass a variable from the superclass to the subclass? Nothing > I've tried works. I think your phrasing of the question here is confusing and/or confused. I think you mean this, but I might be wrong: How do I make a base class store data that is shared by its derived classes? I would do something like this: package ParentClass; my $dbh; sub get_dbh { # If we've already gotten the connection, return it. return $dbh if defined $dbh; $dbh = DBI->connect(...); return $dbh; } package ChildClass; use base qw(ParentClass); sub do_stuff { my ($self, $arg) = @_; my $dbh = $self->get_dbh; ... } Any child of ParentClass can call its own get_dbh and will be handed back a connection created by the parent and shared for all children. Is any part of the above unclear? It's early, so I'm not sure whether it should be confusing or not! ;) -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/d2634f4a/attachment-0001.bin From phil at five-lawrences.com Mon May 22 05:14:59 2006 From: phil at five-lawrences.com (Phil Lawrence) Date: Mon, 22 May 2006 07:14:59 -0500 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060519183137.GE5957@neptune.faber.nom> References: <20060519183137.GE5957@neptune.faber.nom> Message-ID: <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> On May 19, 2006, at 1:31 PM, Faber J. Fedor wrote: > Can I print TO a variable? > > I want to use Perl's report formatting capability to generate text > output but I want to store the output in a variable as opposed to > printing to a file. Yes, memory tells me there is a special variable that contains the formatted text or something. Browse through the special variable section of the camel. But Ricardo is right... format is anathema!. I always used Text::Reform. Very nice. Phil From faber at linuxnj.com Mon May 22 10:06:42 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 22 May 2006 13:06:42 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> References: <20060519183137.GE5957@neptune.faber.nom> <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> Message-ID: <20060522170642.GB8435@neptune.faber.nom> Phil! where ya been? On 22/05/06 07:14 -0500, Phil Lawrence wrote: > But Ricardo is right... format is anathema!. I always used > Text::Reform. Very nice. I'll look into it, but since I also need to spit out HTML (and hopefully XML and other stuff) someday, I'll prolly go with Template.pm. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Mon May 22 10:04:26 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 22 May 2006 13:04:26 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060522114014.GU13012@zodiac.codesimply.com> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> Message-ID: <20060522170426.GA8435@neptune.faber.nom> On 22/05/06 07:40 -0400, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2006-05-17T20:15:08] > > How do I pass a variable from the superclass to the subclass? Nothing > > I've tried works. > > I think your phrasing of the question here is confusing and/or confused. I > think you mean this, but I might be wrong: > > How do I make a base class store data that is shared by its derived classes? Right, but "base class" == "superclass" and "derived class" == "subclass", no? > Any child of ParentClass can call its own get_dbh and will be handed back a > connection created by the parent and shared for all children. Is any part of > the above unclear? It's early, so I'm not sure whether it should be confusing > or not! ;) Not at all. As I stated before, my problem was not calling the base class' construstor when I created the derived class. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Mon May 22 11:00:05 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 14:00:05 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060522170426.GA8435@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> <20060522170426.GA8435@neptune.faber.nom> Message-ID: <20060522180005.GV13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-22T13:04:26] > On 22/05/06 07:40 -0400, Ricardo SIGNES wrote: > > * "Faber J. Fedor" [2006-05-17T20:15:08] > > > How do I pass a variable from the superclass to the subclass? Nothing > > > I've tried works. > > > > I think your phrasing of the question here is confusing and/or confused. I > > think you mean this, but I might be wrong: > > > > How do I make a base class store data that is shared by its derived > > classes? > > Right, but "base class" == "superclass" and "derived class" == > "subclass", no? Right. I mostly changed those words en passant because they're my preferred terms -- but what I wanted to clarify was "pass a variable." Variables are passed when you call a routine, which is not what inheritance does. I figured I knew what you meant, but ... > Not at all. As I stated before, my problem was not calling the base > class' construstor when I created the derived class. ...but with the code I provided, you don't need to do that. Perl makes cumulative method calls (call method in derived class, then less derived class, then even less derived class) non-trivial, so I prefer to make lots of small methods that can be entirely replaced. The get_dbh method I provided could be called from anywhere at any time, without requiring anything cumulative, including the constructor. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/acc93998/attachment.bin From faber at linuxnj.com Mon May 22 19:09:55 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 22 May 2006 22:09:55 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060522180005.GV13012@zodiac.codesimply.com> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> <20060522170426.GA8435@neptune.faber.nom> <20060522180005.GV13012@zodiac.codesimply.com> Message-ID: <20060523020955.GA10255@neptune.faber.nom> On 22/05/06 14:00 -0400, Ricardo SIGNES wrote: > > Not at all. As I stated before, my problem was not calling the base > > class' construstor when I created the derived class. > > ...but with the code I provided, you don't need to do that. I understand that. What I was trying to do was to build on the $self object, i.e. my base class defines $self->{date}, $self->{template}, etc. which all of the derived classes need. Then each derived class adds to $self the variables the derived class needs. This way I don't need to call '$dbh = get_dbh()' in every function that needs to do a SQL stmt (which are quite a few). -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Mon May 22 19:14:03 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Mon, 22 May 2006 22:14:03 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> References: <20060519183137.GE5957@neptune.faber.nom> <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> Message-ID: <20060523021403.GB10255@neptune.faber.nom> On 22/05/06 07:14 -0500, Phil Lawrence wrote: > But Ricardo is right... format is anathema!. I always used > Text::Reform. Very nice. Man, I could have *so* used that in a previous report! I just might go back and redo the report with it. The Template.pm I'm not quite sold on. IT works great, but all I'm doing is moving my for loops and printf from inside the object to a template file outside of the object. Not sure I'm getting any benefit from it so far... -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Mon May 22 20:40:26 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 23:40:26 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060523020955.GA10255@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> <20060522170426.GA8435@neptune.faber.nom> <20060522180005.GV13012@zodiac.codesimply.com> <20060523020955.GA10255@neptune.faber.nom> Message-ID: <20060523034026.GY13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-22T22:09:55] > On 22/05/06 14:00 -0400, Ricardo SIGNES wrote: > > > Not at all. As I stated before, my problem was not calling the base > > > class' construstor when I created the derived class. > > > > ...but with the code I provided, you don't need to do that. > > I understand that. What I was trying to do was to build on the $self > object, i.e. my base class defines $self->{date}, $self->{template}, > etc. which all of the derived classes need. Then each derived class > adds to $self the variables the derived class needs. This way I don't > need to call '$dbh = get_dbh()' in every function that needs to do a SQL > stmt (which are quite a few). ...but then don't you end up always having to say, for example: my $dbh = $self->{dbh}; # or my $sth = $self->{dbh}->prepare(...) What I'm wondering is why it's not better to say: my $sth = $self->dbh->prepare(...); ...where the dbh method is the get_dbh method with a few fewer chars. I feel like one of us is missing something, and it very well may be me! -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/2d96772d/attachment.bin From rjbs-perl-abe at lists.manxome.org Mon May 22 20:41:30 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Mon, 22 May 2006 23:41:30 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060523021403.GB10255@neptune.faber.nom> References: <20060519183137.GE5957@neptune.faber.nom> <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> <20060523021403.GB10255@neptune.faber.nom> Message-ID: <20060523034130.GZ13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-22T22:14:03] > On 22/05/06 07:14 -0500, Phil Lawrence wrote: > > But Ricardo is right... format is anathema!. I always used > > Text::Reform. Very nice. > > Man, I could have *so* used that in a previous report! I just might go > back and redo the report with it. > > The Template.pm I'm not quite sold on. IT works great, but all I'm > doing is moving my for loops and printf from inside the object to a > template file outside of the object. Not sure I'm getting any benefit > from it so far... I do enough complicated stuff that "requires" something like Template-Toolkit that I don't mind using it all the time for things that don't need it. There's Text::Reform, though, for light use. Also, Text::Template has been a long time favorite for.. um... a long time. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/54d6b1e6/attachment.bin From faber at linuxnj.com Mon May 22 21:49:43 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 23 May 2006 00:49:43 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060523034026.GY13012@zodiac.codesimply.com> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> <20060522170426.GA8435@neptune.faber.nom> <20060522180005.GV13012@zodiac.codesimply.com> <20060523020955.GA10255@neptune.faber.nom> <20060523034026.GY13012@zodiac.codesimply.com> Message-ID: <20060523044943.GA10725@neptune.faber.nom> On 22/05/06 23:40 -0400, Ricardo SIGNES wrote: > * "Faber J. Fedor" [2006-05-22T22:09:55] > > On 22/05/06 14:00 -0400, Ricardo SIGNES wrote: > > > > Not at all. As I stated before, my problem was not calling the base > > > > class' construstor when I created the derived class. > > > > > > ...but with the code I provided, you don't need to do that. > > > > I understand that. What I was trying to do was to build on the $self > > object, i.e. my base class defines $self->{date}, $self->{template}, > > etc. which all of the derived classes need. Then each derived class > > adds to $self the variables the derived class needs. This way I don't > > need to call '$dbh = get_dbh()' in every function that needs to do a SQL > > stmt (which are quite a few). > > ...but then don't you end up always having to say, for example: > > my $dbh = $self->{dbh}; > # or > my $sth = $self->{dbh}->prepare(...) You know, I've never used prepare() all that much in my coding. Most of my UPDATES are one-liners (one-tuplers? :-) and most of my INSERTS are mass INSERTs better done by LOAD DATA INFILE. Most of my variables are in the WHERE or other subordinate clauses because I'm doing far more SELECTS than anything else. > What I'm wondering is why it's not better to say: > > my $sth = $self->dbh->prepare(...); > > ...where the dbh method is the get_dbh method with a few fewer chars. How do you get from get_dbh() to 'my $sth = $self->dbh' or even 'my $sth = $self->{dbh}'? You dropped a 'get_' in there! Most of my code has been my @returnedRow = $self->{"_DBH"}->selectrow_array($stmt); or selecatall_hashref, etc. > I feel > like one of us is missing something, and it very well may be me! Well, this could be a first! :-) -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From faber at linuxnj.com Mon May 22 21:54:42 2006 From: faber at linuxnj.com (Faber J. Fedor) Date: Tue, 23 May 2006 00:54:42 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060523034130.GZ13012@zodiac.codesimply.com> References: <20060519183137.GE5957@neptune.faber.nom> <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> <20060523021403.GB10255@neptune.faber.nom> <20060523034130.GZ13012@zodiac.codesimply.com> Message-ID: <20060523045442.GB10725@neptune.faber.nom> On 22/05/06 23:41 -0400, Ricardo SIGNES wrote: > > The Template.pm I'm not quite sold on. IT works great, but all I'm > > doing is moving my for loops and printf from inside the object to a > > template file outside of the object. Not sure I'm getting any benefit > > from it so far... > > I do enough complicated stuff that "requires" something like Template-Toolkit > that I don't mind using it all the time for things that don't need it. > There's Text::Reform, though, for light use. Also, Text::Template has been a > long time favorite for.. um... a long time. I'm missing something here. What's the diff between TT (Template-Toolkit, right?) and Template.pm (Text::Template)? Their docs both start out the same (with a form letter wanting to break $someone = 'Bill Gates' legs) so I figured they were one in the same. Do they handle loops differently? That's where most of my work is for this report. -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com From rjbs-perl-abe at lists.manxome.org Mon May 22 22:02:04 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 23 May 2006 01:02:04 -0400 Subject: [ABE.pm] And another thing... In-Reply-To: <20060523044943.GA10725@neptune.faber.nom> References: <20060518001508.GA984@neptune.faber.nom> <20060522114014.GU13012@zodiac.codesimply.com> <20060522170426.GA8435@neptune.faber.nom> <20060522180005.GV13012@zodiac.codesimply.com> <20060523020955.GA10255@neptune.faber.nom> <20060523034026.GY13012@zodiac.codesimply.com> <20060523044943.GA10725@neptune.faber.nom> Message-ID: <20060523050204.GA13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-23T00:49:43] > > > What I'm wondering is why it's not better to say: > > > > my $sth = $self->dbh->prepare(...); > > > > ...where the dbh method is the get_dbh method with a few fewer chars. > > How do you get from get_dbh() to 'my $sth = $self->dbh' or even 'my $sth > = $self->{dbh}'? You dropped a 'get_' in there! Instead of this: my $dbh; sub get_dbh { return $dbh if $dbh; $dbh = DBI->connect(...); return $dbh; } ...I write exactly the same thing, but with a different name for the sub. In reality, though, I'd write something more like: my $dbh; sub dbh { $dbh ||= DBI->connect(...); } > Most of my code has been > > my @returnedRow = $self->{"_DBH"}->selectrow_array($stmt); As a general rule, only one method should ever access any given hash entry on your object, if it's a blessed hash. Everything else should use that method. So, getting at the dbh associated with the object should be done with the "dbh" method, which is the only thing that looks at $self->{_DBH} There are exceptions, but that's a good starting point. It makes future extensibility much, much, much simpler. I have spent countless hours fixing code that doesn't follow this guideline. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060523/683d4b8b/attachment.bin From rjbs-perl-abe at lists.manxome.org Mon May 22 22:16:19 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 23 May 2006 01:16:19 -0400 Subject: [ABE.pm] printing to a variable In-Reply-To: <20060523045442.GB10725@neptune.faber.nom> References: <20060519183137.GE5957@neptune.faber.nom> <682DBBAF-EEDB-42E5-85DC-AB714FF78CF9@five-lawrences.com> <20060523021403.GB10255@neptune.faber.nom> <20060523034130.GZ13012@zodiac.codesimply.com> <20060523045442.GB10725@neptune.faber.nom> Message-ID: <20060523051618.GB13012@zodiac.codesimply.com> * "Faber J. Fedor" [2006-05-23T00:54:42] > I'm missing something here. What's the diff between TT > (Template-Toolkit, right?) and Template.pm (Text::Template)? Their docs > both start out the same (with a form letter wanting to break $someone = > 'Bill Gates' legs) so I figured they were one in the same. > > Do they handle loops differently? That's where most of my work is for > this report. I don't see where you're seeing anything like that for Template::Toolkit. Are you looking at docs here: http://search.cpan.org/dist/Template-Toolkit/ Text::Template is an incredibly simple, lightweight templating system that uses embedded Perl to give you the full power of Perl in simple templates. Template Toolkit is a little language that provides an extremely extensible and comprehensive system for building templates. Text::Template is tiny. Template Toolkit is grand. Both make looping trivial. -- rjbs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060523/9419e077/attachment-0001.bin From phil at five-lawrences.com Fri May 26 05:25:49 2006 From: phil at five-lawrences.com (Phil Lawrence) Date: Fri, 26 May 2006 07:25:49 -0500 Subject: [ABE.pm] subclassing the DBI Message-ID: On May 22, 2006, at 9:09 PM, Faber J. Fedor wrote: > ... What I was trying to do was to build on the $self > object, i.e. my base class defines $self->{date}, $self->{template}, > etc. which all of the derived classes need. Then each derived class > adds to $self the variables the derived class needs. This way I don't > need to call '$dbh = get_dbh()' in every function that needs to do > a SQL > stmt (which are quite a few). Sorry I'm a few days late, especially since this is something I know a *lot* about. Subclassing the DBI is non-trivial. I think Ricardo elsewhere gave the usual Perl answers for subclassing, but you need to know up front that it's different with DBI. [time passes] rats! can't my subclassing example! Maybe it's on my laptop, I'll check later. Probably you can google my name and "subclassing the DBI" or something and get most of the details. But if you do it right everything then works the Way It Should... e.g. you can see in the following call to my subclassed module I've expanded the connect () method a bit, but it does all the original stuff too. our $dbh = LUDBI->lu_connect ( $sid , 'user_name' , $ENV{SUPER_SECRET_PWD} , {LUDBI_interact=> $LUDBI_interact,PrintError=>0,RaiseError=>1,AutoCommit=>0} ) or die "Couldn't connect!"; DBI->trace(3,"$0.trace.log") if $trace; $DBI::neat_maxlen = 4600 if $trace; Phil From rjbs-perl-abe at lists.manxome.org Tue May 30 11:39:36 2006 From: rjbs-perl-abe at lists.manxome.org (Ricardo SIGNES) Date: Tue, 30 May 2006 14:39:36 -0400 Subject: [ABE.pm] UG News--Good. Fast. Cheap. O'Reilly Launches PDF Guides Message-ID: <20060530183936.GA13012@zodiac.codesimply.com> This looked sort of interesting: ----- Forwarded message ----- Good. Fast. Cheap. O'Reilly Launches PDF Guides As part of O'Reilly Media's commitment to delivering vital technology information to people who need it, when they need it, O'Reilly is launching an ongoing series of PDF publications to address cutting edge technologies. O'Reilly's PDF guides are in-depth, immediate, timely, and authoritative. Readers can purchase and download the PDFs through the O'Reilly online store, with no restrictions on the ability to save, copy, or print them. The advantages to readers are numerous. O'Reilly authors can disseminate crucial information as the need arises, without having to wait for enough material to fill an entire book. Production time is reduced dramatically, giving IT professionals and others immediate access to the knowledge they want. Plus, readers can easily search the text, copy and paste handy bits of code into their applications, and take the PDF with them even when they're offline. But most importantly, readers won't have to compromise in their pursuit of timely information--these PDFs provide the high-quality content for which O'Reilly has come to be known. This month's PDF offerings are available now: "Build Tag Clouds in Perl and PHP" by Jim Bumgardner First popularized by the web sites Flickr, Technorati, and del.icio.us, these amorphous clumps of words now appear on a slew of web sites as visual evidence of their membership in the elite corps of "Web 2.0." This PDF analyzes what is and isn't a tag cloud, offers design tips for using them effectively, and then shows how to collect tags and display them in the tag cloud format. Scripts are provided in Perl and PHP. ISBN: 0-596-52794-2, 46 pages, $9.99 US, $12.99 CAN http://www.oreilly.com/catalog/tagclouds/ "Web Services on Rails" by Kevin Marshall In recent years, web services have become increasingly useful to smaller web site developers. Thanks to standards like SOAP and XML-RPC as well as frameworks such as Ruby on Rails, developers can easily create web service clients and servers with fewer errors. This guide looks at how Ruby on Rails makes building web service clients and servers simple and fun, with plenty of working examples and code details so you can see just how everything works. ISBN: 0-596-52796-9, 32 pages, $9.99 US, $12.99 CA http://www.oreilly.com/catalog/websor/ "Atlas UpdatePanel Control" by Bertrand Le Roy and Matt Gibbs The key to making ASP.NET applications more responsive to user input is the UpdatePanel control. In this tutorial, you'll learn from the experts: Bertrand Le Roy, UpdatePanel control's architect and developer, and Matt Gibbs, Atlas dev team manager. This PDF document contains all you need to get started implementing AJAX functionality in existing ASP.NET applications. ISBN: 0-596-52747-0, 56 pages, $9.99 US, $12.99 CA http://www.oreilly.com/catalog/atlasupc/ "Search Engine Optimization" by Harold Davis SEO--short for Search Engine Optimization--is the art, craft, and science of driving web traffic to web sites. Whether your web site depends on broad, general traffic, or high-quality, targeted traffic, this PDF has the tools and information you need to draw more traffic to your site, and build your bottom line. You?ll learn how to effectively use PageRank and Google itself--effective use of SEO means understanding how Google works: how to boost placement in Google search results, how not to offend Google, and how best to use paid Google programs. You?ll also learn how to best organize your web pages and web sites, apply SEO analysis tools, establish effective SEO best practices, and much more. ISBN: 0-596-52786-1, 41 pages, $9.99 US, $12.99 CA http://www.oreilly.com/catalog/seo/ Other PDFs from O'Reilly can be found in the O'Reilly Store at: http://pdfs.oreilly.com ================================================================ O'Reilly 1005 Gravenstein Highway North Sebastopol, CA 95472 http://ug.oreilly.com/ http://ug.oreilly.com/creativemedia/ ================================================================ ----- End forwarded message ----- -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060530/8fe198f9/attachment.bin From joshua.mcadams at gmail.com Wed May 31 21:11:05 2006 From: joshua.mcadams at gmail.com (Joshua McAdams) Date: Wed, 31 May 2006 23:11:05 -0500 Subject: [ABE.pm] YAPC::NA Message-ID: <49d805d70605312111r364c211cg60d5aabd0e050efb@mail.gmail.com> Hi there fellow Perl Mongers. I'm writing to remind you all that YAPC::NA is only a few weeks away. The conference will be held in Chicago June 26th through 28th and will feature four simultaneous sessions of Perl talks for three days in addition to a job fair, banquet, and auction. After the conference Damian Conway, Randal Schwartz, and brian d foy will be sticking around and conducting professional training classes and extremely reduced prices. This email is a little spammy (sorry about that), but I just wanted to remind you all about the conference and also ask for your help in promoting it so that we can fill up the few spots that are remaining. For more information check out http://www.yapcchicago.org. We invite you to put up posters: http://yapcchicago.org/yapc_poster.pdf http://yapcchicago.org/yapc_poster_white.pdf Or maybe a web banner: http://www.yapcchicago.org/yapc_banner_wide.jpg http://www.yapcchicago.org/yapc_banner_narrow.jpg Thank you for your help in making YAPC a success once again, Josh McAdams