perl

What is the best Perl module for sending email?

For years I've been piping out to sendmail in my Perl programs to send email, but I have the strong sense I ought to use a module. It would make me feel less dirty. Care to recommend me one module over the others, with reasons why? Thanks in advance! ...

Why does my simple fastCGI Perl script fail?

I'm not of the Perl world, so some of this is new to me. I'm running Ubuntu Hardy LTS with apache2 and mod_fcgid packages installed. I'd like to get MT4 running under fcgid rather than mod-cgi (it seems to run OK with plain-old CGI). I can't seem to get even a simple Perl script to run under fcgid. I created a simple "Hello World" app...

How can I add sessions to my Perl web app?

I want to maintain state in my Perl web app. How can I do this effectively? I looked at CGI::Session but it says that it doesn't work well with UTF-8 pages, which is a requirement. I'd also like to be able to pass some basic information to another Java application running on the Glassfish app server, so people aren't forced to login t...

How can I implement TDD in Perl?

We're using mod_perl to produce data in XML and later to be converted into HTML via XSLT, and the database is in MySQL. Our OS is Unix. So I've been reading about how cool and powerful TDD is in .NET, Java with all the available frameworks. I've even tested NUnit before and I kind of like it. You can write the test once and use it prett...

How to set an HTTP environment variable from PHP for Bugzilla?

The bugzilla (perl-based) system has a feature to login automatically by using a http server environment variable. If you fill in the right ID or username, you are automatically logged in. My server runs Joomla (PHP-based) and has all the information about who is logged in. It runs bugzilla within a sub-frame. So, how can I set this en...

Is there any way to use diag() from Test::More without planning?

I'm writing some tests in Perl which have a fair amount of set up. This setup all lives in a module that the test scripts use. I want to be able to print some diagnostics from the module, and intended to use the diag function from Test::More. Problem is, when you use Test::More, it writes the plan so I get You tried to plan twice at...

How do I set up Visual Studio 2008 to program in Perl?

My company gave me VS2008 for web development in C#/ASP.NET. I do a lot of Perl programming too and I'd like to start using VS for that so I can have a consistent work environment... but am having real trouble figuring out how to do so. VS has a lot of nice features but seems pretty hostile towards languages it doesn't support out of t...

How do I find which file Perl loaded when I use a module?

in Perl, when I do use < module name> < ver>, the system finds the .pm for the library somewhere in the @INC path. Is there a reliable way to which file was actually loaded? ...

How can I execute inefficient code only at compile time when using mod_perl?

I've been benchmarking the performance of a framework I'm writing in Perl and I'm getting a 50% decrease in requests per second over our existing codebase (some hit is understandable, because we're going from procedural spaghetti code to an OOP MVC framework). The application is running under mod_perl, and I've added Moose and all my fr...

Can I write a DSL in Perl?

We use Perl for GUI test automation. It has been very successful. We have written a very lightweight DSL kind of language for GUI testing. The DSL is very similar to a object model. For example, we have an Application object at the root. Each property sheet in the application is a View object. Each page under the page is called Page obj...

How can I extract all quotations in a text?

I'm looking for a SimpleGrepSedPerlOrPythonOneLiner that outputs all quotations in a text. Example 1: echo “HAL,” noted Frank, “said that everything was going extremely well.” | SimpleGrepSedPerlOrPythonOneLiner stdout: "HAL," "said that everything was going extremely well.” Example 2: cat MicrosoftWindowsXPEula.txt | SimpleG...

Why is $1 empty in my substitution?

I am trying to put the stuff within parentheses into the value of a src attribute in an img tag: while(<TOCFILE>) { $toc_line = $_; $toc_line =~ s/<inlineFig.*?(\.\.\/pics\/ch09_inline99_*?\.jpg)*?<\/inlineFig>/<img src="${1}" alt="" \/\>/g; $new_toc_file .= $toc_line; } So I expected to see tags like this in the output: ...

How can I delete the last N lines of a file?

Can someone give some hints of how to delete the last n lines from a file in Perl? I have a very large file of around 400 MB, and I want to delete some 125,000 last lines from it. ...

Should I use PHP or Perl for massaging my data and storing/retrieving it with MySQL?

Hi All, I have a desktop app that needs to send data to a MySQL Server. The app will be for internal company use, but the MySQL is on a server at a hosting company. The data will need to be massaged a bit before being inserted and standard simple insert, delete and update. Which should I use PHP or Perl? I use PHP now for a variety o...

What does the Perl substitution operator act on?

I have been programming in Perl, off and on, for years now, although only sporadically is it my primary language. Because I often go months without writing any perl, I rely heavily on my dog-eared Camel Book to remind me how to do things. However, when I copy recipes verbatim with no understanding, this bothers me. This is one of the mos...

How can I apply 2 or more texture maps to a gluSphere OpenGL object?

I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have the basics working, with the glorious planet, implemented through a gluSphere(), rotating with the classic earth texture map applied. Now, what if I want to apply a second texture map through OpenGL (say, the "earth clouds")? Of course, I can mix the two te...

How can I download all emails with attachments from Gmail?

How do I connect to Gmail and determine which messages have attachments? I then want to download each attachment, printing out the Subject: and From: for each message as I process it. I never found a nice solution to this problem so I'm going to start a bounty. The person who provides the best answer wins. Please provide the complete...

How can I find a substring within a string using Perl?

I have a string from which I wish to extract a single word, but with a numerical appended to it, which might be different in each line: This is string1 this is string This is string11 This is string6 and it is in this line I want to parse this file and get the the values of "stringXXX", starting from 0 to 100 # suppose ABC.txt conta...

Is Mason a framework?

I've been having an agruement with a friend that Mason (Perl) is not a framework, but a templating language. I feel Mason for Perl does what JSP does for Java (as an analogy, not pure technical comparison). From what I know, JSP is not a framework and I feel neither is Mason. When I looked up wikipedia Mason (Perl), I see that the main s...

Why can't my Java webservice talk to my Perl backend?

In our project the Java webservice communicate with the backend program written in C and Perl to process. We are using the ProcessBuilderto execute a backend (UNIX) job FrameworkHandler. ProcessBuilder process; process.Start(FrameworkHandler -a ACTION) FrameworkHandler invokes a Perl script to perform some action. The Perl script int...