I'm trying to create a process that renames all my filenames to Camel/Capital Case. The closest I have to getting there is this:
perl -i.bak -ple 's/\b([a-z])/\u$1/g;' *.txt # or similar .extension.
Which seems to create a backup file (which I'll remove when it's verified this does what I want); but instead of renaming the file, it re...
ETA: When I ask "Why do you not use CPAN modules?", I am referring to the people who refuse to use any CPAN modules (including high quality ones like DBI). Not all CPAN code is of high quality, and it is fine to stay away from modules that are trivial or are based on experimental code (I got annoyed at a developer the other day for want...
Hello,
I have a process with an open filehandle to a file. I need to detect if this file has been deleted by another process (there may be a file with the same name in its place). On UNIX I was comparing the inodes of my filehandle and the file-path via stat, but this doesn't work on Win32. How can I do this in Perl?
Thanks,
-Peter
...
my $now = &GetDate;
my $myHeader = &ReadMessage;
my $mySoftwareVersions = param('mySoftwareVersions');
my $q = new CGI;print $q->header();
use CGI::Carp(fatalsToBrowser);
getAllSoftwareVersions();
sub getAllSoftwareVersions
{
my $user = "zxxx";
my $passwd = "xxxx";
# my $tableName = "config_table";
# my $con...
I have the following code that tries to tie arrays to files. Except, when I run this code, it only creates 2045 files. What is the issue here?
#!/usr/bin/perl
use Tie::File;
for (my $i = 0; $i < 10000; $i++) {
@files{$i} = ();
tie @{$files{$i}}, 'Tie::File', "files//tiefile$i";
}
Edit: I am on windows
...
This is a followup to "How can I get around a ‘die’ call in a Perl library I can’t modify?".
I have a subroutine that calls a Library-Which-Crashes-Sometimes many times. Rather than couch each call within this subroutine with an eval{}, I just allow it to die, and use an eval{} on the level that calls my subroutine:
my $status=eval{fun...
I have a bunch of scripts that run tool flows. Like a Makefile does but in Perl.
As part of those flows, the Perl scripts set environment vars and it's not always easy to know when they happen and hence it can be hard to reproduce individual stages of the flow.
Is there a way to hook into %ENV such that I can register a callback when t...
I need to create unique numerical ids for some short strings.
some.domain.com -> 32423421
another.domain.com -> 23332423
yet.another.com -> 12131232
Is there a Perl CPAN module that will do something like this?
I've tried using Digest::MD5 but the resulting numbers are too long:
some.domain.com -> 29680057245717615035661393...
I'm using Perl's File::Find module to scan for files, directories, and links. Among other things, I want the utility I'm writing to report dangling links. In theory, this is supported by creating a subroutine to be called whenever an dangling link has been found, and calling the find method with a hash reference of appropriate values, ...
In IIS 6, using Perl, I was able to send a stream of output to the client rather than buffering the entire thing and dumping it out at all once. This allowed such things as progress bars and such to be used.
How can I accomplish the same thing in IIS 7?
...
I'm developing an application using Perl 5.10, HTML::Mason, and apache 2.2. This is the first time I've used Perl 5.10 for a big project. I get a strange behavior every once in a while. The application dies with a very strange error:
panic: attempt to copy value
to a freed scalar b87acf34 at ...
I guess my question is it Perl 5.10 be...
I am writing a kid sister encryption function and I need a PRNG that produces consistent results across OSes (so no floating point math, taking advantage of hardware, or system level software). It would be nice, but not necessary, for the PRNG had a period longer than 230.
I am currently using a 32 bit Xorshift:
#!/usr/bin/perl
use s...
Am I a bad person if I use use Test::More qw(no_plan)?
The Test::More POD says
Before anything else, you need a testing plan. This basically declares how many tests your script is going to run to protect against premature failure...
use Test::More tests => 23;
There are rare cases when you will not know beforehand h...
I'm developing some CGI scripts and I'm trying to find a solution to decrease the "starting time" produced when I import a lot of modules with "use".
...
I am using GD library to draw an image.
Image I am drawing is this http://i39.tinypic.com/apd1f7.png
I am able to manage most of the image however, I do not know how to draw the red portion of the image. The red portion has a sideways triangle on both sides...how can I manage that using the GD lib?
...
I'd like to write some interactive GUIs in Perl. I've used TclTk but it looks dated. I've written QT code for C++, but the PerlTk module hasn't had a release in several years. Googling around I see other possible options.
What are good packages for this, including basic windowing, menus, drawing canvas, scrollbars, and so on.
...
I am writing a web service in Perl that will run under SSL (HTTPS) with client certificates.
How can I determine which certificate is being used by the client in the current connection so I can filter out unwanted ones?
Note: the web service is being run as a mod_perl script.
...
Selenium has some nice additional libraries, as long you are using Java to write your tests, e.g. LoggingSelenium. However, these are not usable if you are writing in Perl. How do you normally do proper reporting, possibly with screenshots after every significant step etc.?
...
I am using CGI to allow the user to upload some files. I just want the just to be able to upload .txt or .csv files. If the user uploads file with any other format then I want to be able to put out an error message.
I saw that this can be done by javascript: http://www.codestore.net/store.nsf/unid/DOMM-4Q8H9E
But is there a better way...
I am uploading a file to a Perl program from from an HTML page. After the file has been uploaded I want to determine whether the file is either space or tab delimited and all the values are integers. If this is not the case then I want to output some message.
I was thinking of reading every character of the file and checking if it's...