perl

inter-process communication on local machine using socket in perl and c#

Hi: I am working on a c# application that spawn new Processes to run Perl programs: I was wondering if there is a way to use socket interface to let perl program to talk to c# application. If using socket, the address has to be local host: 127.0.0.1? How to choose which port number to use? also, Since the C# application spawn a Proce...

How can I write XML data to a file with Perl?

Could you please correct my code below. #!/usr/local/bin/perl open (MYFILE, '>>data.xml'); print MYFILE "<?xml version="1.0" encoding="UTF-8"?>\n"; close (MYFILE); Updated. #!/usr/local/bin/perl open (MYFILE, '>>data.xml'); print MYFILE '<?xml version="1.0" encoding="UTF-8"?\>'."\n"; print MYFILE '<?xml version="1.0" encoding="UTF-...

Keep getting gcov error when trying to run lcov in Windows command line

Hi all: I was wondering what else is actually needed in order to run lcov in windows command line? Every time when I run perl lcov, I always get a reminder or errors similar to the following: geninfo: ERROR: need tool gcov! I looked into my bin directory, and couldn't find a gcov.exe. I normally do perl genhtml filename to get a ht...

How can I get the version and location of an installed Perl module?

Is there a smart way to detect whether a certain Perl module has been installed in your system? My old sutpid way is to write a Perl script in which the only thing I do is just to use the module. If nothing croaks when I run the detect script, then I know the module has been installed, although I still don't know which version and wher...

How can I open a DB handle in C and pass it to Perl using SWIG?

Please help me in writing SWIG interace. I want to open a database connection handle in C program. This handle must be passed to Perl, where I will use the Perl DB interface for interacting with the database. For security purpose we wanted to use this mechanism. I want to pass the database handle using SWIG interface. Added: We are ...

How can I get the body of an HTTP response using LWP::UserAgent in Perl?

I find that the return from LWP::UserAgent->request() contains both the header and body of a HTTP response. I just need the body of the response to do some parsing, so how can I do? ...

Is there a Perl equivalent of SAS' INTNX function or Javascript's Dateadd function?

I'm trying to convert Chinese lunar system to Gregorian using Perl, both for fun and for learning purposes. I thought there was some kind of easy mathematical algorithm to do the job but turned out I was wrong. Anyway, after a little googling around I came aross some ready SAS code that could do the job. Well, it was not too difficult fo...

How does $#array work in Perl?

In the following example: my $info = 'NARIKANRU'; my @first_one = split /,/, $info; print "$first_one[$#first_one]$first_one[$#first_one-1]\n"; The output is: NARIKANRUNARIKANRU I am not sure if this is correct because there is only one element in @first_one and $#first_one is the index of that element. Given that $#first_one is ...

What's the best way to debug third-party Perl script?

I have a Perl script that gives a completely useless error message, is there a way to get perl to give a stack trace when the error occurs? I tried it this way but it did not work: # Run command in the debbugger: perl -d /path/to/script.pl -my -normal -args # Reset the die command to your own subroutine to do a stacktrace: DB<1> *CO...

Why can't XML::Schematron::XPath find XML::XPath?

After installing the XML::Schematron::XPath module from CPAN I am getting the "Can't locate XML/XPath.pm in @INC) message. ]$sudo ls /usr/lib/perl5/site_perl/5.10.0/XML/ ESISParser.pm Filter Handler Parser PatAct Perl2SAX.pm SAX2Perl.pm Schematron Schematron.pm Validator There is the Schematron directory, and inside of it is X...

Is there anything like PPI or Perl::Critic for C?

PPI and Perl::Critic allow programmers to detect certain things in the syntax of their Perl programs. Is there anything like it that will tokenize/parse C and give you a chance to write a script to do something with that information? ...

Is there a Perl POE module for monitoring a database table for changes?

Is there any Wheel /POCO /Option to do this in Perl using the POE module: I want to monitor a DB table for changed records (deleting /insert/ update) and react accordingly to those changes. If yes could one provide some code or a link that shows this? ...

Why does XML::Simple flatten this Tomboy note?

I'm trying to parse a Tomboy note that has a link to another note inside it. The XML comes out looking like this: <?xml version="1.0" encoding="utf-8"?> <note version="0.3" xmlns:link="http://beatniksoftware.com/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size" xmlns="http://beatniksoftware.com/tomboy"&gt; <title>Our I...

Is there any C# equivalent to the Perl's LWP::UserAgent?

In a project I'm invovled in, there is a requirment that the price of certain stocks will be queryed from some web interface and be displayed in some way. I know the "query" part of the requirment can be easily implemented using a Perl module like LWP::UserAgent. But for some reason, C# has been chosen as the language to implement the ...

iPhone gui message from perl/shell-script possible?

I want to write a perlscript on my iPhone that is able to give me a heads up at certain points so I'm wondering how I would go about doing that. Is there a way to get a message through the gui from a script running in the background? I've been looking without much luck. I had a thought about inserting a fake sms into the sqlite db as a l...

How can I defer processing during apache / mod_perl page rendering?

I have an apache2 / mod_perl website. On one page, I need to do some server/server communication via SOAP. The results of this communication are not required for the rendering of the page (but user input is required to trigger this communication). The SOAP communication is very slow. So what I want to do is process and print the page ...

What is the easiest way to programmatically extract structured data from a bunch of web pages?

What is the easiest way to programmatically extract structured data from a bunch of web pages? I am currently using an Adobe AIR program I have written to follow the links on one page and grab a section of data off of the subsequent pages. This actually works fine, and for programmers I think this(or other languages) provides a reasonab...

BEGINNER: extracting subsets of data

Hello, this seems to be an easy task really, but being completely new to the world of programming, I have problems with the following task: I have a huge file which has the following format: track type= wiggle name09 variableStep chrom=chr1 34 5 36 7 54 8 variableStep chrom=chr2 33 4 35 2 78 7 this is text with the word random in...

How can I apply tr/// to each element of a Perl array?

Is there a better way to use tr/// on each element in an array than the following: foreach (@list) { tr/abc/xyz/; } I'm playing around with some stuff and I just can't get it out of my head that it doesn't look quite right/optimal. Maybe I'm just thinking of how conditionals can be used in a suffix form. Anyone know if there's a w...

Programmable transparent forward proxy

I'm looking for a way to script a transparent forward proxy such as the ones that users point their browsers to in proxy settings. I've discovered a distinct tradeoff in forward proxies between scriptability and robustness. For example, their are countless proxies developed in Ruby and Python that allow you to inspect each request resp...