perl

Regex to match all HTML tags except <p> and </p>

I need to match and remove all tags using a regular expression in Perl. I have the following: <\\??(?!p).+?> But this still matches with the closing </p> tag. Any hint on how to match with the closing tag as well? Note, this is being performed on xhtml. ...

Parsing XML Elements & Attributes with Perl

So I wrote some perl that would parse results returned from the Amazon Web Services. I am using the XML::Simple package. For the most part, everything worked when I pulled out an element. However, the problem I ran into was when an element had an attribute as well. Then I get an error that the item is a Hash. Here's what I did if ...

How do you use XML::Parser with Style => 'Objects'

The manual page for XML::Parser::Style::Objects is horrible. A simple hello world style program would really be helpful. I really wanted to do something like this: (not real code of course) use XML::Parser; my $p = XML::Parser->new(Style => 'Objects', Pkg => 'MyNode'); my $tree = $p->parsefile('foo.xml'); $tree->doSomething(); MyNode...

How do I lock a file in Perl?

What is the best way to create a lock on a file in Perl? Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock file? ...

Regex to replace Boolean with bool

I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement. s/\bBoolean\b/bool/g There are a few conditions. 1) We have CORBA in our code and \b matches CORBA::Boolean w...

How can I clear Class::DBI's internal cache?

I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between times that it is accessed. From the man pages I found two options: Music::DBI->cle...

Why can't SGML::Parser::OpenSP find the symbol __ZTI15SGMLApplication?

I'm trying to "install SGML::Parser::OpenSP" from the cpan shell, but it fails on the first "make test". I also get the same error if I go into the build directory and run make test. I believe this bit of the output below is the relevant part. Note the Symbol not found when perl gets to the "use" line for the new library. The file list...

Integrating Perl and Oracle Advanced Queuing

Is there any way to listen to an Oracle AQ using a Perl process as the listener. ...

Is there an n-ary tree implementation in Perl?

I'm writing a Perl script and would like to use a n-ary tree data structure. Is there a good implementation that is available as source code (rather than part of a Perl library) ? ...

Is there an elegant zip to interleave two lists in Perl 5?

I recently "needed" a zip function in Perl 5 (while I was thinking about How do I calculate relative time?), i.e. a function that takes two lists and "zips" them together to one list, interleaving the elements. (Pseudo)example: @a=(1, 2, 3); @b=('apple', 'orange', 'grape'); zip @a, @b; # (1, 'apple', 2, 'orange', 3, 'grape'); Haskel...

How would you extract data from a MS Project .mpp file?

I need to extract data from a .mpp file on the network and combine it with other data from several different databases. The application can be written in Perl, VB6, VB.net or C# but must be easily scheduled from a Windows based server. What would you recommend to extract the MS Project data with no user intervention? Is there any ODBC...

cross platform unicode support

I find that getting Unicode support in my cross-platform apps a real pain in the butt. I need strings that can go from C code, to a database, to a Java application and into a Perl module. Each of these use a different Unicode encodings (UTF8, UTF16) or some other code page. The biggest thing that I need is a cross-platform way of doin...

Saving Perl Windows Environment Keys UPCASES them

Hi, I have a framework written in Perl that sets a bunch of environment variables to support interprocess (typically it is sub process) communication. We keep a sets of key/value pairs in XML-ish files. We tried to make the key names camel-case somethingLikeThis. This all works well. Recently we have had occasion to pass control (c...

Which Perl database interface should I use?

Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options? ...

Suggest some good MVC framework in perl

Can you suggest some good MVC framework for perl -- one I am aware of is catalyst The need is to be able to expose services on the perl infrastructure which can be called by Java/.Net applications seamlessly. ...

Are there conventions for function names when using the Perl Test::More?

Are there conventions for function names when using the Perl Test::More or Test::Simple modules? I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after successful completion of the test(s). cheers, Rob ...

How can I fork a background processes from a Perl CGI script on Windows?

I've had some trouble forking of processes from a Perl CGI script when running on Windows. The main issue seems to be that 'fork' is emulated when running on windows, and doesn't actually seem to create a new process (just another thread in the current one). This means that web servers (like IIS) which are waiting for the process to fini...

How to get the correct Content-Length for a POST request.

I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option. http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1 There is a version 1.2, already tested and get the same issue. The post looks something like this. Host: foo.appspot.com User-Agent: lwp-request/1.38 Content-...

How can I embed Perl inside a C++ application?

I would like to call Perl script files from my c++ program. I am not sure that the people I will distribute to will have Perl installed. Basically I'm looking for a .lib file that I can use that has an Apache like distribution license. ...

Are there any good automated test suites for Perl?

Can someone suggest some good automated test suite framework for Perl? ...