webservice-solr icon indicating copy to clipboard operation
webservice-solr copied to clipboard

Replace XML::Easy by a more recent module?

Open nicolasfranck opened this issue 3 months ago • 5 comments

The module XML::Easy has not been updated since 2017, and now cannot be compiled anymore on more recent architectures, at least on in an easy way:

e.g. Mac OS X (partly given)

$ cpanm -n XML::Easy
Building XML-Easy
cc -I/Users/njfranck/.plenv/versions/5.40.0/lib/perl5/5.40.0/darwin-2level/CORE '-DVERSION="0.011"' '-DXS_VERSION="0.011"' -c -fno-common -DPERL_DARWIN '-mmacosx-version-min=14.5' -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include '-Wno-error=implicit-function-declaration' -O3 -o lib/XML/Easy.o lib/XML/Easy.c
lib/XML/Easy.xs:9:9: warning: 'PERL_VERSION_GE' macro redefined [-Wmacro-redefined]
    9 | #define PERL_VERSION_GE(r,v,s) \

can this dependency be replaced by something more recent?

nicolasfranck avatar Aug 13 '25 14:08 nicolasfranck

I have no objection to changing it to something else. My only concern is that I wouldn't want something that brought in a ton of dependencies.

petdance avatar Aug 13 '25 14:08 petdance

I also wouldn't mind having communication with the server being in JSON instead of XML.

petdance avatar Aug 13 '25 14:08 petdance

I also wouldn't mind having communication with the server being in JSON instead of XML.

I would too, however keep in mind that the JSON that Solr expects allows for repeated keys (e.g. "add"), and is something you cannot easily do in regular json modules. See https://solr.apache.org/guide/solr/latest/indexing-guide/indexing-with-update-handlers.html#sending-json-update-commands

curl -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/my_collection/update' --data-binary '
{
  "add": {
    "doc": {
      "id": "DOC1",
      "my_field": 2.3,
      "my_multivalued_field": [ "aaa", "bbb" ]   
    }
  },
  "add": {
    "commitWithin": 5000, 
    "overwrite": false,  
    "doc": {
      "f1": "v1", 
      "f1": "v2"
    }
  },
}

nicolasfranck avatar Aug 13 '25 14:08 nicolasfranck

I would too, however keep in mind that the JSON that Solr expects allows for repeated keys (e.g. "add"),

Well so much for that idea. Thanks for the warning.

petdance avatar Aug 13 '25 16:08 petdance

Just on a basic survey of CPAN, I'm thinking XML::Writer might be the way to go. I like the idea of write-only.

petdance avatar Aug 13 '25 18:08 petdance