Re: No such file or directory

2008-05-21 Thread anthony brooke



- Original Message 
From: Jeff Peng <[EMAIL PROTECTED]>
To: Perl Beginners 
Sent: Wednesday, May 21, 2008 15:53:00
Subject: Re: No such file or directory

> open(RULES, 'rule.pl')

please use full path if you don't know where you are exactly.

On Wed, May 21, 2008 at 3:45 PM, anthony brooke <[EMAIL PROTECTED]> wrote:


-- 
Jeff Peng - [EMAIL PROTECTED]
Professional Squid supports in China
http://www.ChinaSquid.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


The problem is I am using mod_perl, wherever I am it always show "/" as the 
current working directory. I got to post the problem to 

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

Re: No such file or directory

2008-05-21 Thread anthony brooke





anthony brooke wrote:
> Hello, I know that this is a very common problem, but I am very sure that  
> the file exist in that directory, also its permission is -rwxrwxrwx , why 
> does it give such an error ? What are the other potential problems that cause 
> this ? Thanks
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com 
>  
Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


Also I am using mod_perl, is it because of that make my cwd become the top 
directory "/" ? Thanks

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

Re: No such file or directory

2008-05-21 Thread anthony brooke





anthony brooke wrote:
> Hello, I know that this is a very common problem, but I am very sure that  
> the file exist in that directory, also its permission is -rwxrwxrwx , why 
> does it give such an error ? What are the other potential problems that cause 
> this ? Thanks
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com 
>  
Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


open(RULES, 'rule.pl') || die "Could not open rule file 'rule.pl'. Error 
$!";
Could not open rule file 'rule.pl'. Error No such file or directory at 
/var/www/modperl//ParserGenerator.pm line 368.

Btw, why do I have double forward slash on that shown module ?

When I put these code in /var/www/modperl//ParserGenerator.pm
use Cwd;
die ">>".getcwd."<<";

[Wed May 21 15:17:46 2008] [error] >>/<< at 
/var/www/modperl//ParserGenerator.pm line 44.\n

I think I am confuse now.

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

No such file or directory

2008-05-20 Thread anthony brooke
Hello, I know that this is a very common problem, but I am very sure that  the 
file exist in that directory, also its permission is -rwxrwxrwx , why does it 
give such an error ? What are the other potential problems that cause this ? 
Thanks

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

Re: Initialize object permanently

2008-05-16 Thread anthony brooke
Thanks for the reply, it's a dynamic server side script that currently using 
CGI, but I am going for mod_perl. The interface is something like Google, so 
everytime the user make a request to lookup let's say the meaning of a word, 
the WordNet object have to be initialized. Is there a work around of this with 
mod_perl ? Thanks


- Original Message 
From: Rob Dixon <[EMAIL PROTECTED]>
To: beginner perl mailling list 
Cc: anthony brooke <[EMAIL PROTECTED]>
Sent: Saturday, May 17, 2008 0:47:52
Subject: Re: Initialize object permanently

anthony brooke wrote:
>
> Hello, I am using Wordnet::QueryData which allow access to a very huge 
> dictionary data. The initialization of object 
> my $wn = WordNet::QueryData->new;
> 
> took 
> 2 wallclock secs ( 2.36 usr +  0.07 sys =  2.43 CPU)
> 
> Then the subsequent request for the data is exetremely fast 
> 
> For the lines below took
> 0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
> 
> print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
>   print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
>   print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
>   print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
>   print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
>   print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
>   print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";
> 
> I
> am developing a web application, is there a way to make the
> initialization of object permanently in memory ? I tried to use the
> Storable module. But that only give me a little increase in
> performance. Anybody's idea is very much appreciated, Thank you.

When you say 'web application', do you mean a server-side CGI script or a
client-side program that interrogates the Web and also needs access to the
dictionary?

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/

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

Initialize object permanently

2008-05-16 Thread anthony brooke
Hello, I am using Wordnet::QueryData which allow access to a very huge 
dictionary data. The initialization of object 
my $wn = WordNet::QueryData->new;

took 
2 wallclock secs ( 2.36 usr +  0.07 sys =  2.43 CPU)

Then the subsequent request for the data is exetremely fast 

For the lines below took
0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)

print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
  print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
  print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
  print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
  print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
  print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
  print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";

I
am developing a web application, is there a way to make the
initialization of object permanently in memory ? I tried to use the
Storable module. But that only give me a little increase in
performance. Anybody's idea is very much appreciated, Thank you.


William

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

initialize data permanently

2008-05-14 Thread anthony brooke
Hello, I am using Wordnet::QueryData which allow access to a very huge 
dictionary data. The initialization of object 
 my $wn = WordNet::QueryData->new;

took 
2 wallclock secs ( 2.36 usr +  0.07 sys =  2.43 CPU)

Then the subsequent request for the data is exetremely fast 

For the lines below took
0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)

 print "Synset: ", join(", ", $wn->querySense("cat#n#7", "syns")), "\n";
  print "Hyponyms: ", join(", ", $wn->querySense("cat#n#1", "hypo")), "\n";
  print "Parts of Speech: ", join(", ", $wn->querySense("run")), "\n";
  print "Senses: ", join(", ", $wn->querySense("run#v")), "\n";
  print "Forms: ", join(", ", $wn->validForms("lay down#v")), "\n";
  print "Noun count: ", scalar($wn->listAllWords("noun")), "\n";
  print "Antonyms: ", join(", ", $wn->queryWord("dark#n#1", "ants")), "\n";

I am developing a web application, is there a way to make the initialization of 
object permanently in memory ? I tried to use the Storable module. But that 
only give me a little increase in performance. Anybody's idea is very much 
appreciated, Thank you.


William


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

Concatenate similar data in array

2008-04-16 Thread anthony brooke
Hello, my logic is really bad, here is I want to do. 

my @list = qw(a b a a d e e );

I want to compact the array by concatenating the adjacent vowels and consonant 
together, like for the above it should become,

my @list2 = qw(ab aa d ee);

How do I get the @list2 ? Thanks.




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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Fw: Perl maximum execution time

2008-04-14 Thread anthony brooke
Thanks, I am using Apache 2 and Opera browser. So you mean configure through my 
web server ? How if I run the code through the shell ?

- Original Message 
From: Jenda Krynicky <[EMAIL PROTECTED]>
To: beginner perl mailling list 
Sent: Monday, April 14, 2008 22:31:35
Subject: Re: Fw: Perl maximum execution time

From: anthony brooke <[EMAIL PROTECTED]>
> Thanks for the reply, but sometimes I don't know where is the code
> that cause the infinite loop. Is there such as thing as perl
> configuration file, to set the execution time for any code, any where
> in the program just like php.ini file. Thanks. 

Depends. Perl is not just for Web!

Most likely your webserver has some settings for this, but without 
knowing what server do you use we can't tell you where.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/






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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Fw: Perl maximum execution time

2008-04-14 Thread anthony brooke
Thanks for the reply, but sometimes I don't know where is the code that cause 
the infinite loop. Is there such as thing as perl configuration file, to set 
the execution time for any code, any where in the program just like php.ini 
file. Thanks.

- Original Message 
From: Chas. Owens <[EMAIL PROTECTED]>
To: Keenlearner <[EMAIL PROTECTED]>
Cc: beginners@perl.org
Sent: Friday, April 11, 2008 16:05:07
Subject: Re: Perl maximum execution time

On Thu, Apr 10, 2008 at 9:25 PM, Keenlearner <[EMAIL PROTECTED]> wrote:
> Hello, I have had been programming in PHP for a while, new to perl. I
>  got a perl code bug where it will go to infinite loop. So is there a
>  maximum execution time that I could set in perl just like in PHP ?
>  Thanks
snip

You can set an signal to go off after X seconds with the alarm* function:

#!/usr/bin/perl

use strict;
use warnings;

my $timeout = 5*60; #timeout after five minutes

eval {
local $SIG{ALRM} = sub { die "timeout\n" };
alarm $timeout;
#stuff you want to run in under five minutes
};
die unless $@ eq "timeout\n" if $@;

* http://perldoc.perl.org/functions/alarm.html

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/






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




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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Perl Serialize object as string

2008-04-06 Thread anthony brooke
Thanks for the reply, I always thought that Dumper is used for debugging 
purposes, I will look at it deeper. Btw, what you mean by cyclic data ?



- Original Message 
From: Chas. Owens <[EMAIL PROTECTED]>
To: anthony brooke <[EMAIL PROTECTED]>
Cc: beginner perl mailling list 
Sent: Monday, April 7, 2008 2:09:0-1
Subject: Re: Perl Serialize object as string

On Sun, Apr 6, 2008 at 1:52 PM, anthony brooke <[EMAIL PROTECTED]> wrote:
> Hello everyone, I need to serialize an perl object to STRING TEXT,
> not scalar or file. The Storable module allow serialization to file and
> scalar variable, but this is not possible for passing between the perl
> and prolog program, that's why I need it to be string. I tried out the
> FreezeThaw module but it couldn't serialize object successfully, or
> have ever done it ? Thanks.

If you don't have cyclic data you can use Data::Dumper*, but I would
suggest looking at YAML::Syck* instead.

* http://perldoc.perl.org/Data/Dumper.html
** http://search.cpan.org/dist/YAML-Syck/lib/YAML/Syck.pm

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.


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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Perl Serialize object as string

2008-04-06 Thread anthony brooke
Hello everyone, I need to serialize an perl object to STRING TEXT, not scalar 
or file. The Storable module allow serialization to file and scalar variable, 
but this is not possible for passing between the perl and prolog program, 
that's why I need it to be string. I tried out the FreezeThaw module but it 
couldn't serialize object successfully, or have ever done it ? Thanks.


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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




locate install C code module

2008-04-02 Thread anthony brooke
I had installed the Language::Prolog::Yaswi from 
http://search.cpan.org/~salva/Language-Prolog-Yaswi-0.14/Yaswi.pm
 but it is in C code implementation, normally when I install a perl module, it 
should be located at /usr/local/share/perl/5.8.8

but I can't see where is the  Language::Prolog::Yaswi folder.

Also, does anyone have the resources to understand how to link the C code with 
perl ? Thanks.


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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Install CPAN module in shared hosting

2008-03-28 Thread anthony brooke
Hello, 

I like to install CPAN modulike like AI::Prolog, I have the Cpanel that have 
CPAN module installer, but my shared hosting does not allow some modules to be 
installed like this AI::Prolog, what can I do ? Should I install it in my 
computer first and then copy the PM files to my web host directory and use the 
"use lib" to include my cpan module. Is there a better way ? Thanks.


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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/