perl-module

use lib for paths relative to a module

╄→гoц情女王★ 提交于 2019-12-11 09:06:47
问题 I'm having issues figuring out relative paths for use lib . Here is an example of what I am trying to do: I have a directory call foo , which contains a script named myscript.pl . myscript.pl uses a module named Mod1.pm located in a subdirectory called bar , so at the top of myscript.pl I put the lines: use lib 'bar'; use Mod1; This works fine, until I want Mod1.pm to use another module, foo/bar/asdf/Mod2.pm . If I put a use lib 'asdf' at the top of Mod1.pm this won't work because it searches

Manipulating a PDF file with different rotations and scaling with Perl's PDF::API2

吃可爱长大的小学妹 提交于 2019-12-11 07:14:09
问题 I'm using CAM::PDF to merge several PDF files. This works fine. Now I need to add a stamp on each page using PDF::API2. This works fine for some pages, but not for others. PDF files created with wkhtmltopdf seem to have their coordination system flipped and the scaling is off as well. When running through the pages I add a stamp like this: my $pdf2 = PDF::API2->open_scalar($pdf_data); my $page_count = $pdf2->pages; for my $i ( 1 .. $page_count ) { my $page = $pdf2->openpage($i); my $content =

Unable to install the Crypt-SSLeay module

给你一囗甜甜゛ 提交于 2019-12-11 07:06:13
问题 I'm creating a web application that requires the use of the perl module Crypt-SSLeay. This module has a dependency of needing OpenSSL headers. Since my Linux server has neither I went through these steps to install, but I'm receiving an error that's hard to understand (see below) because of my limited experience. Server Information: Running Oracle Enterprise Linux Linux version 2.6.18-194.11.4.0.1.el5 (mockbuild@ca-build9.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) Steps to

perl: Will Log::Log4perl work in a multi-threaded environment?

做~自己de王妃 提交于 2019-12-11 03:55:01
问题 I'm using logging vai Log::Log4perl in my perl script; I'm wondering if making multiple calls to write to the same log object will cause incorrect / erroneous behavior. I'm using a Appender::File to write out the log in the following manner: $log->info("Launching commands..."); foreach my $param (@params) { push @thread_handles, async { system("$param"); $log->info("$param COMPLETE"); logstatus($?); }; } $_->join() foreach @thread_handles; $log->info("Commands completed..."); 回答1: The Log:

perl compare two file and print the matching lines

橙三吉。 提交于 2019-12-11 03:12:49
问题 I have this script which is compare 2 files and print out the diff result. now I want to change the script instead of print out the diff lines, i want to print the matching lines. and also to count how many time matched every time running the script. would you please any one can give me a suggestion. thanks! #! /usr/local/bin/perl # compare my $f1 = "/opt/test.txt"; my $f2 = "/opt/test1.txt"; my $outfile = "/opt/final_result.txt"; my %results = (); open FILE1, "$f1" or die "Could not open

Perl extension installation - unable to run nmake

假装没事ソ 提交于 2019-12-11 01:55:18
问题 I am trying to install a module using cpan on XAMPP. I am running Windows 7. Immediately after this prompt is given: CPAN.pm: Going to build J/JE/JESSE/HTTP-Server-Simple-0.43.tar.gz It gives the prompt that "The required nmake executable file is not found, and attempts to fetch it. After this, a popup window appears stating the the program "\??\c:\xampp\perl\bin\Nmake15.exe can not run due to incompatibility with 64 bit versions of windows. I downloaded VC++ and copied the make.exe from that

How to create one XML file from multiple XML files in a directory, using Perl

巧了我就是萌 提交于 2019-12-11 00:52:20
问题 Hi every one, Please excuse me if any grammatical mistakes is there. I have multiple xml files in one directory, I need to create multiple XML files into one XML file.example files like this file1:bvr.xml <?xml version="1.0" encoding="UTF-8"?> <specification xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <details> <name>johan</name> <address>Langgt 23</address> ---more info--- </details> </specification> file2:kvr.xml <?xml version="1.0" encoding="UTF-8"?> <specification xmlns:xsi=

installing modules when using perlbrew

风流意气都作罢 提交于 2019-12-10 22:04:27
问题 I am trying to use perlbrew to run a set of perl scripts. When I try installing dependencies for these perl scripts, they are installed into my system's perl version (5.18.X) and not the version I want to use (5.10.1). I have tried several suggestions from other threads on stackoverflow, but to no avail. Here's an example of what happens. I'll do the following: perlbrew use perl-5.10.1 perl -v (returns with perl-5.10.1) cpanm Parallel::ForkManager (returns Paralell::ForkManager is installed)

Perl hashes: how to deal with duplicate keys and get possible pair

☆樱花仙子☆ 提交于 2019-12-10 20:55:58
问题 I have pairs like this (Data sorted to %hash format(I have large data)) G1-G2 G2-G3 D1-D2 D3-D2 G3-D3 G2-D3 Perl script use strict; use warnings; use Data::Dumper; my %hash; $hash{'G1'}='G2'; $hash{'G2'}='G3'; $hash{'D1'}='D2'; $hash{'D3'}='D2'; $hash{'G3'}='D3'; $hash{'G2'}='D3'; print Dumper \%hash; Out put $VAR1 = { 'G1' => 'G2', 'G2' => 'D3', 'D3' => 'D2', 'G3' => 'D3', 'D1' => 'D2' }; Here missing G2-G3 bcz key hash duplicated I need to add duplicates (i can use array but have large data

How can I hook into Perl's use/require so I can throw an exception?

戏子无情 提交于 2019-12-10 17:13:54
问题 If a file is already loaded, is there anyway to hook into the use/require so I can throw an exception? In my upcoming nextgen::blacklist, I'm trying to die if certain modules are used. I'm using the object-hook method as mentioned in perldoc -f require : there are three-like hooks object , array with subref , and subref . The example in this post is the object-hook, you can find my attempt of the sub-ref hook in nextgen::blacklist. The syntax I'm desiring is something like: perl -Mnextgen -E