perl

How do I dynamically change the Perl module path?

I have two different versions of a Perl module. Currently, the crucial script uses the version of the module specified by an environment variable and the system relied on different tasks being run by different users. The user's environment would determine which version of the Perl module was used. Now I would like to change this to th...

VIM 7.2 Scripting problem with `:perldo` and multiple expressions

Background task To eliminate X-Y problems I'll say what I'm doing: I'm trying to use :perldo in VIM 7.2 to complete two tasks: Clear all trailing whitespace, including (clearing not deleting) lines that only have whitespace s/\s+$//; Remove non-tab whitespace that exists before the first-non space character s/^ (\s*) (?=\S) / s#[^\...

How can I parse space separated STDIN hex strings unpacked in Perl?

I have a Java program that spits out, in space-separated hexadecimal format, 16 bytes of raw packet received over the network. Since I dont want to change that code, I am piping the result to a Perl script that, theoretically, can simply unpack this from STDIN into recognizable variables. The following is a sample of the line input to my...

In Perl, is it better to use a module than to require a file?

Another question got me thinking about different methods of code reuse: use vs. require vs. do I see a lot of posts here where the question centers around the use of require to load and execute code. This seems to me to be an obvious bad practice, but I haven't found any good resources on the issue that I can point people to. perlfaq8...

Is there a vim plugin that makes Moose attributes show up in Tag_List?

I am editing packages that use Moose, and I was wondering if there were a plugin for making Moose attributes show up in the Tag List. For example, in the following code, the attribute options does not show up in Tag_List, but print_out_site does: use Moose; use MooseX::AttributeHelpers; ... has 'options' => ( metaclass => 'Collec...

Using Perl's readline , <> function with TCP socket and Signals

I'm using Perl 5.8.8 and trying to determine if Perl automatically and consistently restarts the readline function ( better known as <> ) if it's interrupted by a signal. I want to safely read newline '\n' terminated strings from a TCP socket using readline. In the section Deferred Signals (Safe Signals) it says: Restartable syst...

How can I pass a parameter to the wanted function when using Perl's File::Find?

Possible Duplicate: How do I pass parameters to the File::Find subroutine that processes each file? One can use Perl's File::Find module like this: find(\&wanted, @directories); How can we add a parameter to the wanted function? for example i want to traverse the files in /tmp extracting some information from each file ...

Is there a module which gives me an output of two colums ( or more ) on STDOUT?

Hello, is there a module which gives me an output of two columns ( or more ) on STDOUT? #!/usr/bin/env perl use warnings; use strict; printf "%0.3d\n", $_ for 1 .. 100; I'd like to have 1-50 in the first column and 51-100 in the second. ...

How do I create a Unicode directory on Windows using Perl?

I struggle to create directory names containing Unicode. I am on Windows XP and Perl Camelbox 5.10.0. Up until now I used to use File::Path qw ( make_path ) to create directories - which worked fine until the first cyrillic directory appeared. For files Win32API::File qw ( CreateFileW ) works fine if the file name is UTF-16LE encoded. ...

Suppressing "Day too big" warning in Perl LWP::UserAgent

I have a fairly simple perl script with uses the LWP::UserAgent module to follow URLs through redirection to find the final destination URL which it then stores in our MySQL database. The problem is that from time to time the script reports warnings that look like this: Day too big - 25592 > 24855 Sec too small - 25592 < 74752 Sec too ...

Why can't mysqldumpslow.pl find any Perl modules on Windows?

I'm trying to parse a MYSQL slow query log from the command line. Upon entering this: set PATH=G:\xampp\perl\bin\;%PATH% cd /d G:\xampp\mysql\scripts perl mysqldumpslow.pl -s c -t 10 The shell returns an error can't locate strict.pm in @INC (@INC contains: .) at mysqldumpslow.pl at line 8. BEGIN failed In the perl directory in xampp...

gsh - Global Shell: Where do you put the shared keys, password?

I'm trying to use the gsh command on ubuntu to do some embarrassingly parallel stuff. I've made an /etc/ghosts file containing all the IP addresses for the hosts, and each host has an account that I created just for "cluster" purposes. However, when I try a command such as, $ gsh -l cluster ok 'echo $host' I get in return two errors...

Implement Date Time Picker functionality with MaskedTextBox. Validation done with RegEx

I am trying to create a Custom control specifically for my application which would be using maskedTextBox to restrict input data entered. Now i want to implement this in C#. class CustomDateMask:System.Windows.Forms.MaskedTextBox this.Mask = "00/00/2\000"; // For year 2000 and above, date format is "dd/mm/yyyy" this.ValidatingType = ...

Can a value be uninitialized, but still defined, in Perl?

Running ActiveState Perl 5.10.1 on win32. How is it that this code: die(defined($r->unparsed_uri =~ '/(logout.pl)?$')); ...dies with 1, whereas changing the same line to say this: die($r->unparsed_uri =~ '/(logout.pl)?$'); ...dies with Use of uninitialized value in die? How is it defined yet uninitialized? I thought uninitialize...

How do I access a constant in Perl whose name is contained in a variable?

I have a set of constants declared in Perl: use constant C1 => 111; use constant C2 => 222; .. use constant C9 => 999; my $which_constant = "C2"; How do I construct a Perl expression which, based on $which_constant, derives the value of a constant named with the value of this variable - e.g. "222". Please note that I c...

Prevent vim :make from changing the current working directory?

Synopsis: When calling vim's make command, it changes the current working directory (cwd) to the directory of the current file. It then runs the makeprg from there. I want to prevent the make command from changing the cwd, and instead call the makeprg from the directory of the parent vim instance Example: I have the following standa...

Which FastCGI server mode should I choose under Apache?

I am new to FastCGI and looking to use this platform to speed up my existing vanilla CGI (perl) programs. However in reading the FastCGI/Apache FAQ, it appears I can setup my scripts (once converted to use separate initialization/request sections) in the Apache config as one of the following: 1) dynamic 2) static "inside the scope of ...

Integrating Python or Perl with PHP

I'm going to help my friend in a improve of his phpBB board, but I want to make somethings there in Python or Perl. But it's possible to integrate these languages with PHP? ...

using files other perl files in another perl file

Possible Duplicate: How do I include functions from another file in my Perl script? I have a perl file suppose a.pl and I want to use a function from perl file b.pl. How do i do it ...

How do I design unit tests for multiple Perl modules in the same distribution?

I have been developing an internal framework which is designed with bunch of Perl modules. All these modules are dependent on a single module that exposes some Win32 functionality. For e.g. A, B, C, D, etc modules all depend on a single module Z. So all these modules will import by "use MyFramework::Z". All these modules A,B,C etc can be...