perl

On Windows is there a **light-weight** IDE that can be used both with C and Perl?

When I asked this previously I should have mentioned that it's particularly a light-weight IDE that I'm after, so I’m having to ask again as a different question. Something that is not just a text editor, is light-weight and versatile, that would suit Strawberry Perl, the GCC that comes with MinGW, GDB and Subversion. Something that whe...

How can I write a simple HTTP proxy in Perl?

I don't want to use the HTTP::Proxy package because I want to dump out a couple requests. My one liner looks like this, but breaks on trying to pass the header in: perl -MData::Dumper -MHTTP::Daemon -MHTTP::Status -MLWP::UserAgent -e 'my $ua = LWP::UserAgent->new;my $d=new HTTP::Daemon(LocalPort=>1999);print "Please contact me at: <", $...

How can I call Perl from Java?

I have a Perl module that I would like to use from Java. Is there a way to call this code using either ActiveState Perl on Windows or the generic Perl that comes with Linux? I have found references to JPL but it doesn’t appear to be maintained anymore. ...

What is the best way to call C/C++ code from other languages such as Java, PHP, Perl, Python, etc?

What is the best way to call C/C++ from other languages such as Java, Python, Perl, PHP, etc? ...

How can I convert these strings to a hash in Perl?

I wish to convert a single string with multiple delimiters into a key=>value hash structure. Is there a simple way to accomplish this? My current implementation is: sub readConfigFile() { my %CONFIG; my $index = 0; open(CON_FILE, "config"); my @lines = <CON_FILE>; close(CON_FILE); my @array = split(/>/, $lines[0]); my $total = @...

How can I catch and handle a signal in Perl?

Is there any way to trap an error and exit gracefully from Perl? I am working on a script which might fail due to a SIG event from the OS or other applications running on my server. I wish to trap this event, display the error and exit after closing all files and other attributes I have open during the execution of the script. ...

What's the best way to determine the total number of words of a file in Java?

What is the best way to find the total number of words in a text file in Java? I'm thinking Perl is the best on finding things such as this. If this is true then calling a Perl function from within Java would be the best? What would you have done in condition such as this? Any better ideas? ...

How can I update a progress display on a Perl command-line application?

I have a little Perl script (On Windows) that checks some files for me as an aid to my day-to-day business. At the moment it prints out something like... 0% 25% 50% 75% Complete But I can remember scripts I've used in the past that didn't print progress on a line-by-line basis, but which updated the output on the display, presumably b...

How can I repeat a string in Perl?

In Python, if I do this: print "4" * 4 I get > "4444" In Perl, I'd get > 16 Is there an easy way to do the former in Perl? ...

How can I create or read OpenOffice spreadsheets from Perl?

What is a good way to create and read an OpenOffice spreadsheet in Perl? ...

How can I join lines in a CSV file when one of the fields has a newline?

If I have a comma separated file like the following: foo,bar,n ,a,bc,d one,two,three ,a,bc,d And I want to join the \n, to produce this: foo,bar,n,a,bc,d one,two,three,a,bc,d What is the regex trick? I thought that an if (/\n,/) would catch this. Also, will I need to do anything special for a UTF-8 encoded file? Finally, a sol...

How can I send mail through Gmail with Perl?

How can I send email using Perl through my Gmail account? The one CPAN library (Mail::Webmail::Gmail) that I tried didn't work and I don't see much activity with it. At the moment I really only need to send a message. However, the advanced functionality of getting my contacts, acting when a new email is received that has a certain lab...

Should I learn Perl, and why?

I'm going into network engineering and security and I will eventually need to learn a bit of Perl. In year 3 of my course, 2 years away. So I was interested in starting a bit early, I've got the camel beside me and before indulging into this, I wanted some people to help win me over and make me want to learn Perl. What's good about it...

Is Perl worth it?

Hello, My boss has decided to use Perl as our (preferably) single, main development language. For me, it just doesn't seem right. I'm asking on your opinion about it, as my feelings might be influenced by today's trends and the horrible syntax (coming from c/java background). For me, specifically, after Java, I was shocked about the la...

Is there an ORM for Perl?

create table person ( name varchar(15), attr1 varchar(15), attr2 varchar(1), attr3 char(1), attr4 int ) How I can use basic ORM in Perl by taking a simple table like the one above and mapping it to Perl objects? Next I'd like to perform basic operations like select results using some criteria system Perl like synt...

Is there an object-centric Perl ORM?

This recent question on doing ORM in Perl proved somewhat timely, as I was just looking at Perl ORMs yesterday. Unfortunately, I was not particularly satisfied with what I found: They all appear (at least in their documentation) to focus primarily on the relational side of the object-relational divide. "Use our ORM to provide an OO(is...

Does Perl have PHP-like dynamic variables?

Hello, In PHP, I can write: $vname = 'phone'; $$vname = '555-1234'; print $phone; ... And the script will output "555-1234". Is there any equivalent in Perl? Edit: Thanks, CMS. Is there any way to constrain $phone to the scope of the local block, as if I'd written "my $phone"? Using "my $$vname" gives me "Can't declare scalar dere...

How to call c++ binary from Perl or PHP (CGI-BIN using Apache on Linux ) ?

I have a website cgi-bin program that is written in c++. Unfortunately the website provider for my friend's site only allows Perl or PHP cgi-bin scripts. Is there an easy way to simply have a very small Perl or PHP wrapper that just calls the c++ compiled binary? Would the c++ program still be able to read from stdin for POST comman...

Why doesn't DBD::Sybase's Makefile.PL find freetds?

I'm having trouble trying to install DBD::Sybase on Redhat. Perl version is 5.8.8 and it is the 64-bit version. When I set the SYBASE env variable to the freetds libs in /usr (the rpm puts libtds in /usr/lib64), it gives the following error message $ perl ./Makefile.PL Can't find any Sybase libraries in /usr/lib at ./Makefile.PL line ...

How can I insert a character into a string with the s/// operator?

I'm trying to insert a comment character into a string something similar to this: -CreateVideoTracker VT1 "vt name" becomes -CreateVideoTracker VT1 # "vt name" The VT1 word can actually be anything, so I'm using the regex $line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g; which gives me the result: -CreateVideoTra...