[21957] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4179 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 26 11:06:22 2002

Date: Tue, 26 Nov 2002 08:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 26 Nov 2002     Volume: 10 Number: 4179

Today's topics:
        Compiling perl for transportability (Max)
    Re: Compiling perl for transportability <spikey-wan@bigfoot.com>
    Re: File::Basename::fileparse: Problem extracting file  <tassilo.parseval@post.rwth-aachen.de>
    Re: File::Basename::fileparse: Problem extracting file  <jurgenex@hotmail.com>
    Re: get slow? if constructing html-page from several ht <pkent77tea@yahoo.com.tea>
        HELP! --> "Can't call method prepare!" (Hunter)
    Re: HELP! --> "Can't call method prepare!" <simon.oliver@umist.ac.uk>
    Re: IP and Host differences (Tad McClellan)
    Re: IP and Host differences news@roaima.freeserve.co.uk
    Re: matching a pattern from a text file into a Hash. (Tad McClellan)
    Re: matching a pattern from a text file into a Hash. (Tad McClellan)
    Re: mozilla & netscape.  incapable of CSS word-break ? (Tad McClellan)
    Re: mozilla & netscape.  incapable of CSS word-break ? <nobody@dev.null>
    Re: mozilla & netscape.  incapable of CSS word-break ? <jurgenex@hotmail.com>
    Re: Order of return trap <jurgenex@hotmail.com>
    Re: Order of return trap (Tad McClellan)
    Re: Perl Service App? <jurgenex@hotmail.com>
    Re: Perl Service App? <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 26 Nov 2002 06:08:43 -0800
From: pbarone@harris.com (Max)
Subject: Compiling perl for transportability
Message-Id: <b6a773.0211260608.1b97e23@posting.google.com>

Hi All,
  Is there a way to compile perl and assorted addons, Tk and DBI,
etc., so that I can move it to another machine(the same OS), into
another directory.
  For example, I compile perl in /opt1/perl580. The machine I am going
to install it on will not allow me to create a directory or a link in
root called /opt1. So what I would like to be able to do is tar that
distribution up and place on the other machine in /app/perl580 or
whatever.

I know this is a strange request but we deliver perl applications to
various sites and have to be able to put our support software
anywhere.

Thanks,


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

Date: Tue, 26 Nov 2002 15:23:06 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Compiling perl for transportability
Message-Id: <as03m7$ma8$1@newshost.mot.com>


"Max" <pbarone@harris.com> wrote in message
news:b6a773.0211260608.1b97e23@posting.google.com...
> Hi All,
>   Is there a way to compile perl and assorted addons, Tk and DBI,
> etc., so that I can move it to another machine(the same OS), into
> another directory.
>   For example, I compile perl in /opt1/perl580. The machine I am going
> to install it on will not allow me to create a directory or a link in
> root called /opt1. So what I would like to be able to do is tar that
> distribution up and place on the other machine in /app/perl580 or
> whatever.
>
> I know this is a strange request but we deliver perl applications to
> various sites and have to be able to put our support software
> anywhere.
>
> Thanks,

Yes. You can generate a self contained .exe file from your script. It will
run on machines without perl installed.

Programs to do this are:
perl2exe - you'll have to search for this.
perl dev kit from active state -
http://www.activestate.com/Products/Perl_Dev_Kit/

R.




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

Date: 26 Nov 2002 14:05:56 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: File::Basename::fileparse: Problem extracting file part
Message-Id: <arvv44$m5g$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Ronald Fischer:

> I would like to split a filename at the rightmost 'dot' position. i.e.
> 
>     ab/cd/ef.gh.ij
> 
> should be split into
> 
>    ab/cd ef.gh and ij
> 
> I have problems writing the correct pattern for the fileparse
> function: They always split
> to the first dot:
> 
>    print ((fileparse('ab/cd/ef.gh.ij','[.].+?'))[0],"\n");
> 
> outputs
> 
>   ef
> 
> and not, as I had hoped,
> 
>   ef.gh
> 
> I used non-greedy pattern matching, to consume the smallest amount of
> characters for the
> extension. IMO, this should be the correct way to do this. Am I wrong?
> In case you wonder:
> I have also tried the greedy pattern '[.].+', but it gives the same
> result (Of course, this is
> what I would expect in the greedy case,....).

You are doing it the wrong way around. From the documentation to
fileparse:

           [...]                   The remainder of the input file
           specification is then divided into "name" and "suffix"
           based on the optional patterns you specify in
           @suffixlist.  Each element of this list is interpreted
           as a regular expression, and is matched against the
           end of "name".  If this succeeds, the matching portion
           of name is removed and prepended to suffix.

That means you must come up with a pattern that only matches the
extension. Since the extension is at the end, your pattern should be
geared to the end of the string as well:

    fileparse('ab/cd/ef.gh.ij', '\.[^.]+$')

That means the pattern matches a dot only if all following characters up
to the end of the string do not contain another dot ( [^.]+$ ).
    
Tassilo
-- 
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;


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

Date: Tue, 26 Nov 2002 15:11:04 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: File::Basename::fileparse: Problem extracting file part
Message-Id: <caME9.595$qe.586@nwrddc03.gnilink.net>

Ronald Fischer wrote:
> I would like to split a filename at the rightmost 'dot' position. i.e.
>
>     ab/cd/ef.gh.ij
>
> should be split into
>
>    ab/cd ef.gh and ij
>
> I have problems writing the correct pattern for the fileparse
> function:

Maybe I'm totally wrong is isn't a split at the last dot the default
behaviour of fileparse if no pattern is given?

jue




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

Date: Tue, 26 Nov 2002 14:08:50 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: get slow? if constructing html-page from several html source files by perl script.
Message-Id: <pkent77tea-71AE02.14085126112002@news-text.blueyonder.co.uk>

In article <uu60nh9vg74556@corp.supernews.com>,
 "Palladium Solutions" <palladium@spinn.net> wrote:

> Why not use a solution like HTML::Mason from CPAN?
> Then you could embed the HTML files within others and serve via mod_perl?
> 
> "pkent" <pkent77tea@yahoo.com.tea> wrote in message
> news:pkent77tea-3C5FEC.02034426112002@news-text.blueyonder.co.uk...
> > In article <arui1c$t96$1@news1.kornet.net>,
> >  "Hyungjin Ahn" <ahj6@hotmail.com> wrote:

You asking me or ahj6@hotmail? ;-) Seriously though, the OP asked if 
HTML things were cached or not, and they aren't unless you use some 
software that does cache things. BTW, HTML::Mason and all that are a 
great set of modules and I would recommend they look at them, or similar 
templating systems on CPAN.

[ The caching module I mentioned is a generic perl data structure 
caching module - it can keep objects, strings... whatever, in core or on 
disk. In that sense it abstracts the concept of caching from the concept 
of assembling/instantiating a template object, and the code can be 
reused when we want to, for example, cache XSLTs, or config files.

Anayway, I benchmarked a mod_perl program that basically did 'open 
filehandle; while filehandle print; close filehandle' and it squirted 
out data 30% faster than Apache could serve a 5k-ish .shtml page. YMMV, 
of course]

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: 26 Nov 2002 07:30:46 -0800
From: dave_h4@yahoo.com (Hunter)
Subject: HELP! --> "Can't call method prepare!"
Message-Id: <27ad91d2.0211260730.45c78b7c@posting.google.com>

Hi Group -

I need to do an INSERT foreach line in a text file. There are only two
values in the files, separeted by |
The error I am getting is:
"Can't call method "prepare" on an undefined value at ./inputD.run line 52,
<ADDFILE> chunk 75."

Any help is GREATLY appreciated! dave

&connectPgDB();

# did I get a file on the command line ?
if ($ARGV[0] eq '-f') {

 open(ADDFILE, "<$input_file") || die $!;

 foreach $line (<ADDFILE>) {
  chomp $line;
  ($one, $two)=split(/\|/, $line);

   $sql = "INSERT INTO acronyms (acry, titl)
            VALUES ($one, $two)";

   $sth = $dbh->prepare($sql) || die "prepare: $stmt: $DBI::errstr";
   $sth->execute || die "execute: $sql: $DBI::errstr";

 }

} # end if for a passed file

  close ($ADDFILE);


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

Date: Tue, 26 Nov 2002 15:39:25 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: Hunter <dave_h4@yahoo.com>
Subject: Re: HELP! --> "Can't call method prepare!"
Message-Id: <3DE395AD.2010403@umist.ac.uk>

Hunter wrote:
> Hi Group -
> 
> I need to do an INSERT foreach line in a text file. There are only two
> values in the files, separeted by |
> The error I am getting is:
> "Can't call method "prepare" on an undefined value at ./inputD.run line 52,
> <ADDFILE> chunk 75."
This indicates that $dbh is undefined: not a database handle object.

The problem is either that you don't make a connection propoerly. 
Unfortunately, you didn't include the sub where you make the connection, 
&connectPgDB(); ?

-- 
   Simon Oliver



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

Date: Tue, 26 Nov 2002 09:03:25 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: IP and Host differences
Message-Id: <slrnau739t.38b.tadmc@magna.augustmail.com>

Marc Rasell <mrasell@hotmail.com> wrote:
> I'm working on a hit counter. In the logs I record date, IP and Host.
> Sometimes I can get the same IP and Date with a different Host name.
> I'm running the counter to records unique IP and Host per day. Would a
> different Host indicate with the same IP address on the same day
> indicate a new visitor? Why does the Host change? I thought IP and
> Host were supposed to be linked together?


What is your Perl question?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Nov 2002 15:42:55 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: IP and Host differences
Message-Id: <vp40sa.71m.ln@moldev.cmagroup.co.uk>


"Marc Rasell" <mrasell@hotmail.com> wrote in message news:df4cdf85.0211260400.389d4269@posting.google.com...
> I'm working on a hit counter. In the logs I record date, IP and Host.
> Sometimes I can get the same IP and Date with a different Host name.

> Why does the Host change?

robertbu <robertbu@hotmail.com> wrote:
> The requests are probably from private network, and what you are seeing is
> the gateway address.

Yes. For example, AOL has multiple gateways to the Internet, and each of
any AOL user's request can (and does) emmanate from any of the gateways.

> For example, there are four computers in our
> household with unique internal IP addresses all sharing a single external IP
> address.

No. In this case all four internal IP addresses will appear to the web
server as the single external IP address.

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Tue, 26 Nov 2002 07:45:04 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: matching a pattern from a text file into a Hash.
Message-Id: <slrnau6un0.35i.tadmc@magna.augustmail.com>

NF <nfallon@xilinx.com> wrote:

> I need to match a string pattern read in from a file like A_BCDEF or
                                                       ^^^^
> AB_CDEF.


What is it that is "alike" between the two?

You have not described what you want in enough detail for
us to be able to help you.

This will match the strings you describe:

   /A_BCDEF|AB_CDEF/


> I also need to get the next string in the file which is a decimal
                                                          ^
                                                          ^ 
> 0.101 1.111.

You imply a single floating point number, but that looks like
two numbers.

Is there one number following or more than one?


> I want to push these into a Hash.


push() does not work with hashes.

push() works on arrays.


> I then perform this on another file and compare the decimal values of
> the same string pattern from each file.
> 
> I'm presently trying to use split like this
> 
> my ( $item, @list ) = split(/\w_\w*/ , $_ );


I doubt that split() is the Right Tool for your job.

Why don't you just show us some actual data rather than
try (poorly) to describe it using English?


> push @{ $hash{$item}} , \@list;  # push ARRAY,LIST 


You appear to be using a 3-level data structure: a hash of
arrays of arrays.

From your vague description, it sounded like you want a 2-level
data structure...


> I cannot seem to pattern in split correct.


You have not given us enough information to be able to help you.

The devil is in the details when crafting pattern matches. We 
must know precisely what your data can look like, what criteria
is used to select the parts, and which of those parts you
want to capture.

Have you seen the Posting Guidelines that are posted here weekly?

   http://mail.augustmail.com/~tadmc/clpmisc.shtml


I'll make a WAG anyway though. Maybe this will do what you want:

   # if there is a single number (2D data structure)
   while ( /(\w+_\w+)\s+([0-9.]+)/g ) {
      push @{ $hash{$1}}, $2;
   }

or

   # if there may be multiple space-separated numbers (3D data structure)
   while ( /(\w+_\w+)\s+([0-9. ]+)/g ) {
      push @{ $hash{$1}}, [ split ' ', $2 ];
   }


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Nov 2002 08:16:03 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: matching a pattern from a text file into a Hash.
Message-Id: <slrnau70h3.35i.tadmc@magna.augustmail.com>

Niall Fallon <Niall.Fallon@xilinx.com> wrote:

> This is a multi-part message in MIME format.


Please do not post a multi-part message in MIME format.

Usenet is a plain text medium.


> But the strings I am extracting from the file could be any combimation of
> letters and numbers with an _ i.e. A_BCD , A_DCM, AD_DSDSDD etc.
              ^^^^^^^

I assume you meant "digit characters" there instead.

You are changing the specification, you didn't say anything
about digit chars being allowed in your OP.


> So I need to have a pattern match in the split function to match any of
> these possibilities.


You do not need (or want) the split function for that task.


> I also want split to return the complete string.
> I also want the first occurance of a decimal after the string.
> I  want to insert the string and the decimal into the Hash.
> e.g.
> The text file could be
> A_BCDEF    100.203   4000.33    12.56
> A_BDFEF    13.203   43.33    12.36
> AD_BCDEF    100.203   4000.33    12.56
> ..
> ADC_BDFEF    13.203   43.33    12.36


That is better, but still not good enough.

Can the first column be repeated with a different number?
If so, do you want to capture that additional number?

If so, then your test data should contain the first column being
repeated with a different number.

If not, then a plain hash would be good enough to store the
single number, and you wouldn't need multi-level data
structures at all.


> And all I want is all the strings of Letters and the first instance of the
> decimal for each string.
> i.e.
> A_BCDEF    100.203
> A_BDFEF    13.203
> AD_BCDEF    100.203
> ..
> ADC_BDFEF    13.203
> 
> in a Hast table.


If you keep changing the specification, you will use up all
of folk's goodwill before getting to a useable answer.

The quality of the answer you can expect is in direct proportion
to the quality of your problem specification.

It now appears that your not-so-careful description of what
the fields can contain was a red herring. Wouldn't just this:

   I want to capture the 1st two space-separated fields on the line.

be enough for what you want to do?

In that case, we don't need to know anything about what the
fields contain,

   my($item, $number) = split;

would be good enough for that.



[snip TOFU, please learn to quote properly]


I'll make yet another WAG, does this help?

---------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my %hash;
while ( <DATA> ) {
   if ( /^(\w+_\w+)\s+([0-9.]+)/ ) {
      push @{ $hash{$1} }, $2;
   }
}

print Dumper \%hash;

__DATA__
A_BCDEF    100.203   4000.33    12.56
A_BCDEF    100.000   4000.00    12.00   # repeated key
A_BDFEF    13.203   43.33    12.36
AD_BCDEF    100.203   4000.33    12.56
 ..                                      # skip lines that don't start with word char
ADC_BDFEF    13.203   43.33    12.36
ADC_234BD    13.203   43.33    12.36    # key contains digit chars
---------------------------------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Nov 2002 06:59:21 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: mozilla & netscape.  incapable of CSS word-break ?
Message-Id: <slrnau6s19.35i.tadmc@magna.augustmail.com>

Hyungjin Ahn <ahj6@hotmail.com> wrote:
> "Ian.H [dS]" <ian@WINDOZEdigiserv.net> wrote in message
> news:8dk6uugeraaogoi12mdurfjepp9s3c3798@4ax.com...
>> In a fit of excitement on Tue, 26 Nov 2002 16:18:42 +0900, "Hyungjin
>> Ahn" <ahj6@hotmail.com> managed to scribble:
>> > "J?gen Exner" <jurgenex@hotmail.com> wrote in message
>> > news:%6FE9.29077$hi6.11236@nwrddc02.gnilink.net...
>> > > Hyungjin Ahn wrote:


[snip question about browser behavior]


> I think I'm posting to comp.lang.perl.misc newsgroup, not to
> comp.lang.any_language_whatsoever newsgroup.


Yes, that is pretty much the point.

You are posting a browser question in the Perl newsgroup.

You should post browser questions in a browser newsgroup.


> If you want to share your 'cool script' written in PHP, you'd better visit
> php newsgroup and find someone who seeks 'cool script' in the very PHP
> newsgroup.


If you want to ask a question about browser behavior you'd better
visit a browser newsgroup:

      comp.infosystems.www.browsers.mac
      comp.infosystems.www.browsers.misc
      comp.infosystems.www.browsers.ms-windows
      comp.infosystems.www.browsers.x


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Nov 2002 15:24:57 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: mozilla & netscape.  incapable of CSS word-break ?
Message-Id: <3DE391FA.5050001@dev.null>



Tad McClellan wrote:

> Hyungjin Ahn <ahj6@hotmail.com> wrote TOFU:


What does TOFU mean here? I hope it's not a disparaging reference to the 
OP's East Asian sounding name :-)


>>they do have something to do with perl,
>>
> 
> 
> They do NOT have something to do with perl (nor with Perl).
> 
> If you switched to writing your programs in Java, then the
> above would _still_ be true.
> 
> It can't be "about Perl" if switching to something other
> than Perl changes nothing.


OK, I wrote this cool Perl program:

my $string="Hello World"
print $string;

When I tried to run it, perl was complaining of a "Syntax error". So I'm 
  thinking "Is this a Perl problem or not?" To test it, I switched to 
something other than Perl (BASIC) and I still got a "Syntax error". I 
suppose then that the problem with my cool program is not Perl-related.

Just messing with you, don't take me too seriously.




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

Date: Tue, 26 Nov 2002 16:00:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: mozilla & netscape.  incapable of CSS word-break ?
Message-Id: <rUME9.608$qe.244@nwrddc03.gnilink.net>

Hyungjin Ahn wrote:
> "J?gen Exner" <jurgenex@hotmail.com> wrote in message
> news:%6FE9.29077$hi6.11236@nwrddc02.gnilink.net...
>> Hyungjin Ahn wrote:
>> [...]
>>> Though I resolved the problem myself, I still want to know whether
>>> someone already made cool script to make word-break availble in
>>> mozilla & navigator.
>>
>> And in which way would this be related to Perl exactly?
>
> 'cool script' means 'well-operating perl source or module'.

Re-inserted text from an earlier post:
> I made perl code which calculate characters pixel width and insert spaces
or
> <br>s at the corner of table box for mozilla to break lines. It can
> calculate utf8's all the CJK chars include western europe chars. Now it
> works well except a few problems those I'm fixing.

How to render and layout text is determined by the browser only. Therefore
what you are asking for is impossible (in any language) without
re-implementing the browsers rendering engine.
And it's totally impossible when talking about a CGI application because
there the script can read neither the browser nor the system configuration
(ever thought of large system fonts and/or high contrast settings which can
change the layout drastically?).

jue




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

Date: Tue, 26 Nov 2002 15:17:42 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Order of return trap
Message-Id: <qgME9.600$qe.145@nwrddc03.gnilink.net>

Lars Eighner wrote:
>          It appears to me that if you return an array and a
>          reference, the array will swallow the reference (or
>          something).

The answer can be found in the documentation.
Excerpt from 'perldoc perlsub':
    The Perl model for function call and return values is simple: all
    functions are passed as parameters one single flat list of scalars, and
    all functions likewise return to their caller one single flat list of
    scalars. Any arrays or hashes in these call and return lists will
    collapse, losing their identities--but you may always use
    pass-by-reference instead to avoid this. [...]

jue




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

Date: Tue, 26 Nov 2002 09:01:23 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Order of return trap
Message-Id: <slrnau7363.38b.tadmc@magna.augustmail.com>

Lars Eighner <eighner@io.com> wrote:
>          It appears to me that if you return an array and a
>          reference, the array will swallow the reference (or
>          something).


Yes, that is what 

   perldoc perlsub 

says:

   If you return one or more aggregates (arrays and hashes), 
   these will be flattened together into one large 
   indistinguishable list.


>               I have just spent three horrible days convinced I could
>          not learn what a hash of a hash is or how to dereference
>          one.  I knocked my head against perlref and perldsc for
>          days.  


Have you seen the references tutorial?

   perldoc perlreftut


> Here are the simplified examples which finally
>          revealed the problem to me.  Is it a bug in perl or a bug in
>          me?

> #!/usr/bin/perl


You should ask for all the help you can get:

   #!/usr/bin/perl
   use strict;
   use warnings;


> $ref = &MakeHash;


You probably don't want to be calling the subroutine that way.

   my $ref = MakeHash();

(see perlsub again if you want to know the difference)


> print $ref->{a} . "\n";
> ($what, @ray, $aref ) = &MakeHoH;  #broke - @ray is before $aref.


> sub MakeHash {
> 
> $ahash{a} = "foo";


Global variables are bad.

You should avoid them whenever possible.


> ($what, $aref, @ray ) = &MakeHoH;  #fixed - $aref is before @ray


So you already know the solution to your problem.

If you do not want to change the order, then modify your subroutine 
to return a reference to and array rather than an actual array 
(which will be flattened into a "list").

   ($what, $rayref, $aref ) = MakeHoH(); 

You cannot return more than one array or hash from a Perl subroutine,
without losing the "boundary" between them.

You can return more than one reference to an array or hash though.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 26 Nov 2002 15:22:04 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl Service App?
Message-Id: <wkME9.602$qe.515@nwrddc03.gnilink.net>

Bob wrote:
> I want to run some code once every 30 or 60 seconds ish to do a bit of
> work on a Linux machine.
>
> I know I can use CRON to launch my program but is there another way to
> have the program run permanently in the background, just waking up
> periodically to do its job?

Sure. Please see 'perldoc -f sleep'. But be advised that there is no
automatic restart in case the script is terminated or hung for whatever
reason. Also timing will be imprecise: if the script runs 5 seconds and you
sleep 30 seconds then the delay between invocations will be 35 seconds. You
can compensate for it, but at least you need to take into consideration.

Therefore cron is really the way to go.

jue




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

Date: Tue, 26 Nov 2002 15:25:40 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Perl Service App?
Message-Id: <UnME9.603$qe.590@nwrddc03.gnilink.net>

Kevin Brownhill wrote:
> "Bob" <Bob@holiday.com> wrote in message
> news:Xns92D261EE4682Ethisismyidtoken@195.92.193.157...
 >> I want to run some code once every 30 or 60 seconds ish to do a bit
>> of work on a Linux machine.
>
> Why not set up a perl script on a home machine, using the LWP module,
> to call your script periodically.

Good idea to get around the ISP restrictions but depending upon the OPs
circumstances maybe not feasible (e.g. dialup connection or even worse
dialup where you have to pay for the phone connection by the minute).

jue




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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 V10 Issue 4179
***************************************


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