MARC::Record insert function

2003-11-05 Thread Leif Andersson
fanumerical tags is the same as simple filing. I do not know if the idea behind MARC::Record is that it should be extendable to cover for other MARC dialects. Even if it, as it stands, only is intended for MARC21 records, I still think it would be nice to have an insert method like the one a

RE: MARC::Record insert function

2003-11-05 Thread Leif Andersson
Am I missing something? I can not find this in MARC::Record Leif -Ursprungligt meddelande- Från: Ed Summers [mailto:[EMAIL PROTECTED] Skickat: den 5 november 2003 19:58 Till: [EMAIL PROTECTED] Ämne: Re: MARC::Record insert function On Wed, Nov 05, 2003 at 07:29:59PM +0100, Leif

Return values from MARC::Record

2003-11-06 Thread Leif Andersson
valid record in this context?" The answer would be, I'd guess, if we can perform other methods on the object it is a "valid" record (so far). Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281

Re: Return values from MARC::Record

2003-11-06 Thread Leif Andersson
subfields = eval { $record->field('035')->subfield('a') }; Leif -Ursprungligt meddelande- Från: Paul Hoffman [mailto:[EMAIL PROTECTED] Skickat: den 6 november 2003 22:30 Till: Leif Andersson Kopia: [EMAIL PROTECTED] Ämne: Re: Return values from MARC::Record On

Re: Return values from MARC::Record

2003-11-07 Thread Leif Andersson
some extra work to the subfield() method we can also do this $subfield = $record->subfield('035','a'); @subfields = $record->subfield('035','a'); print "subfield=$subfield\n"; print "[EMAIL PROTECTED]"; __END__ And it shouldn'

Re: Return values from MARC::Record

2003-11-07 Thread Leif Andersson
to do. Maybe I should add that I like MARC::Record - that's why I am doing this in the first place. I also appreciated your idiomatic code-arounds, even though it was not my primarily concern. Leif == Leif Andersson, Systems Librarian Stockholm University Libr

indicators - guilt by association

2003-12-07 Thread Leif Andersson
o put the allowence of letters in...) Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281

Re: Trailing spaces

2003-12-12 Thread Leif Andersson
I think there are some problems with your code. First, a number of typos, so it won't compile. Second, if $tagnumber is a repeatable field you will only fix the first one. You would have to do something like this instead: my @existing_fields = $record->field($tagnumber); And then loop through the

Re: MARC::Field::new_from_usmarc problems

2004-01-13 Thread Leif Andersson
It appears to be deceptive values in leader pos 12-16, which is supposed to point to the beginning of data. MARC::Record relies on this value. I do not know, though, if this is a sign of a different MARC flavour, or if something bad has happened to the record. If it is in accordance with a spec

Re: inserting diacrtics

2005-01-06 Thread Leif Andersson
And I am sure some guys will be more happy with a capital F in France. Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281 -Ursprungligt meddelande- Från

Re: Sort with MARC::Record

2005-01-31 Thread Leif Andersson
This is one way to do it: #!/usr/local/bin/perl -w use strict; use MARC::Batch; # sort marc records on field 001 # usage: sort_marc.pl infil.mrc > utfil.mrc my $batch = new MARC::Batch( 'USMARC', $ARGV[0] ); my @records = (); my @f001= (); my $idx = 0; while ( my $MARC = $batch->next

Re: Sort with MARC::Record (correction)

2005-02-01 Thread Leif Andersson
I am sorry, my earlier posting contained a little error. The last print statement should read print $records[$rec->[0]]->as_usmarc(); Jackie also pointed out that his 001 is alphanumeric. So he changed the comparision operator from "<=>" (numeric) to "cmp" The script should have looked

MARC::Record ordering of fields

2005-05-13 Thread Leif Andersson
rk, but I am interested in how others would address the same problem. Leif ====== Leif Andersson, Systems Librarian Stockholm University Library

Re: MARC::Record ordering of fields

2005-05-14 Thread Leif Andersson
lc($_->{_tag})] } @{$record->{_fields}}; If field "500" had not been assigned a sort key, we would see that field erroneously sort before any other 5XX field. To prevent that we could add a definition for 500 as the last one i.e. "500" => "500"

Re: Deleting a subfield using MARC::Record

2006-05-01 Thread Leif Andersson
gt;delete_subfield( code => $code, # of course occur => [0,2,3], # "occur" or "pos" or whatever... match => qr/pat/, # doesn't need to be repeatable ); Leif ====

MARC::Charset and transcoding of MARC::Record objects

2006-09-22 Thread Leif Andersson
seem to recall someone on this list mentioning the path MARC Record (MARC8) -> MARCXML (UTF8) -> MARC Record (UTF8) This trip involves, I'd guess, MARC::File::XML in addition to MARC::Charset But I suspect there may be different approaches here. Leif

MARC::Record and importing broken UTF8

2007-03-01 Thread Leif Andersson
introduce a "sloppy mode" switch? Leif ====== Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281 -Ursprungligt meddelande- Från: Mike Rylander [mailto:[EMAIL PROTECTED] Skickat: den 26 januar

Re: passing parameters to function as variable

2007-08-17 Thread Leif Andersson
ource]', ); my $field = $record->field('245'); my $revised_245 = MARC::Field->new('245', '', '', @a245); $field->replace_with($revised_245); Leif Andersson -Ursprungligt meddelande- Från: Merritt H Lennox [mailto:[EMAIL

Re: Marc blob - mysql

2007-09-20 Thread Leif Andersson
Jacobien, Try this: my $blob = $record->as_usmarc(); $blob= $dbh->quote($blob); And load $blob as you did before. Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN

Re: Help for utf-8 output

2008-03-01 Thread Leif Andersson
the record as_usmarc() ? If not I suggest this change be made to a future release of MARC::Record. I shall also add that this character mess only sets in when doing IO. If you are updating your databases through one API or another you are probably OK! Leif ===

Re: Help for utf-8 output

2008-03-03 Thread Leif Andersson
ce the faulty behaviour we can have a deeper look into it. Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281 -Ursprungligt meddelande- Från: Doran, Michael D

Re: Importing Perl package variables into a Perl script with "require"

2008-04-27 Thread Leif Andersson
ating the use of Locale::Maketext::Lexicon Probably too demanding for smaller projects, but still interesting. There is always a balance between how much work to spend on solving a problem, how flexible and scalable it has to be, if we like avoiding installing extra modules etc etc... Leif

Re: Stripping out Unicode combining characters (diacritics)

2008-05-06 Thread Leif Andersson
Leif == Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281 -Ursprungligt meddelande- Från: Doran, Michael D [mailto:[EMAIL PROTECTED] Skickat: den 6 maj 2008 04:13 Till: Mike Ryl

Re: MARC-perl: different versions yield different results

2010-10-12 Thread Leif Andersson
h = new MARC::Batch('USMARC', $ARGV[0]); $batch->strict_off (); $batch->warnings_off (); #binmode( STDOUT, ':raw' ); #binmode STDOUT; my $record = $batch->next; print $record->as_usmarc; As a habit I use binmode FH; when I write records to file. It is not nee

Re: MARC-perl: different versions yield different results

2010-10-12 Thread Leif Andersson
Leif, Is the downside to this approach that you are modifying a CPAN module in place, or is it something to do with the behavior of 'use bytes'? Would there be any undesirable side effects to adding 'use bytes' to MARC::File::USMARC::encode on CPAN? //Ed On Tue, Oct 12, 201

Re: MARC-perl: different versions yield different results

2010-10-12 Thread Leif Andersson
___ Från: Al [ra...@berkeley.edu] Skickat: den 12 oktober 2010 17:45 Till: Leif Andersson; perl4lib@perl.org Ämne: Re: MARC-perl: different versions yield different results Thanks, that does indeed do the trick. >MARC::Record 2.0.0, the so called unicode version,

SV: MARC-perl: different versions yield different results

2010-10-13 Thread Leif Andersson
m not sure my brute hack qualifies as a one. But for now I will leave that up to others to decide. /Leif Från: Galen Charlton [gmcha...@gmail.com] Skickat: den 12 oktober 2010 17:35 Till: Leif Andersson Kopia: Al; perl4lib@perl.org Ämne: Re: MARC-perl: diff

Re: Moose based Perl library for MARC records

2010-11-09 Thread Leif Andersson
Frédéric, Just out of curiosity - what was your main motivation for writing another MARC module? In what ways does your distribution differ from MARC::Record? /Leif

Re: MARC blob to MARC::Record object

2011-01-07 Thread Leif Andersson
Hi Michael, this is how I - in principle - usually do it: use MARC::Record; ... my $record = MARC::Record->new_from_usmarc( $blob ); /Leif Leif Andersson, Systems librarian Stockholm University Library Från: Doran, Michael D [do...@uta.edu] Skickat:

Re: MARC blob to MARC::Record object

2011-01-10 Thread Leif Andersson
$len = substr($marc,0,5); return substr($marc,0,$len); } else { $_[0]->{'eof'} = 1; return undef; } } sub EOF { # eof() $_[0]->{'eof'}; } sub FILENO {1} sub BINMODE {1} sub CLOSE {1} sub DESTROY {1} __END__ That's all folks,

Re: Anybody know what this USMARC.pm error is?

2011-05-30 Thread Leif Andersson
I am not sure I really got this. Because if I did: - The error messages in your orig posting were not the exact error messages. - The original posted code was not the actual code producing the errors - And the sample MARC records, supplied to demonstrate the errors, were actually OK Sometimes y

Re: MARCgrep.pl

2012-01-05 Thread Leif Andersson
This is a fine little piece of programming. (And useful too) I wished my own code looked this nice and clean! /Leif Andersson Stockholm University Library Från: Stefano Bargioni [bargi...@pusc.it] Skickat: den 13 december 2011 12:37 Till: perl4lib Ämne

Re: MARC::Charset 1.34

2013-02-11 Thread Leif Andersson
It gunzips fine, but then there seems to be something wrong with the tar file... /Leif Andersson Stockholm University Library

Re: MARC::Charset 1.34

2013-02-11 Thread Leif Andersson
uari 2013 20:01 Till: Leif Andersson Kopia: perl4lib Ämne: Re: MARC::Charset 1.34 Hi, On Mon, Feb 11, 2013 at 10:50 AM, Leif Andersson mailto:leif.anders...@sub.su.se>> wrote: It gunzips fine, but then there seems to be something wrong with the tar file... Could you elaborate? In particul

Re: MARC::Charset 1.34

2013-02-11 Thread Leif Andersson
Ah, I still had one of those bad archives left. So I could see that the file size differed. The bad .tar.gz was 182.056 bytes The good 191.865 And after unzipping the corrupt file I got a .tar file of size 191.865 ! gzipped twice? Well, I renamed the unzipped corrupt .tar file to .tar.gz And now

Re: reading and writing of utf-8 with marc::batch

2013-03-26 Thread Leif Andersson
Hi Eric, my first guess would be your terminal is not utf8. If you comment out #binmode( STDOUT, ":utf8" ); and that does the trick, then you can start looking for how to change your terminal settings. (And that can sometimes be a rather frustrating task, I'm afraid) /Leif Ande