Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zmughal opened this issue Aug 8, 2023 · 1 comment

Comments

@zmughal
Copy link
Contributor

zmughal commented Aug 8, 2023

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:

  • LWP::UserAgent (because it uses HTTP::Headers which uses Clone which is XS)
  • Algorithm::Combinatorics (is XS itself)

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
Copy link
Owner

kasei commented Oct 8, 2023

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:

  • LWP for supporting loading RDF for FROM clauses and for implementing SERVICE
  • HTTP::Negotiate for Attean->negotiate_serializer which isn't critical for query evaluation, but has been part of the public API since 2014)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants