minun ensimmäinen Perl-ohjelmani!
Ohjelmointikielen alkeiden opiskelu ja toimivan ohjelman kehittäminen ja sovellusalueen oppiminen ja tuntemattoman tietokannan tietokantarakenteen avaus Yhtäaikaa ei tuota laatukoodia :)
Miksi Perl eikä SQL? Ei käsitystä lähdedatasta eikä kohdedatasta. SQL liian formaali prototypointiin. Ei vahvaa SQL- osaamista ja Perliä on jotenkin opittava. Validoinnit ja sanitoinnin kuitenkin tehtävä. Tähän Perl parempi. USEMARCON connection ja muut ulkoiset kytkennät. Tavoite äärimmäiselle nopeudelle! SSD+Perl > SQL
Jälkikäteen vähän kaduttaa Ja ei kaduta Selkeät funktiot kaiken datan tuomiselle järjestelmään, kuten: C4::Members::AddMember () C4::Items::AddItem() … Huolehtivat kaikesta bisneslogiikasta toisin kuin SQL. Näille kivat misc/cronjobs/bulk*.pl - skriptit © Vaara-kirjastot
MMT – Master Migration Tool
*ImportChain
BibliosImportChain
lilcdebt.kir 1001008 20101210 1311 1,000 24541: Varaus: Heikkil<E4>/PO 1291979483 92 1158 1001010 19920415 1251 -0,670 14aiheeton sakko 0 0 0 1001016 20150407 1130 0,500 50541: My<F6>h.(er<E4>p.24.03.2015): Hirsj<E4>rvi, Sirkka: Tu 1428395429 92 1168 1001017 20050401 1312 0,900 35541: My<F6>h.(er<E4>p.29.03.2005): Exodus 1112350359 92 1127 1001017 20070307 122 1,000 50541: Karhuilmoitusmaksu. Karon, Jan : Pappila kesk 1173223373 92 0 See copy.in/copy.out from IngressDB dump for column names. grep, cut, are your friends! Cross referencing column values with many examples can infer even the most cryptic status codes :)
Instructions.pm use utf8; package FinesImportChain::FinesBuilder::Instructions; sub getInstructions { return { #The order of these indexes is critical, since many attributes rely on previously initialized attributes. 'lilcdebt.kir' => [ ['borrowernumber', [0]], #cdcustid ['date', [1,2]], #cddate, cdtime ['amount', [3]], #cdamount ['description', [4]], #cdtext ['accounttype', 'Konversio'],#CONSTANT ], }; } 1;
lib/Fine.pm #setters receive self as $_[0] # the ItemsInjectChain::Reader-object as $_[1] # and the values requested in Instructions.pm, in subsequent indexes like this: # $_[0] = Item -object ($self/this) # $_[1] = ItemsImportChain::ItemsBuilder::Reader - object containing repositories and whatnot # $_[2]->[] = Parameters extracted according to instructions in Instructions.pm sub set_borrowernumber { my $custid = $_[2]->[0]; if ($custid) { if ($custid =~ /^\d+$/) { $_[0]->{borrowernumber} = $custid; } else { $log->warning( "Borrowernumber '$custid' is not a positive digit. Skipping." ); return 'KILL MEE!'; else { #we don't negotiate if there is no borrowerid
TranslationTables cutype_to_borrower_categorycode.pm isil_translation.pm liqlocde_translation.pm material_code_to_itype.pm #select the correct call number location according to the library id our $isilMapPielinen = { 1 => "FI-Nurme", 2 => "FI-Liksa", 3 => "FI-Iloma", }; our $marcFieldToIsilMapPielinen = { "098" => "DEFAULT_ISIL", "056" => "FI-Nurme", "055" => "FI-Iloma", "054" => "FI-Liksa",
Download MMT @ KohaSuomi sftp