perl

How can I extract <%doc> content from Mason?

Is there a tool like javadoc to extract the <%doc> content and the various methods with their parameters in Mason (Perl)? I'd like to add some basic documentation to components I'm writing and it would nice for the documentation to be auto-generated from the code. Edited to answer question from benrifkah: My intention was to look for a...

Is Catalyst+Mason+Template::Toolkit worth learning rather than sticking to LAMP+Axkit?

hi, Currently i'm using pretty much Unix + Mysql + Perl + Apache with some javascript to make it more ajax like. and i've been looking at sites which are web 2.0 and stackoverflow and really like the simple design and the smooth flow from pages and action, etc. i'm trying to decide if learning catalyst, mason and the likes are going to ...

How can I parse people's full names into user names in Perl?

I need to convert a name in the format Parisi, Kenneth into the format kparisi. Does anyone know how to do this in Perl? Here is some sample data that is abnormal: Zelleb, Charles F.,,IV Eilt, John,, IV Wods, Charles R.,,III Welkt, Craig P.,,Jr. These specific names should end up as czelleb, jeilt, cwoods, cwelkt... etc ADDITION+++++ ...

How to I get verbose (or debug) output with SOAP::Lite?

I've got a working SOAP::Lite client. It works against an established server, but so far my development server is sending back nothing except a 404. (Which is odd, because I'm not even seeing a connection on the server end.) The closest parallel that I'm used to is Net::FTP. my $ftp = Net::FTP->new( "some.host.name", Debug => 1 ); ...

How do I replace the values of a hash in an external file?

For my program, I'm attempting to replace the value of a specific hash in an external file with a newly created value. The external file has the value tab-delimited from the key, and I had read the hash in from the external file. I've been looking around online, and this is the closest way I could figure out how to do it, yet it doesn't ...

Is there a Perl DBI driver for SQL Server Compact 3.5?

Maybe I'm not looking in the right places but I'd like to use SQL Server Compact 3.5 as a back-end for an existing Perl app that uses DBI (on Windows). I'm looking specifically at SQL Server Compact 3.5 because I'd like to use the existing support for it in MS Sync Framework to get started instead of the SQLite db I'm currently using. ...

How do you use the Apache "ScriptInterpreterSource Registry-Strict" directive?

i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: #!/usr/bin/perl, but on my windows machine the shebangs would be #!c:\perl\bin\perl.exe, so i have a conflict with the source code base. enter the Ap...

How can I get the number of pages in a PDF file in Perl?

Is there any Perl script to read multiple PDF files and get the number of pages in it? By using PDFlib or pdftet. ...

Are there Perl modules that can't be used in CGI?

I had a recent problem where Tie::File proved the best answer I could work with for a Perl program. I'm at a point where I'm ready to work with CGI, and I need to ask: are there Perl modules that can't be used in CGI, especially that Tie::File? If there are any complications, are there ways to reconcile them? ...

How can I replace strings in a text in Java?

In a project we have text files looking like this: mv A, R3 mv R2, B mv R1, R3 mv B, R4 add A, R1 add B, R1 add R1, R2 add R3, R3 add R21, X add R12, Y mv X, R2 I need to replace the strings according to the following, but I am looking for a more general solution. R1 => R2 R2 => R3 R3 => R1 R12 => R21 R21 => R12 I know I could d...

Please explain this Perl regular expression

$rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; printf $fh lc($2.$1); I got help building this regular expression yesterday, but I don't fully understand it.It takes a name like Parisi, Kenneth and prints out kparisiKnowns:s/ = substitutem/ = matchI tried searching for the rest...

How can I break out of recursive find function once a specific file is found?

I'm using the File::Find module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that? find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } } ...

Documentation about Roles

Hello, some time ago I found an article (Roles: Composable Units of Object Behavior) describing the pros of using Roles versus Interfaces or other ways of dealing with behavior requirements. Does any of you knows where I can find more literature about that, or knows more about Roles? I know that that's almost a research topic, but maybe...

mod_perl vs mod_fastcgi

I'm developing a web app in Perl with some C as necessary for some heavy duty number crunching. The main problem I'm having so far is trying to decide if I should use mod-perl, mod-fastcgi or both to run my scripts because I'm having a difficult time trying to analyze the pros and cons of each mod. Can anyone post a summary or give a li...

How can I sort a hash's keys naturally?

I have a Perl hash whose keys start with, or are, numbers. If I use, foreach my $key (sort keys %hash) { print $hash{$key} . "\n"; } the list might come out as, 0 0001 1000 203 23 Instead of 0 0001 23 203 1000 ...

Why can't I connect to postgres from Perl?

I believe I have set up Pg properly, but my script doesn't seem to be connecting to the database. I am testing with: $database="networkem"; $user="postgres"; $password=""; $host="localhost"; $dbh = DBI->connect("DBI:Pg:dbname=$dbname;host=$host", $user, $password); My pg_hba reads: host all postgres 127.0.0.1 255.255.25...

Where can I find a collection regular expression exercises for Perl?

I learned a lot of Perl RegEx syntax rules, but probably the only way to actually be able to write them is to do a bunch of 'RegEx' related exercises. I looked over the other "Learn RegEx" threads on StackOverflow, but haven't found anything similar. Is there any collection of such exercises? In form of book, HTML, with/without answers...

How can I ignore accents when comparing strings in Perl?

I have this quiz application where I match what people type with the right answer. For now, what I do is basically that : if ($input =~ /$answer/i) { print "you won"; } It's nice, as if the answer is "fish" the user can type "a fish" and be counted a good answer. The problem I'm facing is that, well, my users as I are french, an...

How can I non-recursively migrate directories with Perl or shell?

Hello, We're migrating home folders to a new filesystem, and I am looking for a way to automate it using Perl or a shell script. I don't have much choice in programming languages as the systems are proprietary storage clusters that should remain as unchanged as possible. Task: Under directory /home/ I have various users' home folders a...

How can I hook into Perl's print?

Here's a scenario. You have a large amount of legacy scripts, all using a common library. Said scripts use the 'print' statement for diagnostic output. No changes are allowed to the scripts - they range far and wide, have their approvals, and have long since left the fruitful valleys of oversight and control. Now a new need has arriv...