perl.beginners
  Home FAQ Contact Sign in
perl.beginners only
 
Advanced search
July 2008
motuwethfrsasuw
 123456 27
78910111213 28
14151617181920 29
21222324252627 30
28293031    31
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
perl.beginners Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Re: Perl script doesnt behave well         


Author: Luke Devon
Date: Jul 14, 2008 23:52

Hi Rob

Thank you for all valuable informations. I tried all the steps you mentioned in the mail. All were success except only following lines.

my $sth = $dbh->prepare($query) or die $dbh->errstr;
$sth->execute($ip) or die $dbh->errstr;

if i add those lines in to the code , squid redirector doesnt work and gives following error message,

2008/07/15 14:26:46|
clientRedirectDone: 'http://www.goog.com'
2008/07/15 14:26:46| WARNING:
redirector #1 (FD 6) exited
anyway i again i wanted to monitor the behaviors of the perl code and i'll let you know the status. as you know , does mysql switch to a idle mode or sleep mode , coz just for testing i don't send many request at a time. just a single test request made for the servers.

Thank you
Luke

----- Original Message ----
From: Rob Dixon gmx.com>
To: Perl perl.org>
Cc: luke devon yahoo.com>
Sent: Monday, July 14, 2008 23:27:21
Subject: Re: Perl script doesnt behave well
Show full article (4.26Kb)
no comments
  Passing Variables to Perl through HTTP         


Author: Alice J. Wei
Date: Jul 14, 2008 14:59

Hi, Guys:

This may be a very dumb question, but I am having the problem of putting the variables on the url through Perl to get it to execute the following mkdir command.

#!/usr/bin/perl -w

use CGI qw(:standard -debug);
use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

$id = param('id');
$filename = "/var/www/html/hello";
if (-e $filename)
{
mkdir("/var/www/html/hello/$id", 0755) || print "Cannot create directory";
mkdir("/var/www/html/hello/$id/test", 0755) || print "Cannot create directory";
mkdir("/var/www/html/hello/$id/test2", 0755) || print "Cannot create directory";
}

else {

&createFile;
}

Basically, everything is working fine, except the fact that I have to do this through the Command line by pushing the value pairs to get my perl script to do things. I tried using http://192.168.10.63/file_linux.php?id=123, but it does not feed the id into the appropriate variable of where I want it to go to. Does anyone on the list know what is the simplest way for me to feed the variable into the url without extra hassle?

Thanks to anyone who can help.
Show full article (1.29Kb)
4 Comments
  constant in regular expression         


Author: William
Date: Jul 14, 2008 12:05

Hello, what is the syntax for having constant in regular expression ? Such as

use constant (NL => '\n');
#check if there is newline in the text
my $txt = "foo \n bar";
if($txt =~ m/
# ???
/x)
{

}

Thanks.

Send instant messages to your online friends http://uk.messenger.yahoo.com
2 Comments
  gmail         


Author: ChrisC
Date: Jul 14, 2008 11:36

Is it possible to access gmail from perl? If so, how would you go
about it?

Thanks,

Jerry
1 Comment
  One step substitution         


Author: Dermot
Date: Jul 14, 2008 11:10

Hi,

I am trying to build a hash(ref) and while doing so I want to remove
any white space from strings such as "1280 x 1024". So I have

my $record = {
contributor => $resolution,
....
};

Perhaps I am trying to be too clever but I thought I could do

my $record = {
contributor => $resolution =~ s/\s+//g,

But my value ends up as 2, the number of white space matches I guess.
Is this a question on context, scalar or list? Or is this sort of
assignment over-stretching things?

TIA,
Dp.
6 Comments
  PDF::API2, error "Can't call method "val".... when adding a picture to the PDF         


Author: ChrisC
Date: Jul 14, 2008 11:07

I am not sure what is going on. It works, then it does not? Is there
a solution for this? I have been able to find little to NO doc on
this.

use strict;
.
.
.
sub picture {
my $picture = shift;
my $xp = shift;
my $yp = shift;
my $sp = shift;

$photo->image( $pdf->image_jpeg( $picture ), $xp, $yp, $sp );
}

Thanks,

Jerry
1 Comment
  rename files in directory - help         


Author: Jet Speed
Date: Jul 14, 2008 09:04

Hi All,

I put togather few lines of code, I am looking to achieve the below

dir1 with file1, file2
dir2 with file1, file2

i want to copy the files from each of the directory to a third directory
dir3 as file1, file2 from dir1 and rename the file1 as file3 and file2 as
file4 from the dir2.

dir3 with file1,file2,file3,file4

Please let me know how to modify the below to achieve this. Thanks in
advance

#!/usr/bin/perl -w

# dir1 with file1, file2
# dir2 with file1, file2
# copy inot dir3 list of files file1, file2, file3, file4

use strict;
use warnings;
Show full article (1.02Kb)
2 Comments
  how to read the formatted data from the file?         


Author: Vikingy
Date: Jul 14, 2008 07:53

Hi all,

There is a file created likes this:

open File ">file.txt" or die $!;
foreach .. <..> {
printf File "%%5d %%11.2f\n", $data1,data2;
}
close File;

and my question is, how to read these data follow the same format as "%%5d %%11.2f' from this file again?
thanks in advance!

2008-07-14

The Key Lab of Complex Systems and Intelligence Science,
Institute of Automation,
Chinese Academy of Sciences.
9 Comments
  Re: Perl script doesnt behave well         


Author: Luke Devon
Date: Jul 14, 2008 06:00

could you please direct me how could I implement those steps in to the code ?

----- Original Message ----
From: Thomas Bätzler bringe.com>
To: Perl perl.org>
Cc: luke devon yahoo.com>
Sent: Monday, July 14, 2008 16:05:21
Subject: RE: Perl script doesnt behave well

luke devon yahoo.com> asked:
> I am using perl script to handle some function of squid
> redirector program . Actually its working fine. But after
> some time , that functions goes off. That's meant VALUE-A
> doesnt comes in to the request.

Is it possible that your script has lost the connection
to the database? From what I see of your code you don't
check the return value from $sth->execute.

You really should do that, and possibly use $dbh->ping()
at the head of the while loop to determine wether you
need to reconnect to your database.
Show full article (1.07Kb)
1 Comment
  RE: Perl script doesnt behave well         


Author: T Baetzler
Date: Jul 14, 2008 03:35

luke devon yahoo.com> asked:
> I am using perl script to handle some function of squid
> redirector program . Actually its working fine. But after
> some time , that functions goes off. That's meant VALUE-A
> doesnt comes in to the request.

Is it possible that your script has lost the connection
to the database? From what I see of your code you don't
check the return value from $sth->execute.

You really should do that, and possibly use $dbh->ping()
at the head of the while loop to determine wether you
need to reconnect to your database.

HTH,
Thomas
no comments
1 2