简体   繁体   中英

How to use CPAN modules without access to CPAN?

I am greatly disappointed every time I am forced to retrieve a module from CPAN. In most environments I work in, internet access is severely restricted or completely denied. All compilers have been removed during the OS hardening process. And all digital storage media is scanned by a security team before entering or exiting the site. Mind you, I understand security, and all of this is OK with me, but...

What is the recommended or best practice for accessing code only CPAN modules provide.

If I only need a snippet, a function, or a single string of functionality a module gives me, how can I extract "just what I need/want" without installing an entire module? Keeping in mind that I may be literally printing out, writing down, and typing in, to transfer the data from an off-site location with internet access.

When you can't access CPAN - how you want use it? So, you can either:

  • when have internet access - you can install modules
  • if havent, you can bring an minicpan on USB stick or soo
  • if this is not possible because security policy, you can only use eg you mobile phone to show source on CPAN and retype the needed parts manually
  • if neither is possible - you can at home print the source code on your tshirt and retype it in the work :)
  • or, simply must programm all things yourself - by learning at home
  • or, find the better job :)

EDIT: More serious approach

First, it is strange to have an company who developing with perl, but doesn't allow use CPAN. Of course, I understand than direct access to a tons of unscanned sw is not acceptable for many companies, but in this case here should be exists some "company policies" - how to allow access.

Here are several questions:

  • the hardening is at technical level only (firewalls etc) - so you can bring eg USB stick, CD or any other medium inside, or
  • policy level - the policy does not allow using any external source

If it is at policy level - IMHO, you're out of luck. Simply when it is NOT ALLOWED using any external source - you can use really only the "print & retype" method.

Here is some possibilities:

establish an company-wide local CPAN repository

Create an local CPAN ( minicpan ) server with "trusted" modules. This repository can function as repository for locally developed modules too. In this case must exists some "auditing authority" (policies & procedures) how to get modules into the local repo. IMHO, this can be the most useful way - when the company using perl on regular basis.

Of course, mixing system-wide (default perl modules) with CPAN modules not the best idea. Therefore is possible to setup:

local::lib or build-prefix

local::lib - create and use a local lib/ for perl modules with PERL5LIB. Google for perl "local::lib" or something similar. Also read some other SQ questions:

Using local::lib is nice solution, because doesn't break system-wide perl modules. Of course, again - you will need some "auditing process" how to get modules inside .

perlbrew

Using your own built perl - perlbrew - is more general solution if the system hasn't installed perl. You don't need root access for building your own perl. Of course, here is still some problems (besides the auditing), eg the "missing compiler problem".

virtual machine

You can try setup an virtual machine for development (or isolated physical machine) with full CPAN access and develop here. When you finish the development, you can forward your work with all required modules to "auditing process".

other

If you need only extract an function or a modules from the CPAN modules, do it on external machine. Extracting a function or some part is not a technical problem (when you know perl) it is more an license problem - using a part of modules in your work - you need cite the author.

For this you need fetch all needed functions - can find interesting this discussion . Google for "perl functions dependencies" or something similar, or:

Maybe, you will find this discussion interesting too...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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