Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Best approach for temporarily swapping out a single perl module for a different version?

by choroba (Archbishop)
on Jun 25, 2020 at 14:41 UTC ( #11118534=note: print w/replies, xml ) Need Help??


in reply to Best approach for temporarily swapping out a single perl module for a different version?

What I usually do in such a situation: I go to the ~/perl5 directory (created by local::lib), run
git init git add . git commit -m start
(if it's not already there, then I don't need to run anything).

Then I create a branch for experiments, e.g.

git checkout -b module-3.4
and actually upgrade the module.

Installing several different versions in different branches is possible, you can then use git to switch between them and compare the behaviour of your app or tests.

After the experiment is over, I either stay with the new version

git checkout master git merge module-3.4
or I return to master and delete the branch.

I described the process when I first used it in my blog.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re: Best approach for temporarily swapping out a single perl module for a different version?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Best approach for temporarily swapping out a single perl module for a different version?
by nysus (Vicar) on Jun 25, 2020 at 15:25 UTC

    Let me see if I got this straight because I'm not familiar with local::lib and I'm using perlbrew which created ~/perl5 for me.

    So basically you create a giant git repo for all the modules located in the root of ~/perl5? And then when you want to upgrade a single module, you create a new branch and modify that single module? Is that right?

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      Exactly. Adding a change can take a second or two, switching the branches is blazing fast.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        Very cool. One more question, though. I'm not very adept with git and trying to wrap my head around how I might incorporate your solution into my current setup.

        So I have a ~/git_repos directory for cloned modules from github where I keep perl modules that I contribute patches to. These repos track the upstream module and my own forked copy of the module. I also have a ~/perl/modules directory where I keep all my locally developed modules. These modules get installed to my local machine and they also get pushed out to cpan and github from this directory. This is where I modify my $PERL5LIB as appropriate to load the module from either ~/git_repos or ~/perl/modules.

        Do you have any suggestions for how I might be able manage these repos connected to github and still use your solution?

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
        $nysus = $PM . ' ' . $MCF;
        Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2020-12-05 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?