Skip to content

Instantly share code, notes, and snippets.

View ctfliblime's full-sized avatar

Clay Fouts ctfliblime

  • PTFS
  • Portland, Oregon
View GitHub Profile
@ctfliblime
ctfliblime / gist:1187534
Created September 1, 2011 23:09
Using TIEHANDLE to modify filehandle output
package Plack::Middleware::Debug::CatchStderr;
use parent qw(Plack::Middleware::Debug::Base);
use strict;
use warnings;
our $VERSION = '0.001';
sub TIEHANDLE {
my ($class, $fh) = @_;
sub _koha_marc_update_bib_ids {
my ($record, $frameworkcode, $biblionumber, $biblioitemnumber) = @_;
my @isbns = $record->subfield('999','e'); # Account for 999$e field
my $new_field = MARC::Field->new(
'999' , '', '',
'c' => $biblionumber,
'd' => $biblioitemnumber,
map { ('e' => $_) } @isbns
);
@ctfliblime
ctfliblime / opac-search.pl
Created May 26, 2011 14:58
Using "local" to isolate caching
### a snippet from code added to opac/opac-search.pl
use vars qw($cache $MRXorig);
# This is not intended to be a long-term cache, but one that persists for
# only the duration one might expect to page around some search results.
# The max_size may need to be increased for very busy sites.
$cache = CHI->new(driver => 'Memory', global => 1, max_size => 3_000_000, expires_in => 120);
$MRXorig = \&MARC::Record::new_from_xml;