[Koha-bugs] [Bug 12477] We need better ways to manage MARC Frameworks

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jul 23 06:36:31 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12477

--- Comment #12 from David Cook <dcook at prosentient.com.au> ---
As for using DBIx::Class, it's literally this simple:

<code>

use Koha::Database;
use XML::Simple;

my $schema = Koha::Database->new()->schema();
my $SimpleXML = new XML::Simple;

my $field_file = "../marc21_tag.xml";
my $canonical_field_structure = '';

if ( -e $field_file){
    my $canonical_field_structure = $SimpleXML->XMLin($field_file, KeyAttr =>
[]);
    foreach my $structure
(@{$canonical_field_structure->{marc_tag_structure}}){
        $schema->resultset("MarcTagStructure")->find_or_create($structure);
    }
}

</code>

Of course, this is just an example. I'd prefer to use XML::LibXML rather than
XML::Simple (especially as XML::Simple itself states that new code should avoid
using XML::Simple), and set up the logical structure a bit differently, but
yeah...that's it.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list