perl

Are there Unix platforms where Perl is not installed by default?

I am in the process of answering a request for tender on a contract that requires a decent amount of text processing. The main trouble is that the customer wants to be able to run this on any UNIX (HPUX, Solaris, AIX, FreeBSD) or Linux (SLES, RHEL) platform, which may constrain what I use to do it. They don't want to make the installatio...

In Perl, how can I detect if a string has multiple occurrences of double digits?

I wanted to match 110110 but not 10110. That means at least twice repeating of two consecutive digits which are the same. Any regex for that? Should match: 110110, 123445446, 12344544644 Should not match: 10110, 123445 ...

In Perl, how can I unpack to several variables?

I have a struct wich contains: struct mystruct{ int id[10]; char text[40]; unsigned short int len; }; And I'm trying to unpack it in a single line, something like this: my(@ids,$text,$length) = unpack("N10C40n",$buff) ; But everything is going to the first array(@ids), i've tried templates as "N...

What are the Perl user groups or discussion forums?

What are the Perl user groups or discussion forums? ...

How can I limit the time spent in a specific section of a Perl script?

Is there any way to build some time counter that enable parts of a script to run as long it ticks? For example, I have the following code: for my $i (0 .. $QUOTA-1) { build_dyna_file($i); comp_simu_exe; bin2txt2errormap($i); } Theoretically I want to run this loop for 3 minutes, even if the loop instructions haven't finish...

How do I add a script specific lib path in mod_perl?

I'm trying to migrate CGI scripts to mod_perl using ModPerl::Registry. The scripts use modules that are in the same directory as the script, but since mod_perl current directory is elsewhere, that doesn't work. I tried using FindBin to add on to the @INC, but here's what FindBin looks like: $FindBin::Bin: /usr/sbin $FindBin::Script: h...

What is a regular expression to return the substring between two characters in a longer string?

I have a string in Perl like: "Full Name (userid)" and I want to return just the userid (everything between the "()"'s). What regular expression would do this in Perl? ...

Why does Perl's File::Copy silently fail on Windows 2008?

I have a Perl script that works on Windows XP. It uses File::Copy's move function to move a directory tree to another place on the same drive. The script fails (silently) on Windows 2008. Nothing moved, nothing deleted. I am using ActiveState Perl 5.10.0 Build 1005 and the File::Copy that comes with it. Anyone know of issues with Activ...

Why is the fields pragma incompatible with multiple inheritance in Perl?

Multiple inheritance is great, and Perl handles it just fine as long as you have a clear understanding of your inheritance heirarchy and some of the potential pitfalls (such as those described in perldoc perltoot). Yet it does not discuss the prohibition of using the fields pragma with multiple inheritance. Indeed, I can find no docume...

How can I abort a Catalyst upload based on Content-Length or MIME-Type?

I've tried to use parse_on_demand as shown in: http://search.cpan.org/~flora/Catalyst-Runtime-5.80007/lib/Catalyst.pm#ON-DEMAND_PARSER However, I can't seem to stop the upload. I'm testing this simply by creating an action that dies immediately, however the browser seems to upload the very large file I've selected before it ever reaches...

How do I do tab completion in Perl's Term::Shell?

I am using the Term::Shell package in Perl for implementing a CLI tool. I am not able to do the tab completion of a command part with that. comp_CMD() - which is a API provided by this Term::Shell, is to achieve the tab completion. This is not helping me. Does anyone know how to make this work?? Sample Code: #!/usr/bin/env perl packa...

What are the various directories in @INC used for?

It would help me to understand what module I have if I understood reasons modules ends up in the various directories under @INC Under ActiveState on windows it is fairly clear C:/Perl/lib C:/Perl/site/lib The first is core Perl stuff whilst the 2nd is stuff I have installed via PPM (have I got this right?) However under Debian it se...

What are some good methods or steps to debug a seg fault in Perl?

There are two cases where my code won't seg fault: When I use Smart::Comments in at least one place run through the debugger. I've tracked it down to this call: $action->{breakdown} = join( ' ' , each_pair { my ( $name, $length ) = @_; return "x$length" if $name eq 'FILLER'; ...

Catching errors with both mod_cgi & mod_perl

Thanks to everyone in advance. I've been doing some research on error handling and I don't feel like I'm getting a solid understanding of what I should do. Preamble: My code is living in Apache and executed in the browser, my goals don't include command line execution. I'd like to have the behavior of CGI::Carp (fatalsToBrowser) with ...

Quality guide to automake + autoconf and the other intricacies of a build process?

I'm a fairly fresh developer, and so have absolutely no complex experience with build processes and the like. Most guides on the subject of automake and autoconf are difficult to understand or introduce unecessary complexity. I have several Perl scripts I need to deploy as CGI scripts on remote boxes (a mix of BSD and Ubuntu servers), an...

How to efficiently calculate a running standard deviation?

I have an array of lists of numbers, e.g.: [0] (0.01, 0.01, 0.02, 0.04, 0.03) [1] (0.00, 0.02, 0.02, 0.03, 0.02) [2] (0.01, 0.02, 0.02, 0.03, 0.02) ... [n] (0.01, 0.00, 0.01, 0.05, 0.03) What I would like to do is efficiently calculate the mean and standard deviation at each index of a list, across all array elements. To do the ...

Where can I find 'more advanced web toolkit' for Template Toolkit?

I really like Template Toolkit and like how it works with Catalyst, but I would like more 'web advanced' toolkit. It could be just a package of *.tt files for Web objects like these: Selector, Selector_DateTime, Menu, Data_Table... Is there something like that somewhere on the Web? If not, why not? ...

How do I compare two strings in Perl?

How do I compare two strings in Perl? I am learning Perl, I had this basic question looked it up here on StackOverflow and found no good answer so I thought I would ask. ...

How I can run 'cpan' inside emacs?

I like to know how I can run cpan to install modules using emacs? I often do that on command line now. Update: I had asked this because I get the message "warning: extra args ignored after '-e'" when I use M-x shell to run it. I still need help. ...

Is a client-server setup a good way to move data between machines?

I need to move some data from one machine to another. Is it a good idea to write a client server app using sockets in Perl to do the transfer? Will I have problems if one side is written in Java? I mean, should I be aware of any issues I might face when I try to attempt the above? ...