RE: reading and writing of utf-8 with marc::batch
Eric-- I'm with Leif. The output you got looks like utf-8 displayed on a terminal that doesn't support it. Whether you need to fix the terminal display is another matter--I've never felt compelled to do so. Anyway, I think you can now sign yourself "Eric Did-it-right-the-first-time Morgan!" Mike > -Original Message- > From: Leif Andersson [mailto:leif.anders...@sub.su.se] > Sent: Tuesday, March 26, 2013 5:57 PM > To: Eric Lease Morgan; perl4lib@perl.org > Subject: Re: reading and writing of utf-8 with marc::batch > > 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 Andersson > Stockholm UL > > Från: Eric Lease Morgan [emor...@nd.edu] > Skickat: den 26 mars 2013 21:22 > Till: perl4lib@perl.org > Ämne: reading and writing of utf-8 with marc::batch > > For the life of me I can't figure out how to do reading and writing of > UTF-8 with MARC::Batch. > > I have a UTF-8 encoded file of MARC records. Dumping the records and > greping for a particular string illustrates the validity: > > $ marcdump und.marc | grep Sainte-Face > und.marc > 1000 records > 2000 records > 3000 records > 4000 records > 5000 records > 6000 records > 7000 records > 8000 records > 9000 records > 1 records > 11000 records > 12000 records > 245 00 _aAnnales de l'Archiconfrérie de la Sainte-Face > 610 20 _aArchiconfrérie de la Sainte-Face > 13000 records > $ > > I then run a Perl script that simply reads each record and dumps it to > STDOUT. Notice how I define both my input and output as UTF-8: > > #!/shared/perl/current/bin/perl > > # configure > use constant MARC => './und.marc'; > > # require > use strict; > use MARC::Batch; > > # initialize > binmode ( MARC, ":utf8" ); > my $batch = MARC::Batch->new( 'USMARC', MARC ); > $batch->strict_off; > $batch->warnings_off; > binmode( STDOUT, ":utf8" ); > > # read & write > while ( my $marc = $batch->next ) { print $marc->as_usmarc } > > # done > exit; > > But my output is munged: > > $ ./marc.pl > und.mrc > $ marcdump und.mrc | grep Sainte-Face > und.mrc > 1000 records > 2000 records > 3000 records > 4000 records > 5000 records > 6000 records > 7000 records > 8000 records > 9000 records > 1 records > 11000 records > 12000 records > 245 00 _aAnnales de l'Archiconfrérie de la Sainte-Face > 610_aArchiconfrérie de la Sainte-Face > 13000 records > $ > > What am I doing wrong!? > > -- > Eric Lease Morgan > University of Notre Dame > > 574/631-8604
RE: Printing to a Windows receipt printer from a perl script
Phil, Have you tried something like this: http://code.activestate.com/lists/perl-win32-users/30503/ I haven't done this myself, just interested in what you're trying! Mike -Original Message- From: Phil Shirley [mailto:pshir...@cuyahogafallslibrary.org] Sent: Thursday, March 24, 2011 10:13 AM To: perl4lib@perl.org Subject: Printing to a Windows receipt printer from a perl script I've written some perl scripts in the past but I've never printed to a printer, and I'm having trouble getting this to work. I'd be grateful for any help you could give me. What I want to do is print to a receipt printer on the parallel port (or in some cases a USB port) of a PC running Windows XP or Windows 2000. Ideally, I'd like to print a scaler or an array to the printer, rather than printing the contents of a file. Actually, the goal is to print the price of items on the checkout receipt at the circ desk. Our III system doesn't provide for this, but I was going to try to intercept the print job using Alphatronics Port Monitor, send the receipt data to a script that looked up each barcode and returned its price, and then printed out the receipt plus the value of what you checked out. Maybe it's not a practical project; at this point I'm trying to get a feel for whether this is something I could do. What I've done: I've installed ActivePerl and nmake on my pc (later I tried Strawberry Perl). I also tried several things for printing: 1. Tried this code: open(PRN, "|lp"); print PRN "hello"; result: error message: 'lp' is not recognized as an internal or external command, operable program or batch file. 2. Tried this code: open( LPT, "> lpt1" ) or die "error opening printer port $!\n"; print LPT "hello"; close(LPT); result: no error message, but no printing. 3. Tried installing and use the module "Printer" from cpan but it seems to need Win32::Printer. 4. Tried installing Win32::Printer but it fails the "make". Is there something else I can do? Maybe a different scripting language would make it easier to print in Windows. Phil -- Phil Shirley Technology Services Coordinator Cuyahoga Falls Library Cuyahoga Falls, Ohio 330-928-2117, ext. 109 pshirley at CuyahogaFallsLibrary dot org -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
RE: passing records from OAI-Harvester to MARC-Record
> -Original Message- > From: josh santelli [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 22, 2008 12:19 PM > To: Perl4lib > Cc: KREYCHE, MICHAEL > Subject: Re: passing records from OAI-Harvester to MARC-Record > > > Mike, > > I think Ed Summers' message (from Dec. 17th) on the code4lib > mailing list might be helpful or relevant: > > http://serials.infomotions.com/code4lib/archive/2007/200712/ Perfect! That thread is just what I needed and Ed's solution is exactly what I was groping for. If I'd been subscribed to CODE4LIB back in December, I'm sure I would have sat up and taken notice. > I'm not familiar with these perl modules. -- If I want to try > something out I tend to use a pared down version of my > OaiList.pl script that I keep which is part of our OAI Toolkit: > > http://sourceforge.net/projects/umoaitoolkit/ I'll have a look at that, too! Thanks a bunch! Mike -- Michael Kreyche Systems Librarian / Associate Professor Libraries and Media Services Kent State University 33
passing records from OAI-Harvester to MARC-Record
I'm trying something a little new for me and, as usual, the first time is the hardest. I'm harvesting MARC records from a repository and want to modify them. In the past I've used LWP to retrieve raw XML, parsed it, and turned it into a MARC structure. Now I'm trying to do things the "right" way. Once I've got a MARCXML record object, it seems to me there ought to be a simple way to turn it into a string and grab it, something like this: $results = $harvester->listAllRecords( metadataPrefix => 'marc21' ); while ( my $data = $results->next() ) { my $header = $data->header(); my $metadata = $data->metadata(); my $marcxml = ... missing link is here ... my $record = MARC::Record->new_from_xml( $marcxml ); ... good stuff goes here ... } Or maybe there's a more direct way. Anyhow, I've looked around a bit and haven't figured out a solution, so I would be greatly obliged if someone could point me in the right direction. TIA, Mike -- Michael Kreyche Systems Librarian / Associate Professor Libraries and Media Services Kent State University 330-672-1918