Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Update module in offline cpan

by Dirk80 (Pilgrim)
on Jul 13, 2022 at 07:51 UTC ( [id://11145464]=note: print w/replies, xml ) Need Help??


in reply to Re: Update module in offline cpan
in thread Update module in offline cpan

I think that this method would be the right one. But I don't get it to run. Let's assume I'm in an offline environment and I have a tar.gz file I want to update my local offline CPAN with.

The tar.gz file could be a change of a module which is NOT available on any remote CPAN mirror. I want to update my local CPAN with the new version of this file changed by myself or got from somewhere else than CPAN. Or it could even be that I want to add a self written package, e.g. My::Package to my local CPAN.

What shall I specify for the remote mirror? I think that $path of $minicpan->mirror_file($path) refers to the remote mirror. Furthermore I have here the problem that I'm in an offline environment in the computer I'm using. So minicpan is unable to contact the remote mirror. My remote mirror has to be also local, so that it can be reached offline.

my $minicpan = CPAN::Mini->new(local => "C:/Strawberry/cpan", remote => "???");

UPDATE1:

I see there is an offline option. I'll try with that now. At least the following code is compiling.

use CPAN::Mini; my $minicpan = CPAN::Mini->new(local => "C:/Strawberry/cpan", offline => 1, remote => "file:://C:/Temp"); $minicpan->mirror_file("My-Package-0.01.tar.gz");

But that code just copies My-Package-0.01.tar.gz to C:/Strawberry/cpan directory. But no other files were updated. But that's clear because on C:/Temp I just put the tar.gz file and no more other files. I think I have to make a real cpan mirror containing my self changed files. And then the mirror_file method should work for me. But then I have the same problem as before. I manually have to change all CPAN specific files like CHECKSUMS, ...

UPDATE2:

I think I know now better what I want. I already have an offline cpan created via CPAN::Mini which just contains files from an official cpan mirror. And now I want to have a second offline cpan archive which contains modules written by myself and bug fixes of cpan modules which are not yet on an official cpan mirror. But what is the best way to build this second cpan offline archive consisting of my own modules if don't want to create all cpan specific files by myself?

UPDATE3:

I investigated a little bit more. I found a module CPAN::Mini::Inject. It seems that this is the functionality I want. I'm off for two weeks now with no access to computers. I'll try then. I'm now unsure whether I should have two cpan offline archives, one for the official modules of cpan and one for my private modules in the My namespace. Or if it would be better to have everything together in one offline cpan. What is your opinion?

Replies are listed 'Best First'.
Re^3: Update module in offline cpan
by ikegami (Patriarch) on Jul 13, 2022 at 18:03 UTC

    Let's assume I'm in an offline environment

    The point of CPAN::Mini is to create a mirror when you are in an *online* environment (to be used in an offline environment).

    I found a module CPAN::Mini::Inject

    Yup, looks like it's exactly what you need. It even provides a command-line utility.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found