perl

sql server invalid precision on exists check query

Using sql server 2008 I am getting and invalid precision value error in the following perl script: use DBI; $idx = '12345'; $query = 'if exists (select * from tbl where idx = ?) select top 10 * from tbl'; my $h = $dbh->prepare($query) or die "Couldn't prepare query: " . $dbh->errstr; $h->execute($idx) or die "Couldn't execute statement:...

Regex to replace all ocurrences of a given character, ONLY after a given match.

For the sake of simplicity, let's say that we have input strings with this format: *text1*|*text2* so, I want to leave text1 alone, and remove all spaces in text2 This could be easy if we didn't have text1, a simple search and replace like this one would do: %s/\s//g but in this context I don't know what to do. I tried with somet...

How to add Types to libraries generated by wsdl2perl.pl in SOAP::WSDL

The generated library files from wsdl2perl.pl are not creating all the complex types I need to run requests through my wsdl. If I want to add a new type, say Price.pm to my type library, am I able to just add that module to the other library files? And if I do, what other files must I modify to incorporate it to my program (the element...

How do I automate CPAN configuration?

The first time you run cpan from the command line, you are prompted for answers to various questions. How do you automate cpan and install modules non-interactively from the beginning? ...

Calling perl from shell script, how do I pass return value from perl to shell?

I'm successfully calling a perl script from a shell script. Now I want to pass a return value from the perl script indicating whether it was successful or not to the shell script. How would I go about doing this? Thanks! ...

What is the cleanest way to duplicate base/parent.pm's functionality for non-object perl modules?

I'm not thinking too clearly right now and possibly overlooking something simple. I've been thinking about this for a while and been searching, but can't really think of any sensible search queries anymore that would lead me to what i seek. In short, I'm wondering how to do module inheritance, in the way base.pm/parent.pm do it for obje...

Is it possible to print from a perl CGI before the process exits?

I have a perl CGI that needs to report some information back to the browser before it goes into a really lengthy process that frequently takes several minutes. Currently I print the message but it doesn't show up till the entire process exits. So, my question is: Is it possible to get the message back to browser mid stream and if not ...

How do I get one row in the result set out of 2 rows in the table/file without using cursors in Sybase/Perl

I have a table T with columns A,B,C & D as below: A,B,C,D A1,B1,USD,LIBOR A1,B2,JPY,FIXED A2,B3,USD,LIBOR A2,B4,EUR,FIXED A3,B5,JPY,FIXED A3,B6,USD,LIBOR Table always has 2 rows per "A", with different values of "B". "B" is unique "A" - varchar(10), "B" - varchar(8), "C" - varchar(3), "D" - varchar(5) Validation rules restrict th...

Learning from Linux log files

Hello, I was wondering about the utility of storing metadata (Abbreviation Expansion, Brief Message, links to online resources) associated with messages, in /var/log/syslog, /var/log/kern.log etc. For instance, for a message like ACPI: Processor [CPU1] (supports 8 throttling states) I would search online about CPU throttling, and sto...

Need to print the last occurrence of a string in Perl

I have a script in Perl that searches for an error that is in a config file, but it prints out any occurrence of the error. I need to match what is in the config file and print out only the last time the error occurred. Any ideas? ...

Perl regex replacing at word boundary. Detecting "/" as a word boundary

Hi everyone, I am running into a strange regex issue.... I have a document where I am doing a replace... as an example I want to replace "DEXX" with "DEXX/AREX" and then with the next substitution replace... "AREX" with "AREX/CUBE" DEXX and AREX are stored in a hash like so.... "DEXX" => "AREX", "AREX" => "CUBE" The regex I have is thi...

Reap children without setting $SIG{CHLD} to IGNORE or to a custom signal handler

I am trying to write a socket server that forks for every connection. I have been successful except for one small caveat: my child processes use Net:OpenSSH->capture2() which requires that $SIG{CHLD} not be set to IGNORE or to a custom signal handler. How can I reap my children without setting the signal handler or slowing down the paren...

How to dump the machine instructions used by a Perl program

Two related questions After I run a program how can I see what machine code got executed? Moreover does perl execution convert the whole pl and its modules to machine code or just the part it executes? ...

Regex and the characters case.

Okay, I got a rather simple one (at least seems simple). I have a multi lined string and I am just playing around with replacing different words with something else. Let me show you... #!/usr/bin/perl -w use strict; $_ = "That is my coat.\nCoats are very expensive."; s/coat/Hat/igm; print; The output would be That is my Hat Hats are ...

How to handle modules that require Perl devel version on CPAN ?

I'm testing my project installation script on CentOS5.5. My project need Date::Manip module which requires feature module... When I try to install it (feature) through CPAN, CPAN wants to install Perl 5.9.5... *** WHOA THERE!!! *** This is an UNSTABLE DEVELOPMENT release. The version of this perl5 distribution is 9, that is, o...

is there an automatic tool for migrating a project from Perl to ASP.NET?

Hi all, I have this web based project written in Perl and I have to migrate it to ASP.NET. I'm a complete noob at this. Is there a way to reduce the manual labor for it? What would be your approach? Can you also provide a short example of something that works, maybe how to port a small HelloWorld file? Many thanks. ...

Did $ use to sometimes match a newline in Perl?

I seem to remember that there were certain conditions under which $ would match a newline (not "just before"), but I can't find anything in the docs that would confirm that. Did that use to be true in an earlier version of Perl or am I dreaming? ...

Match whitespace but not newlines (Perl)

I sometimes want to match whitespace but not newline. So far I've been resorting to [ \t] . Is there a less awkward way? ...

How do I perform a simple modification of an .ini file in perl?

I need change a value in a ini file like this val2 is the one being changed Before [section1] var1=val1 var2=val2 var3=va3 After: [section1] var1=val1 var2=value var3=va3 ...

What is "Modern Perl"?

I have been hearing a lot about this "Modern Perl." Can anyone explain what it is? One of the things I heard was the new open syntax: open my $FH, '<', $filename and not open FH, "<$filename"; What else is in Modern Perl? Thanks, Boda Cydo. ...