[Omaha.pm] Re: Omaha-pm Digest, Vol 7, Issue 10

r c chlo.prog at gmail.com
Sat Dec 4 10:16:02 CST 2004


Here are things I'm having difficulties with.  It would be great to
cover them at a meeting.  I too don't want to send our code around,
but would be happy to send it to you (Jay) if it would help give you
an idea what it is I'm trying to accomplish?

1. How to handle it when methods call die() (or croak() or ...)
without turning my code into line after line of if (...).

2. How to call methods so I can log messages they throw (be it using
warn(), Carp, ...).

3. How to write modules that do plenty of logging (for debugging). 
Log4perl looks really good, however, I don't want to require all
programs that call these modules to implement Log4perl just to use the
module.

Thanks
Ron


On Mon, 22 Nov 2004 12:00:29 -0600, omaha-pm-request at mail.pm.org
<omaha-pm-request at mail.pm.org> wrote:
> Send Omaha-pm mailing list submissions to
>        omaha-pm at mail.pm.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.pm.org/mailman/listinfo/omaha-pm
> or, via email, send a message with subject or body 'help' to
>        omaha-pm-request at mail.pm.org
> 
> You can reach the person managing the list at
>        omaha-pm-owner at mail.pm.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Omaha-pm digest..."
> 
> Today's Topics:
> 
>   1. Real world application (r c)
>   2. Re: Real world application (Jay Hannah)
>   3. Re: PERL and XML (Sean Edwards)
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 21 Nov 2004 11:54:06 -0800
> From: r c <chlo.prog at gmail.com>
> Subject: [Omaha.pm] Real world application
> To: omaha-pm at mail.pm.org
> Message-ID: <5e2006d104112111546b65dc3a at mail.gmail.com>
> Content-Type: text/plain; charset=US-ASCII
> 
> Hi, I would like some help in finding some "real world" Perl
> application examples.  Everything I'm finding are short programs
> without proper logging and error handling and only accomplish a simple
> task.
> Here's what I'm trying to accomplish for my first application:
> 
> 1. Write a singleton class/module that will create/hold a file handle
> to do logging (I found a singleton example in an old "ThePerlReview").
> This way all the other modules I write can simply call methods this
> object to do logging. -- Is this a good idea, how is it done in the
> real world so all modules can write to the same log?
> 
> 2. Write a class/module that will read a configuration file in a
> generic way (so like the logging class, I can reuse it for other
> projects).  This way I can call get/set... methods, I've seen a great
> generic example in "Object Oriented Perl" for the get/set part. -- I
> want to do this instead of sourcing in a hash so it can check that
> valid methods are being called.
> 
> 3. Write a wrapper around Net::FTP that will catch exceptions and
> retry login/put/get if time outs occur.  This class will use the
> logging singleton class to write to the same filehandle that the main
> application and all other modules are witting too.
> 
> 4. The actual application will use these modules and setup the logging
> singleton.
> 
> Any help in pointing resources that do any of these specific things
> and especially an "application" that does things similar to this would
> be greatly appreciated.
> 
> Thanks
> Ron
> 
> ------------------------------
> 
> Message: 2
> Date: Sun, 21 Nov 2004 16:39:12 -0600
> From: Jay Hannah <jay at jays.net>
> Subject: Re: [Omaha.pm] Real world application
> To: "Perl Mongers of Omaha, Nebraska USA" <omaha-pm at mail.pm.org>
> Message-ID: <2ABE4136-3C0E-11D9-BF9E-000A95E317B8 at jays.net>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> 
> On Nov 21, 2004, at 1:54 PM, r c wrote:
> > Hi, I would like some help in finding some "real world" Perl
> > application examples.  Everything I'm finding are short programs
> > without proper logging and error handling and only accomplish a simple
> > task.
> > Here's what I'm trying to accomplish for my first application:
> >
> > 1. Write a singleton class/module that will create/hold a file handle
> > to do logging (I found a singleton example in an old "ThePerlReview").
> >  This way all the other modules I write can simply call methods this
> > object to do logging. -- Is this a good idea, how is it done in the
> > real world so all modules can write to the same log?
> 
> Yup, we wrote one of those. It's important to us to be able to ensure
> that we can switch the logging behavior of "all programs" by just
> tweaking one class. How do you do it? You just write whatever logging
> routine you want into a single class, then use that class in all your
> programs. Nothing magical about it (until it saves you hours of coding
> -- that's pretty magical. -grin-).
> 
> > 2. Write a class/module that will read a configuration file in a
> > generic way (so like the logging class, I can reuse it for other
> > projects).  This way I can call get/set... methods, I've seen a great
> > generic example in "Object Oriented Perl" for the get/set part. -- I
> > want to do this instead of sourcing in a hash so it can check that
> > valid methods are being called.
> 
> Sure, setting explicit behavior for get/set methods is half the fun of
> OO coding. -grin-
> 
> > 3. Write a wrapper around Net::FTP that will catch exceptions and
> > retry login/put/get if time outs occur.  This class will use the
> > logging singleton class to write to the same filehandle that the main
> > application and all other modules are witting too.
> 
> We wrote something similar to that. We have many FTP partners, and I
> wanted to be able to do things like
> 
> my $ftp = Omni::FTP::new();
> $ftp->connect('Partner X');
> $ftp->send("myfile.txt");
> 
> Without having to remember all the specifics of how to get that file to
> the partner is question. Our home-grawn Net::FTP wrapper does all kinds
> of things automatically (compression, encryption, etc.), and then all
> my programs don't have to remember any tricky stuff.
> 
> > 4. The actual application will use these modules and setup the logging
> > singleton.
> 
> Yup.
> 
> > Any help in pointing resources that do any of these specific things
> > and especially an "application" that does things similar to this would
> > be greatly appreciated.
> 
> I can't really email our source code around, but I certainly could demo
> it in any Perl Monger meeting. Did you have specific questions about
> anything?
> 
> j
> 
> ------------------------------
> 
> Message: 3
> Date: Sun, 21 Nov 2004 17:43:51 -0800 (PST)
> From: Sean Edwards <cybersean3000 at yahoo.com>
> Subject: Re: [Omaha.pm] PERL and XML
> To: "Perl Mongers of Omaha, Nebraska USA" <omaha-pm at mail.pm.org>
> Message-ID: <20041122014351.37187.qmail at web52609.mail.yahoo.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Thank you Jay, I will take a look at the book.
> 
> -=Sean Edwards=-
> 
> --- Jay Hannah <jay at jays.net> wrote:
> 
> >
> > On Nov 20, 2004, at 12:51 PM, Sean Edwards wrote:
> > > Does anyone know of good introduction/tutorial to
> > PERL
> > > and XML?  I have a J2EE app to configure before
> > > compiling with Apache Ant, and I would prefer
> > using
> > > something like hashes and XML tags to replace
> > text,
> > > rather than regular expressions.
> >
> > Google "Perl XML"... The first 3 hits look really
> > strong:
> >
> > http://perl-xml.sourceforge.net/faq/
> > http://perl-xml.sourceforge.net/
> >
> http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html
> >
> > There's a book too:
> > http://www.oreilly.com/catalog/perlxml/
> >
> > We use XML::Twig a lot at work.
> >
> > j
> >
> > _______________________________________________
> > Omaha-pm mailing list
> > Omaha-pm at mail.pm.org
> > http://www.pm.org/mailman/listinfo/omaha-pm
> >
> 
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
> 
> ------------------------------
> 
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at mail.pm.org
> http://www.pm.org/mailman/listinfo/omaha-pm
> 
> End of Omaha-pm Digest, Vol 7, Issue 10
> ***************************************
>


More information about the Omaha-pm mailing list