I'm creating a small reporting script in Perl CGI. I want to have the start/end date there to filter the events on the report. So now I wonder how to validate the input in some easy, Perl-way.
The way I generate the form with those fields is:
print textfield({-name=>'start_date', -value=>$start_date});
print textfield({-name=>...
FYI, I'm using Perl and Win32::OLE, but the error is a Word VBA one.
Using Perl's Win32::OLE module, I'm trying to create a table in Word and format certain elements of it. I created the table (15 x 3) and successfully created a range object pointing to the cells from (2, 1) to (14, 3), i.e. all cells except the top and bottom rows.
I ...
In perl, I read in files from a directory, and I want to open them all simultaneously (but line by line) so that I can perform a function that uses all of their nth lines together (e.g. concatenation).
my $text = `ls | grep ".txt"`;
my @temps = split(/\n/,$text);
my @files;
for my $i (0..$#temps) {
my $file;
open($file,"<",$temps[$i...
I found some posts related here but, nothing right on..
I need to serve up an image (humm) "correctly" and using as little resources as possible.
I was working on a sub (below) but, is not too resource friendly just by the fact I use CGI. That is just my assumption though. I am a Perl newbie but, I like it better than php.
The query wo...
Inside a Perl script, I want to run a Java program that takes in 2 inputs, which will be passed by the command line.
So I do:
if (scalar @ARGV == 2)
{ print `java myProg $ARGV[0] $ARGV[1]`; }
elsif (scalar @ARGV == 1)
{ print `java myProg $ARGV[0]`; }
I works if I enter 2 args, but still hangs if I enter only 1 arg
How should I co...
Hi Guys,
I have perl module file and test script pl which I use to run some function, and after browsing through the use lib and this previous question here...
I still don't know how to do this.
Basically I have a production directory which contains the module file, and I have a test directory file which contains the same module and the...
How can I pass Perl array by reference to C XS module?
my @array = ( 1..20 );
XSTEST::test_array_passing(\@array);
What do I do in XS so it sees the array?
...
Thanks for the answers... i am trying the different possibilities with all your answers.
one thing: i could not be that much clearer in asking question to you all, ie. i m applying this RE in my local script/character(similar to Tibetan Script) and not in English word.
foreach my $word (@list)
{
if(grep(/$word/, $dict)) # i have...
I'm trying to use the Tenjin module but it fails because it can't find the template file but it exists. I've added some debug statements into the module and it's not passing
return $filepath if (-f $filepath);
even when $filepath is correct. I've tried in a standalone script and it works fine but when I copy it to the mod_perl scrip...
I have to send the XML below. And i have no idea where to start. I know i need to look up SOAP in Perl but thats roughly it.
<xs:element name="CheckDomain">
<xs:complexType>
<xs:sequence>
<xs:element name="domain" type="domainRef"/>
<xs:element name="suggestions" type="xs:boolean" default="false" minOccurs="0"/>
</xs:sequence>
</x...
I have a Perl test script written using Test::More. Right before exiting, and if all tests passed, I'd like to perform some cleanup actions. If any tests failed, I want to leave everything in place for troubleshooting.
Is there a flag within Test::More, or some other best practice within a single test script, to tell if "all is well" ...
This question is a spin-off from this one. Some history: when I first learned Perl, I pretty much always used glob rather than opendir + readdir because I found it easier. Then later various posts and readings suggested that glob was bad, and so now I pretty much always use readdir.
After thinking over this recent question I realized th...
I need to launch curl for a test. I need to send XML which has " / and other crazy things. Whats the quickest way to do it? I tried
curl -k -d '<xs:element name="Login"/>' https://thewebsite.com/page.exe
with no luck.
...
I'm looking for is a good on-screen POD reading experience.
For years, I've used perldoc or man running in an xterm to read Perl documentation on screen, and a small custom program built around Pod::LaTeX to print it. The printed version is good: the script does a nice job. However, on-screen reading is painful:
You can search, but go...
I'm using this code to get a list of all the files in a specific directory:
opendir DIR, $dir or die "cannot open dir $dir: $!";
my @files= readdir DIR;
closedir DIR;
How can I modify this code or append something to it so that it only looks for text files and only loads the array with the prefix of the filename?
Example directory co...
Almost universally when people post questions on SO (or elsewhere) about Perl and reading from files, if any code that involves an old-style open
open FH, ">file.txt" or die "Can't open for write, $!"; # OLD way, do not use!
gets yelled at for not using a lexical filehandle. As we all know,
open my $fh, ">", "file.txt" or die "Can'...
When I run a Perl script I get
Can't locate XML/LibXSLT.pm in @INC
So I try doing this in cpan:
cpan> install XML::LibXSLT
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Fri, 02 Oct 2009 13:28:24 GMT
Running install for module XML::LibXSLT
Running make for P/PA/PAJAS/XML-LibXSLT-1.68.ta...
I'm trying to connect to a web service using IO::Socket::INET (yes, I know that there are lots of better modules for doing this, but I don't have them and can't add them, so please don't suggest it), but I'm timing out (I think that's what it's doing) waiting for a response.
Here's the basic crux of my code (I previously populate the co...
A while back I was looking for a way to insert values into a text field through isql
and eventually found some load command that worked out for me.
It doesn't work when I try to execute it from Perl. I get a syntax error. I have tried two separate methods and both are not working so far.
I have the SQL statement variable print out at...
I am still new to Perl. Since BEGIN blocks are run during compilation can't a virus spread or data loss occur from simply compiling? Does Perl do anything to stop it? If so does it mean the code in BEGIN blocks may act differently outside of it?
...