MOD IDEA: A Singleton Registry

2002-03-16 Thread Robert Hanson
out having to change your code.

This solves most of the problem but it doesn't allow you to subclass a
singleton object.  Take this bit of code for instance:

 use Singleton::Foobar;
 $obj = Singleton::Foobar->instance();

What if you decided that you need to subclass Foobar at some later point,
and that your code needs to use the subclass?  Well you end up needing to
change a lot of code.  So the point of the registry is to create a layer
between the singleton and the calling code so that subclasses can be entered
into the system seamlessly without any pain.

So what you end up with is the ability to share instances of an object
throughout your application.  You get the ability to easily subclass to swap
out certain classes with others and don't need to change the calling code.
On top of all of that you also get the ability to store application and site
wide configuration information in a single place to save you maintenance
headaches in the future.  I dunno, that sounds like a good thing to me which
is why I built it..

=item Current/Planned Registry Singletons

Class::Singleton::Registry::DBI - A DBI singleton, supports multiple
instances based on name (currently in development).

Class::Singleton::Registry::Session - A singleton based on Apache::Session,
it will support multiple instances. Has not yet been started.

Class::Singleton::Registry::AppSession - A singleton based on
Apache::Session, it will support multiple instances. Has not yet been
started.

=item Creating Singletons

Creating a singleton that can be used with the registry is very
straightforward and simple.  It must have an init() method, a getInstance()
method, and a lastError() method.  The type of object returned, the caching
mechanism, and all other details are up to the singleton class author.

=head1 AUTHOR

Robert Hanson <[EMAIL PROTECTED]>




RE: MOD IDEA: A Singleton Registry

2002-03-16 Thread Robert Hanson

Yeah, looks like it's a match.

Thanks.

Rob

> -Original Message-
> From: Tatsuhiko Miyagawa [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 16, 2002 9:51 AM
> To: Robert Hanson
> Cc: [EMAIL PROTECTED]
> Subject: Re: MOD IDEA: A Singleton Registry
> 
> 
> On Sat, 16 Mar 2002 06:54:31 -0500
> [EMAIL PROTECTED] (Robert Hanson) wrote:
> 
> > This is something I have been putting together for a project 
> and I didn't
> > see anything comparable on CPAN.  Looking for comments, 
> suggestions, and any
> > existing modules that may duplicate the functionality. 
> 
> Object::Registrar?
> http://search.cpan.org/search?dist=Object-Registrar
> 
> 
> --
> Tatsuhiko Miyagawa




Seeking CPAN account

2000-04-29 Thread Robert Hanson

name: Robert Hanson
email: [EMAIL PROTECTED]
homepage: none
preferred user-ID: RHANSON

description of what you're planning to contribute:

XML::RAX - A module based on Sean McGrath's RAX proposal
http://www.xml.com/pub/2000/04/26/rax/index.html.

DSLI entry: adpO
44 character description: Record-oriented API for XML

It would be very nice, if you could also send a note...

The idea came from the the RAX article by Sean McGrath which was posted on
XML.com Friday (4/29).  I had never heard of RAX before, so I sent a mail to
Sean asking where to find the RAX spec and mentioned my interest in creating
a Perl module for it.  He replied urging me to write the module, and
mentioned that there is no official spec of RAX.  If RAX takes off, he plans
on writing up an official spec and hosting a web site for it.

It has only been 36 hours since the article came out on XML.com, so I doubt
there has been much discussion about the usefulness of RAX.  By the time you
get this, I should have already sent out a mail to ActiveState's XML-Perl
list and XML-DEV announcing this module.

Thanks,
  Robert





ANNOUNCE: XML::EasyOBJ

2000-07-29 Thread Robert Hanson


-
NAME
-

XML::EasyOBJ - Easy XML object navigation 


-
VERSION
-

Version 1.0 


-
SYNOPSIS
-

 # create the object
 my $doc = new XML::EasyOBJ('my_xml_document.xml');


 # print some text from the document
 print $doc->some_element(1)->getString;


 # print an attribute value
 print $doc->some_element(0)->getAttr('foo')."\n";


 # iterate over a list of elements
 foreach my $x ( $foo->some_element ) {
   print $x->getString."\n";
   }


-
DESCRIPTION
-

XML::EasyOBJ lets you take an XML page and essentially 
create an object out of it. Each element becomes a 
method, which makes it really easy to navigate an XML 
page (if you know the structure). The motivation behind 
this module was to create an interface so simple that 
anyone who knows the basic functionality of Perl can 
learn how to read data from an XML document in less 
than 10 minutes. 

This module is also a time saver even if you are 
familiar with the other modules available, but want 
something simple so that you can throw together a 
script in a few minutes (unless of course you know the 
DOM like the back of your hand). 


-
REQUIREMENTS
-

XML::EasyOBJ uses XML::DOM. XML::DOM is 
available from CPAN (www.cpan.org). 


-
INSTALLATION
-

This module installs in the normal way...

perl Makefile.pl
make
make install


-
AUTHOR/COPYRIGHT
-

Robert Hanson ([EMAIL PROTECTED]) 

Copyright 2000, Robert Hanson. All rights reserved. 

This library is free software; you can redistribute 
it and/or modify it under the same terms as Perl itself.