perl

Looking for a good TTY pager output option for Perl

I'm looking to write an interactive terminal-based app in Perl and I need a good Pager module. This will likely be a Linux-only app, but I'd like a recommendation for an OS-agnostic module, if it exists, so I can use it for other projects. I'd like it to be less-like in terms of the key-bindings, able to detect the # of rows of the term...

How do I escape an apostrophe in my XPath text query with Perl and Selenium?

I have an XPath query which needs to match some text in a span attribute, as follows: my $perl_query = qq(span[text\(\)='It's a problem']); $sel->click_ok($perl_query); Where the text has no apostrophe there is no problem. I've tried the following instead of 'It's a problem': 'It\'s a problem' 'It&apos\;s a problem' 'It\${apos}s a ...

Perl - Getting an error with Net/SSLeay.pm - I am trying to POST XML via HTTPS web service

I am trying to use Net/SSLeay.pm in Perl, code says use Net::SSLeay Error message says the following - Can't locate Net/SSLeay.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at test.pl line 7. BEGIN failed--compilation aborted at test.pl line 7. I installed SSLeay.pm via Perl Package Manager and verified it - Crypt-SSLea...

Perl Map Function

I'm new to the map and grep functions and I'm trying to make an existing script more concise. I can "grep" the @tracknames successfully but I'm having a problem with "map". I want @trackartist to return true if two consecutive "--" are found in a line and take the value of $1, otherwise false, but it returns the whole line if the upper ...

use perl script on remote servers and bring back output to local terminal or screen

I have the following perl script that works locally given the input parameters. I need the script to access remote servers for the same information, given that I've already setup the ssh keys successfully. The path for the logfiles on the remote servers are identical to local. Configuration for remote servers are identical. I just need t...

Perl merging 2 csv files line by line with a primary key

Edit: solution added. Hi, I currently have some working albeit slow code. It merges 2 CSV files line by line using a primary key. For example, if file 1 has the line: "one,two,,four,42" and file 2 has this line; "one,,three,,42" where in 0 indexed $position = 4 has the primary key = 42; then the sub: merge_file($file1,$file2,$ou...

Perl Parallel::ForkManager with DBI database handlers

Hi all, im interested in performing multiple database actions in parallel. I have played with Perl Parallel::ForkManager but not used it with any databases yet. I have read that database connectivity is not supported very well with this. Does anyone have experience with this? As an example i would probably be spawning a system call(whic...

Does this violate the 'leftmost longest' principle?

I am trying to write a regex to recognize a single line of text, with underscore ( _ ) recognized as a line continuation character. For example, "foo_\nbar" should be considered a single line, because the "foo" ends in an underscore. I am trying: $txt = "foo_\nbar"; print "$&\n" if $txt =~ /.*(_\n.*)*/; However, this prints only: f...

How do I stop a process running using Perl?

I want to write a Perl code that ends the process of another program of mine, running on Linux. For example, I execute xxy.py and a process is opened for it. I would like to use Perl to close the process of xxy.py. What do I need to do? ...

Catalyst::View::JSON and jqGrid data format question

Hi, I'm using Catalyst::View::JSON and Catalyst::TraitFor::Controller::jQuery::jqGrid to retrieve JSON data to front page. Below is the code concerned (copy much partially from Catalyst::TraitFor::Controller::jQuery::jqGrid example): package UW::Controller::Site; use utf8; use Moose; use namespace::autoclean; BEGIN {extends 'C...

Mysql query parameter issue in Perl

Got a little problem in my code, the query works fine if I manually put values in. But failed if I use my variable. The code shows below my $get_meter_id = $dbh->prepare("SELECT * from t_readings where meter_serial = '21001652' AND ..."); $get_meter_id->execute() or die "Couldn't execute statement: ".$get_meter_id->errstr; my $meter_reg...

How are arrays implemented in Perl?

The Perl array is an abstract data type. What's the internal mechanism for the Perl array? Is it implemented with dynamic array or linked list? Since the array elements have random access, I would assume a dynamic array of pointers, or references to scalars make sense. However, with shift and unshift operation at the head of array, woul...

How can I check if a file exists on a remote server using Perl?

How can I check if a file exists on a remote server using Perl? Can I do this while using the Perl module Net::FTP? CHECK TO SEE IF FILE EXISTS if (-e $file_check) { print "File Exists!\n"; } else { print "File Doesn't Exist!\n"; } ...

How to search for lines in a file between two timestamps using Perl?

In Perl I am trying to read a log file and will print only the lines that have a timestamp between two specific times. The time format is hh:mm:ss and this is always the third value on each log. For example, I would be searching for lines that would fall between 12:52:33 to 12:59:33 I am new to Perl and have no idea which route to tak...

Creating a hash string => list of lists, what am I doing wrong?

In perl, I'm trying to build up a hash of a list of lists. It looks something like this: my %entries; while(<>) { if(/complicated regex ommitted/) { my @entry = ($2, $3, $4); if(exists $entries{$1}) { push @{$entries{$1}}, @entry; } else { $entries{$1} = @en...

Perl expect - how to control timeout on target machine

Hello, I am a newbie to perl. I am using perl expect module to spawn to a remote system. Execute a set of commands there one after another using the send module(like $exp->send("my command as string goes here\n"). The problem is the commands that I execute take some time for processing . And before all the command finish the remote mach...

git svn rebase resulted in byte order is not compatible error

Following is the error I am getting when I tried 'git svn rebase': Byte order is not compatible at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 380, at /usr/lib/perl5/5.10/Memoize/Storable.pm line 21 The version of perl I am running is: $ perl --version This is perl, v5.10.1 (*) built for i686-cyg...

What performance increases can we expect as the Perl 6 implementations mature?

Each time I have downloaded a new copy of Rakudo Perl 6, I have run the following expression just to get an idea of its current performance: say [+] 1 .. 100000; And the speeds have been increasing, but each time, there is a noticeable delay (several seconds) for the calculation. As a comparison, something like this in Perl 5 (or oth...

Specific Perl Regular Expression Needed

Hi all. Have a perl script that needs to process all files of a certain type from a given directory. The files should be those that end in .jup, and SHOULDN'T contain the word 'TEMP_' in the filename. I.E. It should allow corrected.jup, but not TEMP_corrected.jup. Have tried a look-ahead, but obviously have the pattern incorrect: /(...

More problems with my Perl Tutorial

Thanks to everyone who has helped me get this far. Now my new problem. I'm working with a book that was written in 2003 and the tutorial is trying to spider a page that has changed. The original address is: "http://www.oreilly.com/catalog/prdindex.html" this page no longer exists but it does redirect to the new page: "http://oreilly.co...