On Wed, 23 Nov 2005 13:08:00 +0000 (UTC)
Mark Stosberg <[EMAIL PROTECTED]> wrote:

> On 2005-11-22, Cees Hek <[EMAIL PROTECTED]> wrote:
> >
> > I have a 'hashref' method in my Class::DBI base class that flattens
> > the data into a hashref:
> >
> > sub hashref {
> >   my $self = shift;
> >   die "Unknown column requested" if grep { ! $self->find_column($_) } @_;
> >   my @cols = @_ ? @_ : $self->columns();
> >   my %hash;
> >   @[EMAIL PROTECTED] = map { defined $_ ? "".$_ : undef } $self->get(@cols);
> >   return \%hash;
> > }


The FillInForm plugin will accept either hashrefs or objects supporting
a 'param' method.

I went the other way - I added a 'param' method to my Class::DBI base
class:


    sub param {
        my ($self) = shift;

        if (@_) {
            return map {
                $self->can($_) ? $self->$_ : undef
            } @_;
        }
        else {
            return $self->columns;
        }
    }


> It would be great if Class::DBI provided a more optimized version of
> this in the first place, since clearly the underlying DBI supports it.

Yeah, it does seem kind of like overkill.  In general, high performance
is not one of Class::DBI's strengths.


Michael


---
Michael Graham <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to