perl

How can I send POST and GET data to a Perl CGI script via the command line?

I am trying to send a get or a post through a command-line argument. That is test the script in the command line before I test through a browser (the server has issues). I tried searching online, and I suppose I was probably using incorrect terminology because I got nothing. I know this is possible because I saw someone do it. I just don...

Using Perl to build a SVN post-commit hook: IRC Bot to print commit Message

Hello I'm trying to build an IRC Bot which tells me in a private channel every commit-message which I want to know about. But I have trouble to get per #!/bin/bash REPOS="$1" REV="$2" # call bot with arguments reposname, revison and commit message in one string /usr/bin/perl /home/user/repo/svn_irc_bot.pl "$REPOS" "$REV" # all che...

Is_prime function via regex in python (from perl)

I've read this article where the /^1?$|^(11+?)\1+$/ Perl regex is used to test if a number is prime or not. Process: s = '1' * your_number If s matchs the regex, then it's not prime. If it doesn't, it's prime. How would you translate that regex to Python's re module? ...

How do I find the number of values in a Perl list?

The number of values in a list can only be determined by iterating over its values, or converting it to an array. Assigning it to a scalar won't return the items count: my $n = ('a', 'b', 'c'); # $n = 'c' There's an "empty parentheses" idiom, that can be used to get the number of elements: my $n = () = ('a', 'b', 'c'); # $n = 3 I...

How do I set a ulimit from inside a Perl script that applies to its children?

I have a Perl script that does various installation steps to set up a development box for our company. It runs various shell scripts, some of which crash due to lower than required ulimits (specifically, stack size -s in my case). Therefore, I'd like to set a ulimit that would apply to all scripts (children) started from within my main ...

Any Google API in perl working with OAuth

Hello, I've looked at Net::Google, and 90% of the modules use AuthSub with a mandatory login/password. The right way for a web application to interact with Google applications on behalf of a customer is to use OAuth. That way, the authentication is done by Google, and the application does not know the user's password. This is supported b...

What's the clearest way to replace trailing backslash \ with \n?

I want multi-line strings in java, so I seek a simple preprocessor to convert C-style multi-lines into single lines with a literal '\n'. Before: System.out.println("convert trailing backslashes\ this is on another line\ \ \ above are two blank lines\ But don't convert non-trailing backslashes, like: \"\t\" and \'\\\'"); After: ...

Why doesn't my wxPerl application for Windows start?

Hi, I've developed an application with Strawberry Perl 5.8.9.4 using wxPerl. The application is compiled using: wxpar -f Crypto -F Crypto -M Filter::Crypto::Decrypt --compress=9 --gui --icon=icon.ico --lib=./lib --module=App::Order --module=Wx --module=App::GUI::Main --module=App::GUI::Frame --module=App::GUI::Forms::Settings --mod...

Perl: Checking for the Existence of socket options

This is a continuation of my previous question: In Perl, how can I check for the existence of Socket options without generating warnings? If I run the following code I get the result I expect: #!/usr/bin/perl -w use strict; use diagnostics; use Socket qw(:all); my %opts; if ( defined( eval { SO_REUSEPORT } ) ) { $opts{'SO_REUSEP...

How do increment a value with leading zeroes in Perl?

It's the same question as this one but using Perl ! I would like to iterate over a value with just one leading zero The equivalent in shell would be : for i in $(seq -w 01 99) ; do echo $i ; done Thanks Community ! ...

How can I use literal single quotes inside the argument to perl's -e?

I try to create a short perl command that creates SQL inserts for my DB based on a text file. However, I am not able to get in the single-quotes used by SQL perl -pe '$i += 1; chomp; @a = split /\t/; $_ = "INSERT INTO XYZ VALUES($i, \'$a[4]\');\n"' results in a syntax error near unexpected token `)' Any ideas? ...

How can I find long term trends using RRD?

Newbie in rrdtool. I want to look at efforts required to establish a line of best fit on RRD charts so that we can detect long term trends - i.e. value is increasing over time. I have been recently using the Perl module Statistics::LineFit to help establish regression trends. Maybe there is a tool in RRD itself which makes it easier to ...

How do I read and write XML from Perl?

I need to reading from XML and write to XML through Perl. I don't know which packages to be installed. I am using Fedora Core 6. Please help me out to resolve this. ...

Is Perl's taint mode useful?

perl -T Do you use it? Does it helps you to find security holes in your Perl scripts? ...

"html agility pack" like module for perl

Hi everyone! Can anyone recommend a good module like "html agility pack"(.net) or "Beautiful Soup" for perl? Thanks in advance! ...

How do I get Perl's Spreadsheet::WriteExcel to create formulas with VLOOKUP?

I'm having difficulty with Spreadsheet::WriteExcel and formulas that use VLOOKUP. The following test script populates a worksheet with some data and tries to create a VLOOKUP formula. When I open the resulting Excel file, the formula results are displayed as #VALUE!. If I manually edit any of the cells containing formulas (press F2 and t...

Using Registry module crashes Perl with Access Violation

Our perl program crashes when started on customer's Windows machine. Further tests shows that with the perl distribution we provide, a simple "hello world" script works, but breaks if it includes the line: use Win32::TieRegistry(Delimiter=>'\\'); It crashes with Access Violation for accessing a zero pointer. The stack points to regist...

How can I create a Perl script to get some "named" command line arguments?

How can I create a Perl script to get some "named" command line arguments? For example: perl my_perl.pl -ARG_1 1234 -ARG_2 "Testing" Where ARG_1 and ARG_2 are the arguments names and 1234 and "Testing" their values. ...

How do Perl file descriptors work on Windows?

Are file descriptors supported on windows? Why do things "seem to work" in Perl with fds? Things like "fileno", "dup" and "dup2" were working but then randomly inside some other environment, stopped working. It's hard to give details, mostly what I'm looking for is answers from experienced Windows programmers and how file descriptors ...

How can I pass MySQL functions as bind parameters in prepared statement?

I'm trying to do this: $sth = $dbi->prepare('INSERT INTO table VALUES (?, ?, ?)'); $sth->execute( $var1, $var2 || 'NOW()', $var3 ); without any luck. Any ideas? ...