James Keenan | 7 Nov 18:21

Re: The lazy loader module list: 22 items strong


On Nov 7, 2005, at 12:00 PM, sw-design-request <at> metaperl.com transmitted 
this message:

> Date: Sun, 6 Nov 2005 20:03:15 -0800
> From: Terrence Brannon <metaperl <at> gmail.com>
> Subject: [sw-design] The lazy loader module list: 22 items strong
>
> I still don't know where I should post this. Perhaps on CPAN, but I 
> dont
> know what top-level namespace:
>
> http://metaperl.com/article-pod/Catalog-lazy_loaders/lazy_loaders.html
>
>

You could create a module framework* and have the lib/*.pm file be pure 
POD and have the t/001_load.t file simply test that the module loaded.  
Then you could upload it to CPAN and treat its revisions in the same 
way that you would handle revisions on any other module.  Suggested 
namespace:  Module::LazyLoaders::List.

jimk

*With ExtUtils::ModuleMaker, natch! 
(http://search.cpan.org/dist/ExtUtils-ModuleMaker/)
Terrence Brannon | 7 Nov 05:03

The lazy loader module list: 22 items strong

I still don't know where I should post this. Perhaps on CPAN, but I dont know what top-level namespace:

    http://metaperl.com/article-pod/Catalog-lazy_loaders/lazy_loaders.html

Anyway, I recently made use of Class::Prototyped and was grateful for it's lazy load support as well as good docs.



_______________________________________________
sw-design mailing list
sw-design <at> metaperl.com
http://metaperl.com/cgi-bin/mailman/listinfo/sw-design
Trey Harris | 26 Apr 09:17

Need help recalling a design pattern

There's a design pattern whose name I'm having trouble remembering (which
is making it hard for me to look up any literature on it).  I'm hoping
maybe someone here can help me.

I thought it was called the "recognizer" pattern, but Googling isn't
turning up anything by that name.  Basically, you have a data blob, and a
list of candidate classes, and you throw the data at the classes one by
one until one of them "recognizes" the blob and returns an object
encapsulating it.

In more advanced usage, you get responses back from the candidate classes
about how well they recognize the blob, and you eventually use the class
that can best recognize it, even if several can recognize it to some
extent.

Sound familiar?

Thanks,

Trey
Adam Kennedy | 16 Apr 11:04

Perl::MinimumVersion

Hi folks

I'm presuming all of you have had a chance to read Rob's perl.com article.

http://www.perl.com/pub/a/2005/04/14/cpan_guidelines.html

I for one noticed a few interesting/odd points. :)

Firstly, I disagree with Rob's idea of excluding all operating systems 
until you get reports from users. Most of the time, 90% of people don't 
report. They just don't use the module.

Better in my mind to ship anyway, but make sure your tests relating to 
the filesystem are extra paranoid. That way modules just simply fail to 
install on unusual things like VMS.

But what I most wanted to speak about was minimum Perl versions for 
code, relating his Rob's "gotchas" stuff.

It should be possible (and it's been in the mental roadmap for a long 
time) to create with PPI a package that can tell you what the minimum 
version of Perl is to run any chunk of Perl code.

All the module would need to be would be a collection of PPI &wanted 
functions which search for a particular thing...

sub has_our_variables {
     $_[1]->isa('PPI::Statement::Variable')
     and $_[1]->type eq 'our';
}

sub has_use_warnings {
     $_[1]->isa('PPI::Statement::Include')
     and $_[1]->pragma eq 'warnings';
}

... and a small register mapping each feature detector to the version in 
which it first appeared.

my %register = (
     has_our_variables => '5.6.0',
     has_use_warnings  => '5.6.0',
     etc...
     );

To find the minimum version you simple run some sort of...

# (pseudocode)
$Document = PPI::Document->load( file );
@versions = grep { $Document->find_any(function) } %register;

Then find the maximum version, and you've got your "required Perl 
version" for each bit of Perl.

Of course, there's some WAY more efficient algorithms I can see for 
speeding up the searching, and you would also have to trace down into 
included modules, but the above would get you a "naive minimum version", 
which you would then compared against the same for all the needed modules.

I keep meaning to get around to just implementing it, but I'm stretched 
for time as it is...

Rob, anyone? Interested? :)

Adam K
Terrence Brannon | 12 Apr 18:49

Alzabo driver support


Another thing: Currently Alzabo supports Pg and MySQL but how difficult
would it be to add Oracle as a new driver? 

I think that would be another nice criteria for that comparison
document: a list of drivers that it can currently support.

Terrence Brannon | 9 Apr 17:38

new Catalog - Catalog of SQL Phrasebooks


What is a SQL Phrasebook?
    A Perl module which separates SQL from your Perl code, making it
    accessible via a unique piece of keyed text. Think of it as
    Locale::KeyedText for relational databases.

Why would I need a SQL Phrasebook
    * Better software engineering
        Good software is designed in a DWIM fashion, where you spend time
        doing what you mean as opposed to making repeated DWIS efforts. Any
        large software project should not spend time defining sql in a
        scalar and then accessing that scalar. This clutters your core code,
        making it harder to follow, among other things. These tools provide
        support for creating a separate library.

    * Knowledge of tables accessed
        It is important to know what tables are being accessed in your
        project. This is important for numerous reasons. First, for
        statistical purposes, highly accessed tables might need tuning.
        Having all of your SQL in one place and having your code base
        searchable for a single label simplifies the process of
        understanding how your code is accessing tables. Second, if a table
        changes, you need to know which SQL was using that table. Having all
        the SQL in one place makes it easy to handle table changes.

    * Testing
        It is much easier to run model tests if all of your SQL is accessed
        in the same fashion. It is also easier to group the tests by concept
        if they can all be accessed via a unique label, e.g.:

         my @auth_sql  = qw/USER_ON_ID ROLE_FOR_ID PERMS_FOR_ID/;
         my @order_sql = qw/ORDERS_TO_DATE ORDERS_THIS_MONTH/;

    * Tuning
        If a database expert can stare at all of the SQL for a project in
        one place, it makes it easier for her to decide how to restructure
        the entire SQL set.... or even more exciting, he might create
        several SQL sets for different purposes and the Perl programmer can
        haul in the appropriate SQL set tuned for his task, all without
        modifying the Perl code!

    * Reuse
        You drop your SQL in the library once, use as many times as you want

List of SQL Phrasebooks
    * SQL::Catalog by Terrence Brannon
    * Class::Phrasebook::SQL by Rani Pinchuk
    * Data::Phrasebook by Barbie
    * DBIx::Librarian by Jason May
    * SQL::Library by Doug Gorley

  Modules with a larger purpose
    * DBIx::SQLEngine by Matthew Simon Ryan Cavaletto
    * Class::DBI/Ima::DBI
    * DBIx::Recordset

ERRATA
    This file is

    <http://www.metaperl.com/article-pod/Catalog-sql_phrasebooks>

AUTHOR
    Terrence Brannon, bauhaus <at> metaperl.com

--

-- 
	Carter's Compass: I know I'm on the right track when,
	   by deleting something, I'm adding functionality.
Terrence Brannon | 29 Mar 15:20

The Extreme Perl mailing list and book

We are having great discussions on Extreme Perl and software
engineering.

Here is the free online book on Extreme Perl:

     http://www.extremeperl.org/bk/home

and the link to mailing list is:

    http://groups.yahoo.com/group/extremeperl

If you don't know about Rob Nagler, he runs a consulting company in
Colorado where he uses his Perl framework bivio:

         http://www.bivio.biz/hm/download-bOP

The framework is quite complete and different from the web application
offers on CPAN. Certainly worth looking at for a fresh
perspective. There's also a demo of the Java petshop online to try
out... the View code is remarkably concise.

--

-- 
	Carter's Compass: I know I'm on the right track when,
	   by deleting something, I'm adding functionality.
Terrence Brannon | 29 Mar 14:57

Re: [extremeperl] Book: Higher Order Perl

Rob Nagler <nagler <at> bivio.biz> writes:

> Adam Turoff writes:
>> The net effect of being a purely functional language is that Haskell
>> forces you to decompose problems differently.
>
> I always thought that was the customer's job. ;-)  Seriously, is there
> any evidence that forcing programs to decompose problems the Haskell
> way is any better than the Perl way?

"A Spectacular Example" - Slide 27 in Mark-Jason Dominus' talk Strong
Typing With Perl:

       http://perl.plover.com/yak/typing/samples/slide027.html

> >
>> The Haskell approach isolates those portions of your program (into
>> Monads), that fold into its functional worldview.
>
> Since any real projects I do nowadays involves a database, I was
> curious how Haskell handled SQL, and it turns out that it "unwraps"
> it:
>
> http://www.haskell.org/hawiki/HaskellDbTutorial

The main evangelist for Haskell is about to join this list and address
this question.

> >
> Do you have experience with this?  Is it better to program this way
> than with good old SQL?

you can do that sort of programming in Haskell too.

> >
>> about your source code, the net result is that when you say "y = m * x + b"
>> the compiler has a pretty good idea of what you mean, without cluttering
>> up your code with type declarations and casting back and forth.
>
> Compiling, how quaint. :-)  I've got a friend who programs Eiffel for
> a living.  He waits 20 mins for the compiler to work things out before
> he can run an acceptance test.  At bivio, we say (more or less):
>
>     httpd -X
>
> and even in the most complex systems, it takes just a few seconds on a
> 2.4ghz processor before I can validate the end-user semantics of my
> change.  If there is a defect, my test tells me. 

With Haskell, you can reason about the correctness of your code. With
Perl you must test. 

By testing, what you are doing is selecting certain values from a
set. But: a set of values is a Haskell type!

In a strongly typed functional language, reasoning by proof gives you
100% _certainty_ that a certain function works for all input. There is
no need to test.

When you create a test, you are basically saying that the input is
poorly specified and you hope that Perl will be able to handle the
type-checking on the fly for you, either by object-oriented delegation
or type-casting.

> Are there any studies out there that compare programming Perl vs
> Haskell to do the same job?

Here are the Perl cookbook examples done in 10 other languages
including Haskell:

          http://pleac.sourceforge.net/

--

-- 
	Carter's Compass: I know I'm on the right track when,
	   by deleting something, I'm adding functionality.
Terrence Brannon | 8 Mar 18:16

object/package re- loaders


This is tangential to my list of lazy loader:

  http://www.metaperl.com/article-pod/Catalog-lazy_loaders/

I was wondering are there any tools which make it easy to reload a
module if it has changed?

This is useful when one has a long-running daemon, for instance.

I did find one:

	
http://search.cpan.org/~jesse/Module-Refresh-0.05/lib/Module/Refresh.pm

But wanted to see if there were others.
Terrence Brannon | 26 Jan 00:32

Class::Container by Ken Williams added to Catalog::lazy_loaders


In reading the docs to Class::Container, I noticed that object
creation could be delayed. Hence is belongs in the list of
module/object lazy loaders. Here's the entry:

=item * Class::Container by Ken Williams

L<http://search.cpan.org/dist/Class-Container>

This module's primary purpose is to provide something similar to
Inversion of Control: the container establishes and provides the
dependencies of a class instead of the class doing so.

Inversion of Control is discussed here:

L<http://www.picocontainer.org/Inversion+of+Control>

--

-- 
	Carter's Compass: I know I'm on the right track when,
	   by deleting something, I'm adding functionality.
Ovid | 21 Jan 22:32
Favicon

Logic Programming

Some on this list have expressed an interest in logic programming, so I
thought you might find http://www.perlmonks.org/index.pl?node_id=424075
of interest.

It's about a Prolog-based predicate logic engine in pure Perl.  It
handles unification and backtracking.  The write-up is basically an
intro to logic programming.  In this, I happen to mention Terrence's
AI::Proplog as only allowing boolean queries.  Please let me know if
I'm wrong.

The module won't be on the CPAN for a while as it needs a lot of work
(tests, docs, and tuning), but I do have a download link for the brave.
 Just don't flame me for what I don't have :)  Feel free to ask
questions.

Cheers,
Ovid 

=====
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

Gmane