kasei / attean

A Perl Semantic Web Framework
19 stars 10 forks source link

Wishlist: Ability to (more easily) run reduced Attean functionality in a pure Perl environment #162

Open zmughal opened 1 year ago

zmughal commented 1 year ago

I have an experiment where I would like to have a fatpacked script that uses Attean for processing Turtle files. This means that the code would have to allow for a path that does not need to load XS.

I did a small experiment using the SYNOPSIS code and it works after skipping the following modules:

So when I run:

PERL_DATETIME_PP=1 \
PERL_SUB_IDENTIFY_PP=1 \
B_HOOKS_ENDOFSCOPE_IMPLEMENTATION=PP \
    perl \
        -MTest::NoXS=:xs_core_or_dual \
        -Mlib::noop=Clone,Algorithm::Combinatorics \
        -MDevel::Hide=Class::XSAccessor \
        ./synopsis.pl  < test.ttl

it works!!

I don't know if this requires a change to the code as it seems to work with the above, but perhaps it could be a more explicitly supported scenario, i.e., with documentation and a test case, as long as it is not too much of a maintenance burden? I don't expect that those modules be replaced with pure Perl equivalents, just that there be a code path that avoids loading them that still allows for some minimal functionality.

kasei commented 1 year ago

Hey @zmughal. Sorry for the late response. I agree that this would be really nice to have.

It looks like Algorithm::Combinatorics might have a pure-perl equivalent in Math::Combinatorics. I'll investigate whether changing to that would be easy.

However, HTTP::Headers is used by both LWP and HTTP::Negotiate, both of which are use in relatively core functionality:

I don't think I can remove this code, but I will look into whether it could be disabled if you want to opt out of that functionality via an environment variable or something.