简体   繁体   English

从没有CPAN :: Mini的本地镜像安装CPAN模块

[英]Install CPAN modules from a local mirror without CPAN::Mini

In some computers in my company, only IE have access to Internet. 在我公司的某些计算机中,只有IE可以访问Internet。 So I would like to know if I can have a local copy of some CPAN modules in a local mirror. 因此,我想知道是否可以在本地镜像中具有某些CPAN模块的本地副本。 I heard of the CPAN::Mini module that can synchronize the local mirror with a public one. 我听说过CPAN::Mini模块,它可以将本地镜像与公共镜像同步。

How can I manually download the modules I want in my mirror with IE and configure cpan to look locally for the modules? 如何使用IE在我的镜像中手动下载所需的模块,并将cpan配置为在本地查找模块?

EDIT 编辑

I cannot use CPAN::Mini or other similar tools because only IE has access to internet. 我无法使用CPAN :: Mini或其他类似工具,因为只有IE才能访问互联网。 I need to replicate my mirror through IE first. 我首先需要通过IE复制镜像。

If you just want a partial mirror of CPAN, you can do this easily with OrePAN2 . 如果只需要CPAN的局部镜像,则可以使用OrePAN2轻松实现

orepan2-inject --simple Module::Name /path/to/darkpan/

This will also generate on 02packages file for you, which CPAN clients can read. 这还将为您生成02packages文件,CPAN客户端可以读取该文件。

orepan2-inject --simple Carton darkpan
Wrote 1 from Carton
[INFO] Could not find useful meta from 'darkpan/authors/id/D/DU/DUMMY/Carton-    v1.0.12.tar.gz'
[INFO] Scanning for provided modules...
/tmp/foo ∙ tree darkpan/
darkpan/
├── authors
│   └── id
│       └── D
│           └── DU
│               └── DUMMY
│                   └── Carton-v1.0.12.tar.gz
├── modules
│   └── 02packages.details.txt.gz
└── orepan2-cache.json

CPAN::Mini uses LWP to fetch files. CPAN :: Mini使用LWP来获取文件。 The meat of the problem is this simple line: 问题的实质是这条简单的线:

my $res = $self->{__lwp}->mirror($remote_uri, $local_file);

That's just the mirror from LWP::UserAgent . 那只是LWP :: UserAgentmirror Come up with a replacement method that uses IE instead, perhaps using Win32::OLE to drive IE and there you are. 提出使用IE代替的替代方法,也许使用Win32 :: OLE来驱动IE,然后就可以了。 CPAN::Mini could use a bit of dependency injection for the thing that fetches files. CPAN :: Mini可以为获取文件使用一些依赖注入。

There used to be a tool named Win32::Mechanize::IE, but it stopped working with the new IE8 security module . 曾经有一个名为Win32 :: Mechanize :: IE的工具,但是它停止使用新的IE8安全模块

Alternately, I would explore ways to make the internal LWP object look like it's IE. 或者,我将探索使内部LWP对象看起来像IE的方法。 I don't know the details of your proxy or network, but I bet there are some magic headers or settings that you could fake from LWP. 我不知道您的代理或网络的详细信息,但是我敢打赌,您可以从LWP中伪造一些魔术头或设置。 See, for instance, HTTPS Proxy and LWP::UserAgent . 例如,参见HTTPS Proxy和LWP :: UserAgent I have to believe that more than IE gets to access the internet. 我必须相信,不仅仅是IE可以访问互联网。

As a last ditch effort, take some beer to the Windows admin with all the power. 作为最后的努力,尽一切力量将啤酒带到Windows管理员。 Make a friend and save some coding. 交个朋友并保存一些编码。 :) :)


I might have done the dependency injection work had I not discovered that the source has been perverted with Dist::Zilla nonsense. 如果没有发现源已被Dist :: Zilla废话弄乱了,我可能已经完成了依赖项注入工作。 I've never particularly cared what tools people use as long as they don't force me to use the same ones and that the literal source code doesn't depend on requirements of an external tool. 我从不特别在乎人们使用什么工具,只要他们不强迫我使用相同的工具,并且文字源代码不依赖于外部工具的要求即可。

It's getting to the point that people are throwing away participation for a seat at the cool kids table by making the barrier to collaboration so high. 人们意识到,通过使协作的障碍变得如此之高,人们正在放弃参加酷炫儿童餐桌的席位。 I only make a stink of that because I don't think people realize the trade off. 我只是对此感到make异,因为我认为人们没有意识到这一折衷。 No one tells you when they decide to not help. 当他们决定不帮助时,没有人告诉您。 They simply don't help and you don't realize you gave up all the hours they could have contributed. 他们只是无济于事,您不会意识到您已经放弃了他们本可以付出的所有时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM