Giter VIP home page Giter VIP logo

Comments (16)

karenetheridge avatar karenetheridge commented on June 18, 2024

Would it be a problem to add the arch directory to @INC before it exists?

from local-lib.

miyagawa avatar miyagawa commented on June 18, 2024

Not a problem at all for regular perl programs, since non-existent directories will be just skipped.

But the issue here is that local::lib only sets PERL5LIB. Adding an arch directory to @INC is completely up to perl itself.

> mkdir /tmp/perl5
> PERL5LIB=/tmp/perl5 perl -V        
...
  @INC:
    /tmp/perl5
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/darwin-2level
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/5.20.1/darwin-2level
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/5.20.1
    .

> mkdir /tmp/perl5/darwin-2level
> PERL5LIB=/tmp/perl5 perl -V        
...
  @INC:
    /tmp/perl5/darwin-2level
    /tmp/perl5
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/darwin-2level
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/5.20.1/darwin-2level
    /Users/miyagawa/.plenv/versions/5.20.1/lib/perl5/5.20.1
    .

from local-lib.

haarg avatar haarg commented on June 18, 2024

Note that this is only an issue when modules are loaded mid way through a perl process running. I think just creating the directory is reasonable though.

from local-lib.

miyagawa avatar miyagawa commented on June 18, 2024

Correct - cpanm is a very special use case for this because it installs modules in the middle of the same perl process :) And so cpanm has a workaround for it.

from local-lib.

shadowcat-mst avatar shadowcat-mst commented on June 18, 2024

this is why local::lib used to put the arch dir in PERL5LIB explicitly; I think somebody insisted on removing that to "clean things up".

We should either revert the behaviour or create the directory.

from local-lib.

miyagawa avatar miyagawa commented on June 18, 2024

this is why local::lib used to put the arch dir in PERL5LIB explicitly; I think somebody insisted on removing that to "clean things up".

Sounds right. cdd450c fixes RT 67871

We should either revert the behaviour or create the directory.

+1 either would be fine for me.

from local-lib.

karenetheridge avatar karenetheridge commented on June 18, 2024

+1 to either one from me too.

from local-lib.

dolmen avatar dolmen commented on June 18, 2024

As the requestor of RT 67871, I'm in favor of creating the directories.

If creating the directories fails because of filesystem permissions (for example if a readonly local::lib dir is used), just ignore the failure, because CPAN clients will not be more able to write there.

from local-lib.

shadowcat-mst avatar shadowcat-mst commented on June 18, 2024

we used to scaffold a bunch of stuff anyway, mostly so we had somewhere to write .modulebuildrc - but when PERL_MB_OPT came around, we stopped doing that.

the thing is, people can setup a local::lib with intent to -use- it but no expectation that the filesystem will be modified until they ask for it

cpanminus knows it's planning to write though - so maybe we need a --scaffold-directories option to the local::lib import that it can pass to explicitly ask for that?

from local-lib.

karenetheridge avatar karenetheridge commented on June 18, 2024

the thing is, people can setup a local::lib with intent to -use- it but no expectation that the filesystem will be modified until they ask for it

I don't understand -- if I do perl -Mlocal::lib=foo -e1 the foo directory is created. But you're saying the intent is that it should not be?

from local-lib.

shadowcat-mst avatar shadowcat-mst commented on June 18, 2024

if we're creating the 'foo' directory, we might as well create foo/lib/perl5 and foo/lib/perl5/$arch

I'm sort of wondering if we should have a 'create everything' -and- a 'create nothing' mode, but maybe the latter is just 'use lib'

from local-lib.

shadowcat-mst avatar shadowcat-mst commented on June 18, 2024

@miyagawa you mean reverting that commit fixes it?

@dolmen heh, I note you're the one who removed the arch dir in the first place

@haarg thoughts on maybe creating lib/perl5, arch and version dirs (if we're doing version dirs), and maybe bin as well? given we're already creating the root, producing a skeleton tree in there might actually be more DWIM

from local-lib.

haarg avatar haarg commented on June 18, 2024

I think we should create the appropriate directories under the local lib dir. I have some code in progress for this. We already have a --no-create option to prevent creating the local lib directory.

from local-lib.

ribasushi avatar ribasushi commented on June 18, 2024

I think we should create the appropriate directories under the local lib dir.

+1

from local-lib.

miyagawa avatar miyagawa commented on June 18, 2024

if we're creating the 'foo' directory, we might as well create foo/lib/perl5 and foo/lib/perl5/$arch

That's what I meant with the original ticket here, yes.

from local-lib.

miyagawa avatar miyagawa commented on June 18, 2024

Fixed with 2f7bd47 I think.

from local-lib.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.