Re: send emails via perl

2014-11-19 Thread Marc Chantreux
On Wed, Nov 19, 2014 at 02:19:26PM +, PHILLIPS M.E. wrote:
 open (MAIL, |-, '/bin/mailx', '-s', $subject, @addresses)
 || die Failed to e-mail report: $!\n;  

what's the point of using perl then?

-- 
Marc Chantreux,
Mes coordonnées: http://annuaire.unistra.fr/chercher?n=chantreux
Direction Informatique, Université de Strasbourg (http://unistra.fr) 
Don't believe everything you read on the Internet
-- Abraham Lincoln


Re: send emails via perl

2014-11-19 Thread Marc Chantreux

On Wed, Nov 19, 2014 at 04:47:59PM +0200, Sergio Letuche wrote:
 i do not object to any approach suggested, all are welcome 

based on my own experience (experience feedback is something i expect
when i ask something in a list):

* don't use perl when i don't need it 
  (when it's about sending an email from a cronjob, i use mutt and m4)
* when i have to use perl, want things to be testable and independant
  from the cli tools. There are a lot of good modules to send email,
  MIME::Lite is one of them.

regards

-- 
Marc Chantreux,
Mes coordonnées: http://annuaire.unistra.fr/chercher?n=chantreux
Direction Informatique, Université de Strasbourg (http://unistra.fr) 
Don't believe everything you read on the Internet
-- Abraham Lincoln


Re: send emails via perl

2014-11-19 Thread Marc Chantreux
On Wed, Nov 19, 2014 at 02:51:58PM +, PHILLIPS M.E. wrote:
 If mailx is already installed and configured then this allows you to
 send your e-mail from your Perl script without installing other
 modules.  I have sometimes had to use servers where installing extra
 modules from CPAN was not under my control.

i personnaly use cpanm and local::lib to address those kind of problems.

this is so easy to install a module nowaday we should think twice before
not relying on the CPAN power. 

-- 
Marc Chantreux,
Mes coordonnées: http://annuaire.unistra.fr/chercher?n=chantreux
Direction Informatique, Université de Strasbourg (http://unistra.fr) 
Don't believe everything you read on the Internet
-- Abraham Lincoln


Re: Fwd: some transformations on file

2013-01-20 Thread Marc Chantreux
hello,

Just 2 notes about your attached content:

* please don't do that on mailing list: it's unsolicited content.
  provide download urls instead.
* those are not marc files so the exemples given below don't work as
  long as you haven't translated it to iso2709.

On Sun, Jan 20, 2013 at 03:54:18PM +0100, samuel desseaux wrote:
 Hi,
 
 I work on files for our library and i need some help.
 
 I have one file with all biblio records and one with items. A biblio record
 can have one or more than one item.
 
 First operation: i want to compare the two files and the identifier is the
 field 001. I want to have th results in two separates files
 
 1st: all the items which have the same 001 field like in the biblio record
 
 2nd: all the items which have not the same 001 field like in the biblio
 record

not tested but here is a good base:
  
use Modern::Perl;
use autodie;
use MARC::MIR; 

my %biblio;
my %report;
map { open $report{$_},$_.matches.txt } qw do dont ;

marawk { $biblio{(record_id)}=1 } 'biblio.mrc';
marawk {
my $id = record_id;
my $as = $biblio_id{ $to } ? 'do' : 'dont';
say $report{$as}, $id;
} 'items.mrc';


 Second operation: In my item files, all items of  a same biblio record have
 the same 001 field but they are all separated. I'd like to join all the
 items under only one 001 field

a) be carefull: it will load the whole file in memory
b) not tested :)

use Modern::Perl;
use autodie;
use MARC::MIR; 

my %items_for;
marawk { push @ { $items_for{(record_id)} } , $_ } 'items.mrc';

open my $fh,'sorted.items.mrc';
map { map {print $fh to_iso2709} @$_ } values %items_for;

 After, with the new file, i want to merge with biblio record and if i find
 2 identical 001, i attached the items on the biblio record 

i don't get it. you want to merge item records and biblio record?

 Third operation: how can i correct some data bad encoded. It's due to the
 old database which doesn't respect UTF8.

i see no problem in the provided content.

regards
marc


Re: Fwd: some transformations on file

2013-01-20 Thread Marc Chantreux
hello, 

tu peux me redonner un lien vers les fichiers marc ? 

cordialement,
marc

-- 
Marc Chantreux
Université de Strasbourg, Direction Informatique
14 Rue René Descartes,
67084  STRASBOURG CEDEX
☎: 03.68.85.57.40
http://unistra.fr
Don't believe everything you read on the Internet
-- Abraham Lincoln


Re: Fwd: some transformations on file

2013-01-20 Thread Marc Chantreux
oops! sorry about it: bad destination


On Sun, Jan 20, 2013 at 06:14:20PM +0100, Marc Chantreux wrote:
 hello, 
 
 tu peux me redonner un lien vers les fichiers marc ? 
 
 cordialement,
 marc
 
 -- 
 Marc Chantreux
 Université de Strasbourg, Direction Informatique
 14 Rue René Descartes,
 67084  STRASBOURG CEDEX
 ☎: 03.68.85.57.40
 http://unistra.fr
 Don't believe everything you read on the Internet
 -- Abraham Lincoln

-- 
Marc Chantreux
Université de Strasbourg, Direction Informatique
14 Rue René Descartes,
67084  STRASBOURG CEDEX
☎: 03.68.85.57.40
http://unistra.fr
Don't believe everything you read on the Internet
-- Abraham Lincoln


Re: MARC::MIR

2012-08-25 Thread Marc Chantreux
On Fri, Aug 24, 2012 at 12:02:38PM +0200, Robin Sheat wrote:
 That'd be great, thanks. Looking forward to having a bit of a play with it.

just pushed (as well as the Tutorial start). please run prove t after
git clone and tell me.

i'm in vacation next week but will work on some documentation (on
Perlude doc as well).

as i said: any feedback and ideas are welcome. even by phone.

regards
-- 
Marc Chantreux
Direction Informatique
http://unistra.fr


Re: MARC::MIR

2012-08-25 Thread Marc Chantreux
On Sat, Aug 25, 2012 at 12:22:52PM +0200, Magnus Enger wrote:
 What are you thinking of here? Converting MARC to RDF?

converting MARC to anything using MARC::MIR templates. I'm sorry the
discutions are coming before a first announcement: i'll explain ASAP.

I gave a talk at yapc europe (http://act.yapc.eu/ye2012/talk/4190),
temporary url of slides is:
http://infodoc.u-strasbg.fr/~mc/reveal.js/ye.html.

HTH waiting for a real announcement.
regards
-- 
Marc Chantreux
Direction Informatique
http://unistra.fr


Re: MARC::MIR

2012-08-24 Thread Marc Chantreux
Hello Robin, 

I'm just back from YAPC::Eu and find your mail. As we said that we would
use the perl4lib mailing list for futher discutions on MARC::MIR, i Cc
the answer.

On Thu, Aug 23, 2012 at 12:04:50PM +0200, Robin Sheat wrote:
 I'm wondering where the most up-to-date code for MARC::MIR is. I had a
 look on github, but couldn't see the template stuff that you mentioned
 (but I haven't looked closely - it's lunchtime now.)

https://metacpan.org/source/MARCC/marc-mir-template-0.0/
https://github.com/eiro/p5-marc-mir-template

I just realized there is no documentation:

https://github.com/eiro/p5-marc-mir-template/blob/master/t/00_test.t

is the best doc. 

I also realised there are uncommited stuff on my disk: i'll push it
tomorrow.

Johann, i'll see also the biblo ontology. Maybe we can convince some
librarians to work on the template ? if needed: i can provide a web GUI to
edit MIR Templates.

marc


Re: who's the perl4lib webmaster ?

2012-07-13 Thread Marc Chantreux

Le 13/07/2012 04:59, Ed Summers a écrit :

Thanks Ask - I think you still do host it :-)

cool!

https://github.com/perlorg/perlweb/pull/48

is a start! let's modernize this page 

(have a wiki would be easier actually)

regards
marc


WIP stuff about MARC manipulation

2010-11-11 Thread Marc Chantreux
hello again,

As i wrote my last mail, guys at biblibre really would like to write
tools to ease the programmer in charge of migration process.
MARC::Template is something we're very happy about but we have more
tools that aren't as polished. But we already successfully use them so
we share them with you as they are. 

https://github.com/eiro/p5-ISO2709 is a regex driven ISO2709 parser. The
goal of this library is not performance but flexibility: we where able
to read very baddly formatted ISO2709 with just by changing some few
things in the regex. I never published it for now because i didn't find
time to make the things configurable instead of hackable: that's a proof
of concept but i'm very happy about the results.

There is https://github.com/eiro/p5-MARC-Data which is a first step to have a
very simple way to deal with CIB using Moose metaprogramming and serialization
definition. for example, UNIMARC Biblio 100$a definition is: 

( [qw( entered   8 Str )
  , POSIX::strftime('%Y%m%d',localtime )] # 0-7Date Entered on File 
(Mandatory)
, [qw( publication_type  1 Str u   )] # 8  Type of Publication Date
, [qw( publication1  4 )] # 9-12   Publication Date 1
, [qw( publication2  4 )] # 13-16  Publication Date 2
, [qw( audience  3 Str u   )] # 17-19  Target Audience Code
, [qw( government1 Str u   )] # 20 Government Publication Code
, [qw( modified  1 Str 0   )] # 21 Modified Record Code
, [qw( language  3 Str fre )] # 22-24  Language of Cataloguing 
(Mandatory)
, [qw( transliteration   1 Str y   )] # 25 Transliteration Code
, [qw( charset1  4 Str 5050)] # 26-29  Character Set (Mandatory)
, [qw( charset2  4 )] # 30-33  Additional Character Set
, [qw( title_script  2 Str ba  )] # 34-35  Script of Title
) 

Another idea is MARC::Mapper
http://www.tinybox.net/2009/08/06/a-marc-mapper-in-few-lines-of-perl/
but i really think it could be written using MARC::Template syntaxes.

regards
-- 
Marc Chantreux
BibLibre, expert en logiciels libres pour l'info-doc
http://biblibre.com


Re: A library agnostic datastructure for MARC ?

2010-11-11 Thread Marc Chantreux
hi galen,

On Thu, Nov 11, 2010 at 07:40:35PM -0500, Galen Charlton wrote:
 I don't see how a structure like this gets you anywhere closer to an
 abstraction layer that would permit somebody to code in terms of
 semantic concepts like title and author instead of MARC tags,

It doesn't: the fact is we're working on libraries to do that (see
MARC::Mapper from my other mail) and i really would like to interact
both with

- MARC::Record: it's heavily used in the koha ILS
- the Frederic Demians's MARC lib which is much more modern
- what we at biblibre call a SimpleRecord which is just a hash of non
  ordered fields

i don't want to write a web of gateways for all those structures and
those to come so i propose to have a common way to share between all of
our works.

For example: MARC::Template and ISO2709 have internal code to build
MARC::Records and SimpleRecords so they depends on MARC::Record. I
really would like to drop this code for something more generic and
simple.

 you're looking for a serialization or data structure that is more

i'm not talking about serialization at all, i'm talking about sharing
data between marc related tools as PSGI does for the web thing. sorry if
i wasn't clear.

regards

-- 
Marc Chantreux
BibLibre, expert en logiciels libres pour l'info-doc
http://biblibre.com