Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Giving Credit for Perl Module

I wrote a script for my company and I am using some libraries I obtained from CPAN. My manager wanted me to consolidate and remove the extra libraries - which is a little funny because I include them for the script to work.

A few notes:

  • I do not have root access on this server nor can I request access
  • To use CPAN modules w/o root I have them installed to my user directory
  • To allow other users to run my scripts I usually include a folder called 'libs' and inside of my script's directory and in the script I have: use 'libs'; at the top before I use my CPAN modules.

The only solution I have right now is to literally put the contents of the perl modules inside of my perl script. However I want to give credit where it is due and also not get in trouble for including opensource code w/o proper credit to its authors and organizations.

Therefore, how should I go about this? I am not trying to get away with anything.. I honestly want to go about doing this the right way.

All three modules say "licensed under the same terms as Perl itself" but I feel like it shouldn't be this easy.

I would also like to explore any other ideas too!

The modules are:

  • Text::Table
  • Text::Aligner
  • Term::ANSIColor
like image 383
rusty Avatar asked Jan 12 '15 19:01

rusty


3 Answers

Is using PAR Packager an option for you? That would generate a standalone executable.

like image 193
dsolimano Avatar answered Nov 15 '22 09:11

dsolimano


If the modules are pure Perl modules, you may be able to simply append the code (including those package statements) into your program. I'd also include the POD which would include the copyright statements and the names of the authors too. That should satisfy the Artistic License Requirement (but may not satisfy GNU licensing requirements).

Another possibility is to use Perlbrew which will allow you to install a user version of Perl on the system. This way, you can install CPAN modules without needing Administrative permission, and you can tell other users to use Perlbrew too.

I use it because I can install and switch between various versions of Perl which allows me to test my Perl scripts in various versions of Perl. I've also used it on our servers where I need a newer version of Perl or modules that weren't included in the standard release.

You need to get your IT approval before installing Perlbrew, but a lot of times they're relieved that they no longer have to be bothered with maintaining and installing CPAN modules for your use.

like image 27
David W. Avatar answered Nov 15 '22 09:11

David W.


Interesting question & perspective. I don't understand what is against using libraries or modules, but I'll let your manager do the thinking ;-)

Regarding copyright, you're best to consult a lawyer if you want to be sure, but as far as I understand it, you can combine the work of others provided you retain the copyright notices. The combined work may not be covered by copyleft, so you may be able to use it commercially (i.e., distribute it without disclosing the source). But do check with a lawyer.

But, since you said you wanted to explore other ideas, App::Staticperl may be a solution? I do not have experience with it, but I tried it with a simple example and got a working executable.

App::Staticperl builds a stand-alone executable from the Perl interpreter with embedded CPAN modules. The steps I followed were roughly (you'll need to adapt, because obviously I couldn't test with your script):

  1. latest version of App::Staticperl is 1.43: https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/App-Staticperl-1.43.tar.gz
  2. either install the module via CPAN, or simply extract bin/staticperl from the tar - it's a standalone script
  3. edit staticperl to change EMAIL and CPAN (optional, but you may want to change the CPAN mirror)
  4. ./staticperl install downloads and builds Perl; it ended with an error message on my box, but did produce a working Perl
  5. ./staticperl cpan enters an interactive CPAN prompt; install Text::Table, install Term::ANSIColor, and whatever else you need
  6. ./staticperl mkapp my_app --boot path/to/your/script -MText::Table -MText::Aligner -MTerm::ANSIColor
  7. try the app: ./my_app - it will most likely fail with an error message about missing modules; repeat the previous step and include the missing modules in the -M flags

Good luck!

like image 32
Edward Avatar answered Nov 15 '22 10:11

Edward