perl

How can I modify specific part of a binary scalar in Perl?

I adopt select(), sysread(), syswrite() mechanism to handle socket messages where messages are sysread() into $buffer (binary) before they are syswritten. Now I want to change two bytes of the message, which denote the length of the whole message. At first, I use following code: my $msglen=substr($buffer,0,2); # Get the first two byte...

How can I convert non-ASCII characters encoded in UTF8 to ASCII-equivalent in Perl?

I have a Perl script that is being called by third parties to send me names of people who have registered my software. One of these parties encodes the names in UTF-8, so I have adapted my script accordingly to decode UTF-8 to ASCII with Encode::decode_utf8(...). This usually works fine, but every 6 months or so one of the names contai...

"Undefined subroutine &HTML::Entities::decode_entities called"

I'm getting the error Undefined subroutine &HTML::Entities::decode_entities called` using LWP::UserAgent, although the module is there, as well as the HTML::Parser module. I suspect it has something to do with XS modules missing, since the function in question seems to be implemented in XS, but I am at a loss. ...

How can I change the directory holding the test files in ExtUtils::Makemaker?

How can you change the default tests path in Makefile.PL from the default value t/*.t? There's an attribute mentioned in the documentation but it does not work. Anybody know how to that? Thanks! ...

How can I remove text within parentheses with a regex?

I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example: filename = "Example_file_(extra_descriptor).ext" and I want to regex a whole bunch of files where the parenthetical expression might be in the middle or ...

What is the easiest and lightest way to make a client-server in Perl ?

It will be better if this solution is based on HTTP protocol. ...

How do I know if PDF pages are color or black-and-white?

Hi, Given a set of PDF files among which some pages are color and the remaining are black & white, is there any Perl program to find out among the given pages which are color and which are black & white? Thanks in advance. ...

What are some elegant features or uses of Perl?

What? Perl Beautiful? Elegant? He must be joking! It's true, there's some ugly Perl out there. And by some, I mean lots. We've all seen it. Well duh, it's symbol soup. Isn't it? Yes there are symbols. Just like 'math' has 'symbols'. It's just that we programmers are more familiar with the standard mathematical symbols....

Can you review my Perl rewrite of Cucumber?

There is a team working on acceptance testing X11 GUI application in our company, and they created a monstrous acceptance testing framework that drives the GUI as well as running scenarios. The framework is written using Perl 5, and scenario files look more like very complex Perl programs (thousands of lines long with procedural-program...

Can I have a "Parent has_many GrandChildren through Children" relationship in DBIx::Class?

I'd like to have functionality like this: $parent->get_grandchildren_by_category({category => 'foo'}); I can do it easily outside of the parent class with a simple chained join: $schema->resultset('Parent')->search( { 'me.id' => 62, 'grandchildren.category' => 'foo' }, { join => {'children' => 'grandchildren'} } ); But in...

Where can I find the best documented, most reliable Perl examples?

Update: Thank you all for chiming in. It's tough to pick a winner, so I went with the highest voted with the most information. I'll check out perlmonks and I'll look into some of the books mentioned as well. End Update Let's say I'm looking for help with Perl. (I am. I'm just getting into it.) Compared to PHP, I'm really disappointe...

What regex can match sequences of the same character?

A friend asked me this and I was stumped: Is there a way to craft a regular expression that matches a sequence of the same character? E.g., match on 'aaa', 'bbb', but not 'abc'? m|\w{2,3}| wouldn't do the trick as it would match 'abc'. m|a{2,3}| wouldn't do the trick as it wouldn't match 'bbb', 'ccc', etc. ...

How can I insert text into a string in Perl?

If I had: $foo= "12."bar bar bar"|three"; how would I insert in the text ".." after the text 12. in the variable? ...

What's the best Perl module for hierarchical and inheritable configuration?

If I have a greenfield project, what is the best practice Perl based configuration module to use? There will be a Catalyst app and some command line scripts. They should share the same configuration. Some features I think I want ... Hierarchical Configurations to cleanly maintain different development and live settings. I'd like t...

How can I remove every third HTML tag in Perl?

Hey everybody, This is a quickly cooked up script, but I am having some difficulty due to unfamiliarity with regexes and Perl. The script is supposed to read in an HTML file. There is a place in the file (by itself) where I have a bunch of <div>s. I want to remove every third of them -- they are grouped in fours. My script below won...

Is there a Perl tutorial for Verilog engineers?

I want to start studying Perl, specifically for checking verilog output files. Is there some tutorial that is specific to say Perl for Verilog engineers or something like that? ...

How do I call Perl script in C# application?

I want to capture output of a Perl program and display output data (string on screen) in a text box on C# Windows Form. Here is my main C# code: public partial class frmMain : Form { private Process myProcess = null; public frmMain() { InitializeComponent(); } public delegate void UpdateUIDele...

Is there an all-countries phone number validator for Perl?

I am doing web development with Perl. I need to do phone number validation for all countries. Is there open source Perl module that can do the following? For example: country = Malaysia, if user input phone number = +60127008007, after validate, it return this is a valid mobile number in Malaysia, where: In local Malaysia, we call: 0127...

In Perl, how to do you remove ^M from a file?

Hi! I have a script that is appending new fields to an existing CSV, however ^M characters are appearing at the end of the old line so the new fields end up on a new row instead of the same one. How do you remove the ^M characters from a csv file using Perl?. ...

How do I redefine built in Perl functions?

I want to do two things: In production code, I want to redefine the open command to enable me to add automagic file logging. I work on data processing applications/flows and as part of that, it's important for the user to know exactly what files are being processed. If they are using an old version of a file, one way for them to find ou...