[15602] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3015 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 11 09:05:33 2000

Date: Thu, 11 May 2000 06:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958050311-v9-i3015@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 11 May 2000     Volume: 9 Number: 3015

Today's topics:
    Re: 'use integer' causes strange output.. <justin@comms81.freeserve.co.uk>
    Re: can scalars evaluate as operators? (Bart Lateur)
        cgi scripts and memory allocation <nospam@devnull.com>
    Re: Faster Access Time to Random Element (Randal L. Schwartz)
        gethostbyaddr (Roman Putyatin)
    Re: gethostbyaddr <andkaha@my-deja.com>
    Re: gethostbyaddr <s145333@stud.uni-goettingen.de>
    Re: gethostbyaddr (Bart Lateur)
    Re: How to delete one field in each line ? <billy@arnis-bsl.com>
    Re: How to delete one field in each line ? <koreags@thrunet.com>
        Minimum size of Perl-interpreter <Corno@dds%nospam%.nl>
    Re: Minimum size of Perl-interpreter (Bart Lateur)
    Re: Please check my 'random' code <ra_jones@my-deja.com>
    Re: printing to a winNT printer <gellyfish@gellyfish.com>
        read bios <marc.monney@he.admin.ch>
    Re: regular expression <andkaha@my-deja.com>
        Seeking a file <igorleal@dcc.ufmg.br>
        sorting algorithms, and precedence. <nospam@devnull.com>
    Re: sorting algorithms, and precedence. <billy@arnis-bsl.com>
        Still a double insert with DBI <huijgbv@casema.net>
        The way to load a script on certain time by itself ? <moltimer@yahoo.com>
    Re: The way to load a script on certain time by itself  <andkaha@my-deja.com>
    Re: The way to load a script on certain time by itself  <billy@arnis-bsl.com>
    Re: The way to load a script on certain time by itself  <phill@modulus.com.au>
    Re: The way to load a script on certain time by itself  <moltimer@yahoo.com>
        Using Modules Breaks "-w"? <morbus@disobey.com>
    Re: Using Modules Breaks "-w"? <phill@modulus.com.au>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 11 May 2000 13:03:55 +0100
From: "Justin Wyllie" <justin@comms81.freeserve.co.uk>
Subject: Re: 'use integer' causes strange output..
Message-Id: <8fe7sj$vu8$1@news8.svr.pol.co.uk>


Tom Phoenix <rootbeer@redcat.com> wrote in message
news:Pine.GSO.4.10.10005101159180.3921-100000@user2.teleport.com...
> On Wed, 10 May 2000, Justin Wyllie wrote:
>
> > I've got the following line in my code:
> >
> > use integer;
> >
> > This pragma (I'm none too sure what a pragma is I have to admit being
> > new to this) forces my calculations to return integer values eg. 8 / 3
> > results in 2 not 2.666667.
>
> A 'pragma' is a directive to the compiler, telling it something about your
> code.
>
> > This all works fine when I run my code under my active state port of
perl
> > for win32. But when  I run the same script, which contains this line, on
my
> > ISP's server (Linux) I get a scrambled result.
>
> > I am using CGI.pm as you probably guessed.
>
> Yes, I guessed that, but probably not for the reason you suspected! Using
> the Psi::ESP module, I can see from here that you're using the "named
> argument syntax" for calling some of the CGI module's functions. Due to a
> bug in older versions of Perl, there's a conflict between 'use integer'
> and the way that the named argument syntax works. (Technical information
> for those who are interested: A dash in front of a string is actually
> "negating" that string, and integer negation used code which didn't do
> this properly for strings.)
>
> You could fix this by upgrading the perl installation, but that may not be
> an option for you. The workaround is to quote the first named argument,
> like I've done in this code which calls the cgi_defrotz function, which is
> available in imaginary versions of CGI.pm.
>
>     my @fred = cgi_defrotz(
> '-name' => 'bedrock.html', # quotes around '-name'!
> value => 42,
> pet => 'dino',
>     );
>
> Cheers!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>

Hi Tom

Thanks for all that.

I had to put ' ' around all my named arguments; eg:

print $q->hidden('-name'=>'hol', '-default'=>'', '-override'=>1);

but this is I think because I have used the -arg approach each time while as
in your example above your 'value' argument does not have a preceding '-'.
One day I'll understand what is going on here!

thanks

sincerely

Justin Wyllie
email to: jwyllie81@cs.com








------------------------------

Date: Thu, 11 May 2000 11:43:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: can scalars evaluate as operators?
Message-Id: <391b9a89.8907077@news.skynet.be>

Eric Pement wrote:

>  Is there any way to coerce scalar variables to replace operators?
>Here's a highly-simplified way of expressing my question.
>
>
>    if ($both) {
>        $oper = "&&"
>    } else {
>        $oper = "||"
>    }
>    ....more code....

If you want a generic system, wrap the whole control structure into a
hash, with anonymous sub refs as the values. It's pretty fast, and the
code is limited to what is precompiled, so it's pretty safe too. For
example:

	%op = ( AND => sub { shift && shift },
		OR  => sub { shift || shift },
	);

	my $action = 'OR';
	my $op = $op{$action} or die "Action '$action' not implemented";
	for(0..3) {
            $a = $_ & 1;
            $b = $_ & 2;
	    if($op->($a,$b)) {
	        print "Yup for $a and $b ...\n";
	    } else {
	        print "Nope for $a and $b ...\n";
	    }
	}


Note that $op->($a, $b) is an indirect function call, same as:

	&{$op}($a,$b)

and no, $op and $op{$action} (%op) are not the same variable.

-- 
	Bart.


------------------------------

Date: 11 May 2000 10:34:20 GMT
From: The WebDragon <nospam@devnull.com>
Subject: cgi scripts and memory allocation
Message-Id: <8fe2bc$e04$0@216.155.33.41>

Interestingly, I had to 'assign more ram' to the .acgi app that MacPerl 
created in order to run this script adequately .. otherwise with map 
list segments over 500 maps long, I got a 'cgi internal server error' 

Do cgi scripts run on unix systems need to preallocate memory, or do 
they grab more if they need more, on the fly?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


------------------------------

Date: 11 May 2000 05:12:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Faster Access Time to Random Element
Message-Id: <m1wvl1b818.fsf@halfdome.holdit.com>

>>>>> "Jeff" == Jeff Zucker <jeff@vpservices.com> writes:

Jeff> I am not by any means knowledgeable about speed issues, but what about
Jeff> finding the size of the file, choosing a random bit from within the
Jeff> file, doing a binary read with a seek to that random position then
Jeff> finding the closest full line to that seek position.  No hash, no
Jeff> counter, nada!

That favors the longer lines.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: 11 May 2000 10:08:30 GMT
From: roman@jet.msk.su  (Roman Putyatin)
Subject: gethostbyaddr
Message-Id: <958039709.569704@tiger>

Hi all!

i have 4 nameservers ('name1','name2','name3','name4') in my net. how i can get
any hostname directly from nameserver 'name3'?

-- 
---
My software never has bugs. It just develops random features. 


------------------------------

Date: Thu, 11 May 2000 10:53:09 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: gethostbyaddr
Message-Id: <8fe3eh$k22$1@nnrp1.deja.com>

In article <958039709.569704@tiger>,
  roman@jet.msk.su  (Roman Putyatin) wrote:
> Hi all!
>
> i have 4 nameservers ('name1','name2','name3','name4') in my net. how
i can get
> any hostname directly from nameserver 'name3'?
>

The 'gethostbyaddr' will use whatever nameserver you have configured on
your system. It's the OS's responsibility to ask the nameservers for the
name of the ip, one by one until it gets a reply (you can't change
that).

To ask the nameserver directly you have to open up a connection to it
and send/recv the right data (someone else have to fill in the details
here...).


/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 13:50:02 +0200
From: Simone Liebenau <s145333@stud.uni-goettingen.de>
Subject: Re: gethostbyaddr
Message-Id: <391A9E6A.74512F98@stud.uni-goettingen.de>

Hi

you must use

Net::DNS

with 

$res = new::Net::DNS::Resolver

create a new object,

and then

$res->nameserver($ip);

makes $ip to the name server used for a query.

arne
Roman Putyatin wrote:
> 
> Hi all!
> 
> i have 4 nameservers ('name1','name2','name3','name4') in my net. how i can get
> any hostname directly from nameserver 'name3'?
> 
> --
> ---
> My software never has bugs. It just develops random features.


------------------------------

Date: Thu, 11 May 2000 11:53:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: gethostbyaddr
Message-Id: <391c9d74.9653782@news.skynet.be>

Andreas Kahari wrote:

>To ask the nameserver directly you have to open up a connection to it
>and send/recv the right data (someone else have to fill in the details
>here...).

	Net::DNS

See CPAN (<http://search.cpan.org/search?dist=Net-DNS>).

Is that enough detail? :-)

I must say, I only had a glance at this, and it looks really daunting...

-- 
	Bart.


------------------------------

Date: Thu, 11 May 2000 10:45:59 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: How to delete one field in each line ?
Message-Id: <8fe315$jhb$1@nnrp1.deja.com>

In article <8fdvro$f8m$1@news1.kornet.net>,
  "Joe" <koreags@thrunet.com> wrote:
> Hi,
>
> Will you please direct me this ?
>
> I want to delete one value in each line.
>
> These lines (split by \|)
> aaa|1111
> eee|2222
> ooo|3333
>
> To (delete first value together with split \|)
> 1111
> 2222
> 3333
>

#!/usr/bin/perl -w

use strict;

while (<DATA>)
{
     s/^.*?\|//;
     print;
}

__END__
aaa|1111
eee|2222
ooo|3333



Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 21:24:31 +0900
From: "Joe" <koreags@thrunet.com>
Subject: Re: How to delete one field in each line ?
Message-Id: <8fe8fh$8el$5@news2.kornet.net>

It works nothing, Somethings wrong with this ?
open(FILE, Day.txt") || die "I can't re-open Day.txt$!\n";
while (<FILE>) {
     s/^.*?\|//;
     print FILE;
}
close(FILE) ;


Ilja ÀÌ(°¡) <8fe315$jhb$1@nnrp1.deja.com> ¸Þ½ÃÁö¿¡¼­ ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>In article <8fdvro$f8m$1@news1.kornet.net>,
>  "Joe" <koreags@thrunet.com> wrote:
>> Hi,
>>
>> Will you please direct me this ?
>>
>> I want to delete one value in each line.
>>
>> These lines (split by \|)
>> aaa|1111
>> eee|2222
>> ooo|3333
>>
>> To (delete first value together with split \|)
>> 1111
>> 2222
>> 3333
>>
>
>#!/usr/bin/perl -w
>
>use strict;
>
>while (<DATA>)
>{
>     s/^.*?\|//;
>     print;
>}
>
>__END__
>aaa|1111
>eee|2222
>ooo|3333
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




------------------------------

Date: Thu, 11 May 2000 13:27:45 +0200
From: "Corno Schraverus" <Corno@dds%nospam%.nl>
Subject: Minimum size of Perl-interpreter
Message-Id: <8fe5g3$dcg$1@news1.xs4all.nl>

Hi all,

Could anyone give me an estimate on what the smallest size could be of an
compiled Perl-interpreter. We want to port Perl to an embedded OS (C) and
footprint is very very limited. The utmost maximum will be around 200k but
smaller would be preferrable.
Is there any chance of pulling this off? And what are issues we will have to
think about?

Corno




------------------------------

Date: Thu, 11 May 2000 12:00:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Minimum size of Perl-interpreter
Message-Id: <391d9f91.10194354@news.skynet.be>

Corno Schraverus wrote:

>Could anyone give me an estimate on what the smallest size could be of an
>compiled Perl-interpreter. We want to port Perl to an embedded OS (C) and
>footprint is very very limited. The utmost maximum will be around 200k but
>smaller would be preferrable.

Just to give you some idea: the executable from DJPERL for DOS (compiled
with GCC, AFAIK) version 5.005_02, is about 280k.

But that doesn't include any modules.

You could try looking at some older versions, like Perl4. This will be
smaller, but you'll be missing out on some of the things that make Perl
currently what it is: Perl5.

I'd look at other languages. Perhaps Lua?

	http://www.tecgraf.puc-rio.br/lua/


   Lua is a powerful, light-weight programming language designed for
   extending applications. Lua is also frequently used as a
   general-purpose, stand-alone language. 

   Lua combines simple procedural syntax (similar to Pascal) with
   powerful data description constructs based on associative arrays and
   extensible semantics. Lua is dynamically typed, interpreted from
   bytecodes, and has automatic memory management with garbage
   collection, making it ideal for configuration, scripting, and rapid
   prototyping. 


This surely sounds promising.

-- 
	Bart.


------------------------------

Date: Thu, 11 May 2000 10:07:45 GMT
From: ra jones <ra_jones@my-deja.com>
Subject: Re: Please check my 'random' code
Message-Id: <8fe0pa$h6p$1@nnrp1.deja.com>

In article <MPG.138330b45a65019a98aa48@nntp.hpl.hp.com>,
  Larry Rosler <lr@hpl.hp.com> wrote:
> In article <8fbddb$kcg$1@nnrp1.deja.com> on Wed, 10 May 2000 10:24:54
> GMT, ra jones <ra_jones@my-deja.com> says...
>
> It's best to leave attribution in here, rather than anonymous quotes.

> Them's my words.
Sorry about that, it was my mistake editing - I haven't got fully used
to this 'My Deja' system yet.

> I find the one line above easier to comprehend than the four lines in
> your original post.  But this is a matter of experience and taste,
> about wich there can be no arguing.
>
> There may be minor performance improvements in doing as few perl ops
> as needed in any computation.  But that can hardly matter here.
OK, thanks. I have substituted the new code and it seems to work well. I
can't say I understand the 'qw' bit (but that reflects my experience
questioned above ;-).

Many thanks for your help,
--
ra jones (posted via deja.com)

address for e-mail reply:
ra(dot)jones(at)cwcom(dot)net


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: 11 May 2000 06:54:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: printing to a winNT printer
Message-Id: <8fdhuj$25r$1@orpheus.gellyfish.com>

On Tue, 09 May 2000 14:06:01 -0700 Aaron wrote:
> I'm using perl32 on NT and want to send data to one of the printers
> installed on the local machine.  The physical printer
> is not plugged into the computer it is a jetdirect printer, but it is
> listed under mycomputer->pritners.  I've tried opening it
> by name but that just creates a file with the same name.  Any help you
> could provide would be great.
> 

open(PRINTER,">//computer/printer") || die "Can't open printer - $!\n";

print PRINTER "This is a test\n\f";

close PRINTER;

/J\
-- 
Mmmm...fuzzy.
-- 
fortune oscar homer


------------------------------

Date: Thu, 11 May 2000 12:15:09 +0200
From: "Marc Monney" <marc.monney@he.admin.ch>
Subject: read bios
Message-Id: <391a8835@fwsrva.bfi.admin.ch>

Hello,
since Perl I would like to go to read certain values in the bios. I have any
idea how to make, if somebody with already an end of program.
Greetings

--
Marc Monney

Marc.Monney@he.admin.ch




------------------------------

Date: Thu, 11 May 2000 10:40:04 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: regular expression
Message-Id: <8fe2m3$j0k$1@nnrp1.deja.com>

In article <391A785E.5F909F32@fh-wedel.de>,
  Nils <ii4533@fh-wedel.de> wrote:
[cut]
> anyone an idea? thanks nils
>
>

Idea: Make the .* non-greedy: /<!--\s*Back(:.*?)?\s*-->/

/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 09:34:44 -0300
From: Igor Campos Leal <igorleal@dcc.ufmg.br>
Subject: Seeking a file
Message-Id: <Pine.GSO.4.21.0005110926210.14294-100000@turmalina.dcc.ufmg.br>

	Hello everybody.
	I need to know how the function seek works. Its syntax is:
 seek FILEHANDLE, offset, origin.
	But I'm not shure how I'll do that.
	I wanna read a line of the file and, if a condition, seek the file
for one line up.
	How can I do that? Can I use offset with kline nmber?
	Waiting some help...

		/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
		\                                      /
		/           Igor Campos Leal           \
		\        Ciencia da Computacao         /
		/              DCC - UFMG              \
		\     e-mail:   igorleal@dcc.ufmg.br   /
		/	        igor@acesso.com.br     \
	        \             ICQ# 37936364            /
		/      				       \
		\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



------------------------------

Date: 11 May 2000 10:38:19 GMT
From: The WebDragon <nospam@devnull.com>
Subject: sorting algorithms, and precedence.
Message-Id: <8fe2ir$e04$1@216.155.33.41>

I'd like to be able to change the sort precedence if possible.. 

for example, sorting items that start with any non-alphanumeric 
character to the bottom (below Z) rather than the top (above A). 

can I also get sorting to ignore case? 

can I ALSO get sorting to ignore certain characters for the purpose of 
the sort? (many of these map names have a - after the game type (dm-map, 
dom-mapname, ctf-anothermap) but a few lazy authors forgot to include 
the - in the filename even though it DOES use it in the title. I'd like 
to ignore the - for the purposes of sorting, if possible. 

since the sorting is in a foreach my $var (sort(keys(%hash))) {} line, I 
am not sure whether this is possible or not. 

can anyone help?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


------------------------------

Date: Thu, 11 May 2000 11:21:54 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: sorting algorithms, and precedence.
Message-Id: <8fe548$lr6$1@nnrp1.deja.com>

In article <8fe2ir$e04$1@216.155.33.41>,
  The WebDragon <nospam@devnull.com> wrote:
> I'd like to be able to change the sort precedence if possible..
>
> for example, sorting items that start with any non-alphanumeric
> character to the bottom (below Z) rather than the top (above A).
>
> can I also get sorting to ignore case?
>
> can I ALSO get sorting to ignore certain characters for the purpose of
> the sort? (many of these map names have a - after the game type (dm-map,
> dom-mapname, ctf-anothermap) but a few lazy authors forgot to include
> the - in the filename even though it DOES use it in the title. I'd like
> to ignore the - for the purposes of sorting, if possible.
>
> since the sorting is in a foreach my $var (sort(keys(%hash))) {} line, I
> am not sure whether this is possible or not.
>
> can anyone help?
>

Sure you can help yourself.

1. perldoc -f sort
(or http://www.cpan.org/doc/manual/html/pod/perlfunc/sort.html)

2. perldoc perlfaq4 (or
http://www.cpan.org/doc/manual/html/pod/perlfaq4.html) You'll find FAQs like
"How do I sort an array by (anything)?", "How do I sort a hash (optionally by
value instead of key)?" and much more.

3. "Far More Than Everything You've Ever Wanted to Know About Sorting"
document at: http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html

Good luck.

Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 14:56:52 +0200
From: "Eric van Huijgevoort" <huijgbv@casema.net>
Subject: Still a double insert with DBI
Message-Id: <391aaea3$0$4761@reader5>

Earlier today a had a question about a double insert. After some changes the
the problem is still actual. Sometimes the insert goes for a few inserts
well and than for 30 inserts double. It seems that the instruction runs
twice because an higher ordernumber is inserted for the second time. Is
there maybe an instruction preventing running undermentioned code for the
second time or do you have an explanation for this problem? Every suggestion
is welcome.

<eval>
 use DBI;
 my $dbh=
DBI->connect("DBI:mysql:database:localhost","username","password",{'RaiseErr
or' =>  1});

 $sth = $dbh->prepare("SELECT max(list_id), max(ordernumber) FROM
orderlist");
 $sth->execute();
 @dataarr = $sth->fetchrow_array;
 $max_list_id=$dataarr[0];
 $max_ordernumber=$dataarr[1];
 $max_list_id++;
 $max_ordernumber++;

 foreach $product (sort keys %howmanyproducts)     {
 $dbh->do("INSERT INTO orderlist VALUES ($max_list_id, $max_ordernumber,
$howmanyproducts{$product}, '$product',
 systemideachproduct{$product}, '$statuseachproduct{$product}')");
 $max_list_id++;}

 $dbh->disconect;
</eval>

Thanks in advance, you can also mail me.

Erik van Huijgevoort
Holland
huijgbv@casema.net






------------------------------

Date: Thu, 11 May 2000 19:15:12 +0900
From: "Alex Moltimer" <moltimer@yahoo.com>
Subject: The way to load a script on certain time by itself ?
Message-Id: <8fe0f3$frj$1@news1.kornet.net>

How to make to load a script on certain time by itself ?
Thanks in advance.




------------------------------

Date: Thu, 11 May 2000 10:43:29 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: The way to load a script on certain time by itself ?
Message-Id: <8fe2sf$jfe$1@nnrp1.deja.com>

In article <8fe0f3$frj$1@news1.kornet.net>,
  "Alex Moltimer" <moltimer@yahoo.com> wrote:
> How to make to load a script on certain time by itself ?
> Thanks in advance.
>
>

On GNU/Linux or Unix systems you use cron. See the manual pages for
'cron' and 'crontab'.

/A

--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 10:51:24 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: The way to load a script on certain time by itself ?
Message-Id: <8fe3b9$jr0$1@nnrp1.deja.com>

In article <8fe0f3$frj$1@news1.kornet.net>,
  "Alex Moltimer" <moltimer@yahoo.com> wrote:
> How to make to load a script on certain time by itself ?
> Thanks in advance.
>

AFAIK the script cannot be loaded at certain time 'by itself'.
But your OS may do it for you.
This isn't a Perl-related question, IMHO you should read you OS manuals.

If the OS in question is Unix-like, then the following man pages will help:

man cron

man crontab

man at


Ilja.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 11 May 2000 21:22:54 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: The way to load a script on certain time by itself ?
Message-Id: <391A980E.5F5A@modulus.com.au>

Alex Moltimer wrote:
> 
> How to make to load a script on certain time by itself ?
> Thanks in advance.

OS = UNIX -> man cron

OS = NT -> help at

OS = Win98 -> help at ?

OS = Win 95 -> pmcron

sub pmcron{ #poor man's cron
	my $param = $_[0];
	my $delay;
	my @dreamOf = (
'aardvarks','actinium','beagles','berillium','cats','cobalt',
			'dysprosium','dromendaries','egrets','erbium','fur seals','fermium',
			'germanium','gnus','hafnium','humans','iguana','iridium',
			'gerbils','japonium','krypton','kaleidoscopes',
		
'lutetium','llamas','manatees','molybdenum','niobium','nanotechnological
elephants',
			'osmium','owls','praesodynium','parrots','quokkas','quilonium',
			'rhenium','rhesus monkeys','scandium','seals','tantalum','tapirs',
			'uranium','urdus','vanadium','vultures','wombats','wendium',
			'xenon','xylophones','yaks','yttrium','zebras','zirconium');
				sub usage{
					print "\n$0 cannot be started without command line parameters\n";
					print "\nUsage for the program is:\n";
					print "\nperl $0 hh:mm:ss\n";
					print "to start at the specified time or\n";
					print "\nperl $0 +hh:mm:ss\n";
					print "to start at the specified interval after the current time
or\n";
					print "\nperl $0 .\n";
					print "to start now (on the dot).\n";
					exit(1);
				}
	if (substr($param,0,1) eq '.'){
		$delay = 0;
	}
	elsif (substr($param,0,1) eq '+'){
		$param = substr($param,1,length($param) - 1);
		my ($hr, $min, $sec) = split(/:/,$param);
		$delay = $sec + ($min * 60) + ($hr * 3600);
	}
	elsif ($param =~ /(\d\d?):(\d\d?):(\d\d?)/){
		my $hr = $1;
		my $min = $2;
		my $sec = $3;
		
		my ($nowSec,$nowMin,$nowHr,undef,undef,undef,undef,undef,undef) =
localtime();
		my $epoch = $sec + ($min * 60) + ($hr * 3600);
		my $nowEpoch = $nowSec + ($nowMin * 60) + ($nowHr * 3600);
		if ($epoch > $nowEpoch){
			$delay = $epoch - $nowEpoch;
		}
		else{
			$delay = (24 * 60 * 60) - ($nowEpoch - $epoch);
		}
	}
	else{
		&usage();
	}
	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst) =
localtime(time + $delay);
	$year += 1900;
	$mon++;
	for ($sec, $min, $hour, $mday, $mon){
		if (/^\d$/){
			$_ = '0'.$_;
		}
	}
	if ($delay != 0){
		print "$0 is scheduled for execution at $hour:$min:$sec on
$mday/$mon/$year\n";
		print "Until then, I choose to dream of
",$dreamOf[rand(scalar(@dreamOf))],"...\n";
		sleep($delay);
	}
	print "$0 commenced execution ",&fileTime(time),"\n";
}
__END__
hth.
-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


------------------------------

Date: Thu, 11 May 2000 21:01:29 +0900
From: "Alex Moltimer" <moltimer@yahoo.com>
Subject: Re: The way to load a script on certain time by itself ?
Message-Id: <8fe6mc$oeq$1@news1.kornet.net>

I have unix(linux), and want abc.cgi file to be loaded at 16:50pm at every
day by itself.

I tried  crontab -e, but I got error to access my isp's root directory.
bash: /usr/bin/crontab: Permission denied

So, I should use something like OS = UNIX -> man cron like Peter Hill said.

Thanks




------------------------------

Date: Thu, 11 May 2000 06:59:00 -0400
From: Morbus Iff <morbus@disobey.com>
Subject: Using Modules Breaks "-w"?
Message-Id: <morbus-516E0E.06590011052000@news.totalnetnh.net>

Good day. I was doing some scripting for another fella - a simple little 
ditty that requires FTPing a file into a specific server. No big deal. I 
immediately turned to Net::FTP.

And the script works wonderfully, with one problem. When I use "-w", I 
get various warnings from various sucked in modules that Net::FTP uses. 
Various warnings about {index} being {"index"} and uninitialized values, 
and error in concatenation in Config.pm.

Stuff like that. I remove "-w" and everything works without a hitch. But 
it still bothers me. Why does this happen? Am I to expect this? My 
started lines were:

   #!/usr/bin/perl -w

   use Net::FTP;
   use strict;

   ...

Any help?

-- 
Morbus Iff
http://www.disobey.com/


------------------------------

Date: Thu, 11 May 2000 21:28:17 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: Using Modules Breaks "-w"?
Message-Id: <391A9951.4B2D@modulus.com.au>

Morbus Iff wrote:
> 
> Good day. I was doing some scripting for another fella - a simple little
> ditty that requires FTPing a file into a specific server. No big deal. I
> immediately turned to Net::FTP.
> 
> And the script works wonderfully, with one problem. When I use "-w", I
> get various warnings from various sucked in modules that Net::FTP uses.
> Various warnings about {index} being {"index"} and uninitialized values,
> and error in concatenation in Config.pm.
> 
> Stuff like that. I remove "-w" and everything works without a hitch. But
> it still bothers me. Why does this happen? Am I to expect this? My
> started lines were:
> 
>    #!/usr/bin/perl -w
> 
>    use Net::FTP;
>    use strict;
> 
>    ...
> 
> Any help?
> 
> --
> Morbus Iff
> http://www.disobey.com/


#! /bin/perl - w
use strict;
use Net::FTP;

no warnings, no problems; It is highly likely that the problems are in
your script (not published) not in the modules.
-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3015
**************************************


home help back first fref pref prev next nref lref last post