Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Chat Server and Time Delay (http://www.velocityreviews.com/forums/t886285-chat-server-and-time-delay.html)

Brian 05-04-2004 09:37 PM

Chat Server and Time Delay
 
Hi All

It's been a little while since I did some Perl coding
and the questions I have are a little over my head.
I need to write 2 scripts..........

First one sits on a server and runs without being called
from a browser. It's job is to check the time, and if
the time = X then do Y. basically I want a script that
is going to clear a MySQL Db at 4 am every day

The second is way over my head, in short I need
what is going to work like a chat server. The idea
is I have a windows based program (witting in Delphi)
that talks to a script, other uses of this program will
also will also log on. The program will create messages
and send them to the server script and in turn the
script will send that message to all the other programs
As I say just like a chat server except the messages are
done via the program and not the user
I have found a script on the net at
http://hotwired.lycos.com/webmonkey/...tw=programming
but can't get it to work and don't really understand it.
Can anybody point me in the right direction or have
some example code?

Brian






Mark Clements 05-05-2004 09:58 AM

Re: Chat Server and Time Delay
 
Brian wrote:

> First one sits on a server and runs without being called
> from a browser. It's job is to check the time, and if
> the time = X then do Y. basically I want a script that
> is going to clear a MySQL Db at 4 am every day

use cron, or the equivalent on windows (Scheduled Tasks?). This will automatically execute a
specified command according to whatever schedule you set.

>
> The second is way over my head, in short I need
> what is going to work like a chat server. The idea

<snip description of how client/server chat system works>

> I have found a script on the net at
> http://hotwired.lycos.com/webmonkey/...tw=programming
> but can't get it to work and don't really understand it.

If you don't understand it then you're probably biting off more than you can chew. A quick look
at it shows that it seems to cover the main points quite well, though I haven't tested it. There
is a similar example in one of the books, though can't remember if it's the cookbook or
Programming Perl (they're at home).

Mark

Ben Morrow 05-05-2004 10:07 AM

Re: Chat Server and Time Delay
 

Quoth Mark Clements <mark.clements@kcl.ac.uk>:
> Brian wrote:
>
> > First one sits on a server and runs without being called
> > from a browser. It's job is to check the time, and if
> > the time = X then do Y. basically I want a script that
> > is going to clear a MySQL Db at 4 am every day

>
> use cron, or the equivalent on windows (Scheduled Tasks?). This will
> automatically execute a specified command according to whatever schedule you
> set.


We seem to be getting this quite a lot atm. Would it be worth writing a
faq answer?

Ben

--
$.=1;*g=sub{print@_};sub r($$\$){my($w,$x,$y)=@_;for(keys%$x){/main/&&next;*p=$
$x{$_};/(\w)::$/&&(r($w.$1,$x.$_,$y),next);$y eq\$p&&&g("$w$_")}};sub t{for(@_)
{$f&&($_||&g(" "));$f=1;r"","::",$_;$_&&&g(chr(0012))}};t # ben@morrow.me.uk
$J::u::s::t, $a::n::o::t::h::e::r, $P::e::r::l, $h::a::c::k::e::r, $.

David K. Wall 05-05-2004 01:55 PM

Re: Chat Server and Time Delay
 
Ben Morrow <usenet@morrow.me.uk> wrote:

> Quoth Mark Clements <mark.clements@kcl.ac.uk>:
>> Brian wrote:
>>
>> > First one sits on a server and runs without being called
>> > from a browser. It's job is to check the time, and if
>> > the time = X then do Y. basically I want a script that
>> > is going to clear a MySQL Db at 4 am every day

>>
>> use cron, or the equivalent on windows (Scheduled Tasks?). This
>> will automatically execute a specified command according to
>> whatever schedule you set.

>
> We seem to be getting this quite a lot atm. Would it be worth
> writing a faq answer?


It's not really a Perl problem, though, is it? Even if someone were to
write a "canned" response for it, I very much doubt it would be added
to the "official" Perl FAQ list. And what more can you say besides "use
cron or the equivalent on your OS"?


Mark Clements 05-05-2004 02:07 PM

Re: Chat Server and Time Delay
 
David K. Wall wrote:

>>>use cron, or the equivalent on windows (Scheduled Tasks?). This
>>>will automatically execute a specified command according to
>>>whatever schedule you set.

>>We seem to be getting this quite a lot atm. Would it be worth
>>writing a faq answer?

> It's not really a Perl problem, though, is it? Even if someone were to
> write a "canned" response for it, I very much doubt it would be added
> to the "official" Perl FAQ list. And what more can you say besides "use
> cron or the equivalent on your OS"?

As you say, it isn't really a Perl problem, but it is a faq for the list and therefore probably
worthwhile. It could come under a section called somethings like "these aren't Perl questions
but here's how you solve them." It may give posters a hint as to what constitutes a non-Perl
question. That being said, you can lead a horse to water, but you can't make it drink.

Mark


All times are GMT. The time now is 11:34 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.