cpan

How do I set up a local CPAN mirror?

心已入冬 提交于 2019-11-28 07:48:10
What do I need to set up and maintain a local CPAN mirror? What scripts and best practices should I be aware of? This could be useful: http://www.cpan.org/misc/cpan-faq.html#How_mirror_CPAN CPAN::Mini is the way to go. Once you've mirrored CPAN locally, you'll want to set your mirror URL in CPAN.pm or CPANPLUS to the local directory using a "file:" URL like this: file:///path/to/my/cpan/mirror If you'd like your mirror to have copies of development versions of CPAN distribution, you can use CPAN::Mini::Devel . Update: The "What do I need to mirror CPAN?" FAQ given in another answer is for

What is the easiest way to do XPath querying of XML data in Perl?

戏子无情 提交于 2019-11-28 04:52:05
问题 I am looking for the simplest way possible to quickly retrieve data from an XML structure using XPath queries in Perl. The following code structure explains what I'd like to achieve: my $xml_data = "<foo><elementName>data_to_retrieve</elementName></foo>"; my $xpath_query = "//elementName"; my $result_of_query = ... what goes here? ... die unless ($result_of_query eq 'data_to_retrieve'); Obviously TIMTOWTDI applies, but what would be the easiest way to do it? 回答1: XML::LibXML is not easier,

automatically install missing modules from CPAN

你说的曾经没有我的故事 提交于 2019-11-28 02:06:37
If I want to distribute a Perl script, what is the best way to painlessly install any required modules that are missing on the user's system? Extra credit if there is a way to even install/upgrade Perl itself if it is missing or "too old". Auto-installing software is the best way to make both end users and sysadmins very angry with you. Forget about this approach. You can simply ship all your dependencies with your application distro, the inc directory is customary. Usually this ends with CPAN-like package creation. So, when you need to install all dependencies you type make installdeps See

Which Perl module would you recommend for JSON manipulation?

半世苍凉 提交于 2019-11-28 00:52:18
As usual, I'm happy to deal with CPAN because it got all we need. As usual, I'm lost because there is plenty of stuff. I can find the core JSON one by myself, and feel enthusiastic by a JSON::Tiny other. My needs are very simple (parsing stuffs from the Open Library API ) and, maybe someday, expose our own data. Is there any other modules that you like for this task? Miguel Prz JSON module works like a champ, but if you need a faster parser, use this one: JSON::XS , which requires a native compilation. Note that JSON version 2.0 and above is merely a front end for JSON::XS (if installed) or

Which package from CPAN should I use to send mail?

给你一囗甜甜゛ 提交于 2019-11-28 00:38:05
问题 Which package from CPAN should I use to send mail ? Sometime the timtowtdi approach is very tiring. For me, especially when it comes to package selection. So all I want is to send email, potentially HTML emails. Between Mail-Sendmail, Mail-Sender, NET-SMTP (by the way - not available in PPM), Mail-SendEasy, and the 80 or so other packages that have 'Mail' in their package name - which one should I choose? And while in this subject, what is your general apprach to choose the "canonical"

How can I find the version of an installed Perl module?

三世轮回 提交于 2019-11-27 17:29:52
How do you find the version of an installed Perl module? This is in an answer down at the bottom, but I figure it important enough to live up here. With these suggestions, I create a function in my .bashrc function perlmodver { perl -M$1 -e 'print "Version " . $ARGV[0]->VERSION . " of " . $ARGV[0] . \ " is installed.\n"' $1 } Why are you trying to get the version of the module? Do you need this from within a program, do you just need the number to pass to another operation, or are you just trying to find out what you have? I have this built into the cpan (which comes with perl) with the -D

Installing modules using Strawberry Perl

故事扮演 提交于 2019-11-27 17:29:42
Until now I used ActiveState 's ActivePerl , and used the ppm for installing modules. Last week I moved to Strawberry Perl , but I don't know how I should install modules using Strawberry Perl. What is some information on how module installation is done using Strawberry Perl or is there some link on how to install new modules? Alexandr Ciornii You can still use ppm , but it is not recommended. Run CPAN client from the Strawberry Perl or Strawberry Perl (64-bit) , sub folder Tools , entry in the Start menu. Type install Module::Name there. As Alexandr says, you can use the CPAN client via the

How do I get a list of installed CPAN modules?

五迷三道 提交于 2019-11-27 17:00:59
Aside from trying perldoc <module name> individually for any CPAN module that takes my fancy or going through the file system and looking at the directories I have no idea what modules we have installed. What's the easiest way to just get a big list of every CPAN module installed? From the command line or otherwise. pjf This is answered in the Perl FAQ, the answer which can be quickly found with perldoc -q installed . In short, it comes down to using ExtUtils::Installed or using File::Find , variants of both of which have been covered previously in this thread. You can also find the FAQ entry

Uninstall all perl modules installed by cpan

十年热恋 提交于 2019-11-27 14:41:39
问题 Yesterday I wanted to test some software and in the documentation it said, to install I just needed to type cpan -i Software I never used cpan, I just know that it is the perl package manager. (Is it..?) However, it turned out that I needed loads of dependencies, and stupid as I am, I just installed all of them. (First, I had to set up cpan which asked me lots of questions) Long story short, I just want to remove all of it again. I googled a bit, and it seems like cpan does not have an

How can I determine CPAN dependencies before I deploy a Perl project?

梦想与她 提交于 2019-11-27 13:55:25
问题 Does anyone have any suggestions for a good approach to finding all the CPAN dependencies that might have arisen in a bespoke development project. As tends to be the case your local development environment rarely matches your live one and as you build more and more projects you tend to build up a local library of installed modules. These then lead to you not necessarily noticing that your latest project has a requirement on a non-core module. As there is generally a requirement to package the