[ic] [interchange] Only apply GDBM filters if they are not already installed
Gert van der Spoel
gert at 3edge.com
Fri Aug 31 10:30:26 UTC 2012
> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org [mailto:interchange-users-
> bounces at icdevgroup.org] On Behalf Of Stefan Hornburg (Racke)
> Sent: vrijdag 31 augustus 2012 13:27
> To: interchange-users at icdevgroup.org
> Subject: Re: [ic] [interchange] Only apply GDBM filters if they are not
> already installed
>
> On 08/31/2012 03:22 AM, David Christensen wrote:
> > commit 0c31ea3287df97c8fedbf23ad71244e4ebe019c7
> > Author: David Christensen<david at endpoint.com>
> > Date: Thu Aug 30 20:01:28 2012 -0500
> >
> > Only apply GDBM filters if they are not already installed
> >
> > In certain circumstances, using the same GDBM-based file in
> multiple catalogs with
> > GDBM_ENABLE_UTF8=1 set was causing the GDBM filters to be installed
> multiple times on the same
> > handle, which was resulting in encoding/decoding errors.
> >
> > Vend::Table::GDBM will now only install the filters if they do not
> exist on this handle, which
> > should preserve existing behavior plus account for these corner-
> cases.
> >
> > lib/Vend/Table/GDBM.pm | 8 ++++----
> > 1 files changed, 4 insertions(+), 4 deletions(-)
> > ---
> > diff --git a/lib/Vend/Table/GDBM.pm b/lib/Vend/Table/GDBM.pm
> > index fb82dbb..559f904 100644
> > --- a/lib/Vend/Table/GDBM.pm
> > +++ b/lib/Vend/Table/GDBM.pm
> > @@ -150,10 +150,10 @@ sub apply_utf8_filters {
> > my $out_filter = sub { $_ = encode('utf-8', $_) };
> > my $in_filter = sub { $_ = decode('utf-8', $_) };
> >
> > - $handle->filter_store_key($out_filter);
> > - $handle->filter_store_value($out_filter);
> > - $handle->filter_fetch_key($in_filter);
> > - $handle->filter_fetch_value($in_filter);
> > + $handle->filter_store_key($out_filter) unless $handle-
> >filter_store_key();
> > + $handle->filter_store_value($out_filter) unless $handle-
> >filter_store_value();
> > + $handle->filter_fetch_key($in_filter) unless $handle-
> >filter_fetch_key();
> > + $handle->filter_fetch_value($in_filter) unless $handle-
> >filter_fetch_value();
> >
> > return $handle;
> > }
> >
>
> Running Interchange with this change gives the following message:
>
> Configuring catalog dataident...Using MySQL,
> DSN=dbi:mysql:dataident...LocaleDatabase locale: Usage:
> GDBM_File::filter_store_key(db, code) at
> /usr/lib/interchange/Vend/Table/GDBM.pm line 153, <CONFIG> line 40.
>
> done.
Maybe the change is a bit 'ruby-esque' :)
Perhaps Mike's one-liner does a better job in this case?
CU,
Gert
More information about the interchange-users
mailing list