perl

automate excel file processing in perl and avoid dialog/UI interactions

How can a I guarantee that no pop-up dialogs will appear when I automate Microsoft Excel through OLE? I'm using a Perl module (Win32::OLE). I can avoid most dialog pop-ups using the following code: use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Const; my $excel_symbols = Win32::OLE::Const->Load('Microsoft Excel'); my $excel =...

XML-RPC and Continuum from Python / Perl

Hi, Has anyone had any success with getting data via Xml-rpc using Python or Perl...? I'm using the continuum.py library: #!/usr/bin/env python from continuum import * c = Continuum( "http://localhost:8080/continuum/xmlrpc" ) or: #!/usr/bin/perl use Frontier::Client; my $url = "http://dev.server.com:8080/continuum/xmlrpc"; my ...

How can I access the Apache server configuration in a BEGIN block in mod_perl?

I've been trying to switch from using PerlSetEnv to using custom configuration directives. I have my configuration module with a copy of set_val from the docs: sub set_val { local our ($key, $self, $parms, $arg) = @_; $self->{$key} = $arg; unless ($parms->path) { local our $srv_cfg = Apache2::Module::get_config($se...

How do I use CPAN.pm to download other Perl modules?

Hi. I'm new to Object-Oriented programming and the perldoc page on CPAN.pm confuses the hell out of me. My program needs to download a couple of modules if they don't already exist. Is this basically just: CPAN::Shell->install("Module::Name::Here"); or is there more to it? Does that download the package, unarchive it, and install it, ...

How can I modify my cygwin environment to use Strawberry Perl instead of the packaged Perl distribution?

I currently use Strawberry Perl as my primary Perl distribution. However, I have some applications that make Perl calls through cygwin. These generally fail because they are calling the version of Perl that was packaged with cygwin, and only looking in cygwin's lib folders. How can I modify my cygwin environment to call Strawberry Perl (...

How do I get the client's IP address from within a Perl Frontier-RPC call?

I'm trying to get my Perl Frontier XML-RPC daemon to know about the IP address of the caller. I have to say I'm a newbie at Perl, so maybe this is obvious. I'm aware that Frontier::Daemon inherits from IO::Socket::INET, which has a peeraddr() method, but that doesn't help me when the daemon doesn't pass in its own instance to XML-RPC me...

What is a simple way to generate keywords from a text?

I suppose I could take a text and remove high frequency English words from it. By keywords, I mean that I want to extract words that are most the characterizing of the content of the text (tags ) . It doesn't have to be perfect, a good approximation is perfect for my needs. Has anyone done anything like that? Do you known a Perl or Pyt...

How do I track down a mod_perl memory leak?

I'm using mod perl 1.3.0 with apache 1.3.41 perl version 5.8.6, and the memory size seems to grow about 4k every 3rd or 4th request. The Perl script we are running is simply: print "Content-type: text/html\n\n"; print "baby"; Yet that apache process just grows and grows when we slam it with apache benchmark. We are hitting it with:...

How do I reset my LDAP password from Perl?

Hi all, My company, like everyone else's, requires password resets from time to time. This is all good and well for security's sake, but I'd like to explore the challenge of resetting it through a script (notably because we can't use our previous 25 passwords; Perl is much quicker about cycling through a list two-dozen deep than my fing...

Can I autodiscover parameters to shell or Perl scripts to "meta" program WEB UIs for them?

Is it possible to auto-discover parameters to shell/Perl scripts in order to "meta" program WEB UIs for them? I have a bunch of "legacy" scripts that I'd like to "web wrap". So far I have created a CGI-BIN web app with about 3 parameters that can call a bash/Perl reporting script. But it now occurs to me maybe there is quicker or aut...

my first perl script: using "get($url)" method in a loop?

So it seemed easy enough. Use a series of nested loops to go though a ton of URLs sorted by year/month/day and download the XML files. As this is my first script, I started with the loop; something familiar in any language. I ran it just printing the constructed URLs and it worked perfect. I then wrote the code to download the content a...

Why does this Perl regexp fail?

I have the following Perl code: my $progName = shift ; open(IPLAYERLIST, "iplayer-list.html") or die "Cannot open iplayer index file iplayer-list.html\n" ; while (<IPLAYERLIST>) { if ( /($progName)/is ) { #if ( /Just A Minute/is ) { <-- This works! my $iplayerID = $1 ; print "IPlayer program id for $progName is $iplayerID\n" ; ...

Is there a Perl equivalent of Python's re.findall/re.finditer (iterative regex results)?

In Python compiled regex patterns have a findall method that does the following: Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a list of groups; this ...

Is there a shell scrior Perl script to calculate Relative Humidity(%) using T_DB(Temp - Dry Bulb) and DP ( Dew Point)?

All I have is this Tc=air temperature in degrees Celsius Tdc=dewpoint temperature in degrees Celsius (1) Es=6.11*10.0** (7.5*Tc/ (237.7+Tc)) (2) E=6.11*10.0** (7.5*Tdc/ (237.7+Tdc)) (3) Relative Humidity (RH) in percent = (E/Es)*100 In fact ( froma CSV file ) I need to grab a value from Column9 and one from Col 10 use those value...

How can I test a standalone Perl script?

Hello! I have written a small Perl script and now I would like to create a test suite for it. I thought it would be nice to be able to use the script as a module, import the subs defined in the script and test these. Is there a way to have the script both standalone Perl script and Perl module? (I do not want to split the script into a ...

Is it mandatory that a folder by the name of a package should be present for creating a package?

Hi, We are factoring out the common code from our Perl project. One main program should be split into several re-usable modules. Our program name is *"validate_results.pl"* which contains set of validation commands. We are planning to split this into small modules so that *"validate_results.pl"* should be like: use Common::Validate_Re...

How do I use Perl on the command line to search the output of other programs?

As I understand (Perl is new to me) Perl can be used to script against a Unix command line. What I want to do is run (hardcoded) command line calls, and search the output of these calls for RegEx matches. Is there a way to do this simply in Perl? How? EDIT: Sequence here is: -Call another program. -Run a regex against its output. ...

How do I do Perl machine or platform dependent TDD?

How do I go about testing a function or module that is machine or platform dependent? For example, something that looks at/depends on $^O or a module like Net::Ifconfig::Wrapper? I don't need to test that Net::Ifconfig::Wrapper is returning the correct values, but I do need to test whether or not I'm doing the right thing with those va...

How can I get a list of indices on a SQL table using Perl?

How can I get a list of the indices on a table in my sybase database using Perl? The goal is to "copy" all the indices from a table to a nearly identical table. Is $dbh->selectarray_ref('sp_helpindex $table') the best I can do? ...

Is there a Term::ANSIScreen equivalent for Python?

Perl has the excellent module Term::ANSIScreen for doing all sorts of fancy cursor movement and terminal color control. I'd like to reimplement a program that's currently in Perl in Python instead, but the terminal ANSI colors are key to its function. Is anyone aware of an equivalent? ...