[17603] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5023 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 4 03:05:34 2000

Date: Mon, 4 Dec 2000 00:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975917109-v9-i5023@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 4 Dec 2000     Volume: 9 Number: 5023

Today's topics:
    Re: Dates, times and Perl <lembark@wrkhors.com>
    Re: Dates, times and Perl (Logan Shaw)
    Re: flock under Solaris behaves strangely <ronald_f@my-deja.com>
    Re: Grappling wth space <lembark@wrkhors.com>
        Help! How can a process know its own PID? <Liang.Tang@nrj.ericsson.se>
    Re: Help! How can a process know its own PID? (Sam Holden)
    Re: Help! How can a process know its own PID? <lembark@wrkhors.com>
    Re: How to do 'sort -u' with Perl for windows? (Logan Shaw)
    Re: Newbie questions on MOVE (B.A.)
    Re: one question about perl return value <wangwei18@163.net>
    Re: Printing to System Que <lembark@wrkhors.com>
    Re: Printing to System Que (Logan Shaw)
    Re: Regex multiline html (Tony)
        regex prob: /(.*)-$1/ in perl 5.6 mrsmith01@my-deja.com
    Re: regular expression help <ddb@crystal.uwa.edu.au>
    Re: regular expression help <lembark@wrkhors.com>
    Re: Retrieving Files from a Linux Parition to DOS/NT <mtn_view@sirius.com>
    Re: SAMS-Perl in 24hrs <lembark@wrkhors.com>
    Re: Sort <johngros@Spam.bigpond.net.au>
        timeout for ftp client tlynch001@my-deja.com
    Re: timeout for ftp client <lembark@wrkhors.com>
    Re: Using goto (Bart Lidofsky)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 04 Dec 2000 00:48:12 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: Dates, times and Perl
Message-Id: <3A2B3E2C.660EEA49@wrkhors.com>


> Just a very quick question - I'm running a site on a US-based server, I'm
> actually in the UK as are most of my visitors. My question is, is it
> possible to easily convert a date/time to GMT (it's currently PST) so that I
> can accurately display it on my site?

$ENV{TZ} = WHATEVER;  in your code or 
export TZ=YOURTIMEZONEHERE; in your .profile or whatever.

times on *nix are normally stored ref to GMT/UCT/Zulu and displayed
based on the current timezone.

e.g., notice the hour difference:

  DB<1> $ENV{TZ} = 'EST5EDT';

  DB<2> x localtime(time)
0  57
1  45
2  1  <-
3  4
4  11
5  100
6  1
7  338
8  0
  DB<3> $ENV{TZ} = 'CST6CDT'

  DB<4> x localtime(time)
0  14
1  46
2  0  <-
3  4
4  11
5  100
6  1
7  338
8  0
  DB<5> 

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: 4 Dec 2000 00:57:47 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Dates, times and Perl
Message-Id: <90ff9b$oi$1@boomer.cs.utexas.edu>

In article <90dr52$3au$1@neptunium.btinternet.com>,
Tony Bronze <ttiger@lineone.net> wrote:
>> On Sun, 3 Dec 2000 15:03:12 -0000, "Colin Polonowski"
>> <colin@dvdtimes.co.uk> wrote:
>> >actually in the UK as are most of my visitors. My question is, is it
>> >possible to easily convert a date/time to GMT (it's currently PST) so
>that I
>> >can accurately display it on my site?
>
>Either that or add or subtract a time difference before displaying the final
>time

The problem with that approach is that it will apply the local
timezone's daylight savings time rules to the zone you're trying to
display in.  This could lead to all kinds of problems, from the time
being wrong for a few hours on just two days a year (during the
transition) to the time being wrong for a full half of the year.

It's much better just to pick the time zone you actually want and then
do "$ENV{TZ} = 'GB';" or whatever so that the localtime() function
suddenly starts operating in your timezone instead of the system
default one.

  - Logan


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

Date: Mon, 04 Dec 2000 06:48:50 GMT
From: Ronny <ronald_f@my-deja.com>
Subject: Re: flock under Solaris behaves strangely
Message-Id: <90feoi$b4g$1@nnrp1.deja.com>

In article <u9bsuwghjz.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:
> Ronny <ronald_f@my-deja.com> writes:

> > unless ($fl)
> > {
> >     print "flock failed: $fl\n";
> > }
> >
> > Strangely, it never goes to 'flock failed'. For instance, when I
start
> > this program in one xterm window and, while it sleeps, start another
> > copy in another window, flock returns 0 in *both* cases.
>
> I do not understand what makes you say flock() returns 0 if it never
> gets to 'flock failed'.

Sorry, a typo. I wanted to say "returns 1 in both cases".

Ronald
--
Ronald Fischer <ronald_f@my-deja.com>
http://profiles.yahoo.com/ronny_fischer/


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


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

Date: Mon, 04 Dec 2000 00:58:53 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: Grappling wth space
Message-Id: <3A2B40AD.DACFBBF5@wrkhors.com>

Blstone77 wrote:
> 
> Hello, can anyone help me with this problem I am having with spaces in a
> string? I have a string which contains keywords. I get rid of spaces from the
> beginning and end using this:
> 
>   for ($Keywords) {
>        s/^\s+//;
>        s/\s+$//;
>    }
> 
> I also get rid of commas between keywords the same substitution way. The
> problem is, some people put multiple spaces between keywords, and rather than a
> string like
> 
> Big Furry things and fruit
> 
>   I get..
> 
> Big  Fuzzy      things   and fruit
> 
> What I am looking for is a way to eliminate all spaces that take up more than
> one character postition. How can I do this and can it besimply  incorporated
> into the code above? Thanks for any help on this.


add:

	s/\s+/ /g;	# replace internals with a space

handles tabs, etc.

if you are trying to extract the words to handle them as keywords
it might be simpler to just grab the words w/ split:

	my @wordz = split /\s+/, $userinput;

saves you from dealing with the space at all.


-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: Mon, 04 Dec 2000 15:02:57 +0900
From: Liang Tang <Liang.Tang@nrj.ericsson.se>
Subject: Help! How can a process know its own PID?
Message-Id: <3A2B3391.4F1219E3@nrj.ericsson.se>

Hi, friends,
This is a simple question, maybe. Please help.
How can a process know its own PID (process ID)? I remembered there is a
function "getpid()" in C, but I can only find getppid() in Perl, which
returns the PID of the parent process. This is really strange.
Your help ....  Thank you very much.

Donald




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

Date: 4 Dec 2000 06:15:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help! How can a process know its own PID?
Message-Id: <slrn92mdja.bab.sholden@pgrad.cs.usyd.edu.au>

On Mon, 04 Dec 2000 15:02:57 +0900,
	Liang Tang <Liang.Tang@nrj.ericsson.se> wrote:
>Hi, friends,
>This is a simple question, maybe. Please help.
>How can a process know its own PID (process ID)? I remembered there is a
>function "getpid()" in C, but I can only find getppid() in Perl, which
>returns the PID of the parent process. This is really strange.
>Your help ....  Thank you very much.

Check the perlvar documentation...

man perlvar, perldoc perlvar, look at the web page... depending
on where you are...

You are interested in $$

-- 
Sam Holden



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

Date: Mon, 04 Dec 2000 00:30:20 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: Help! How can a process know its own PID?
Message-Id: <3A2B39FC.87669CE0@wrkhors.com>

Liang Tang wrote:
> 
> Hi, friends,
> This is a simple question, maybe. Please help.
> How can a process know its own PID (process ID)? I remembered there is a
> function "getpid()" in C, but I can only find getppid() in Perl, which
> returns the PID of the parent process. This is really strange.
> Your help ....  Thank you very much.
> 
> Donald

$$ -- same as the shell.

see the special var's section of camel.

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: 3 Dec 2000 23:48:06 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How to do 'sort -u' with Perl for windows?
Message-Id: <90fb6m$30$1@boomer.cs.utexas.edu>

In article <975902166.439730@news.aei.ca>, DH <huyv@usa.net> wrote:
>I would like to have the equivalent of Unix command  'sort  -u' to run  on
>windows.
>
>Is it long to do it with Perl for Windows?

Here you go:

	#! /usr/local/bin/perl -w

	use strict;

	use vars '%x';

	while (<>)
		{ $x{$_} = 1; }

	print sort keys %x;

Enjoy.

  - Logan


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

Date: Sun, 3 Dec 2000 23:09:53 -0700
From: silvius@uswest.net (B.A.)
Subject: Re: Newbie questions on MOVE
Message-Id: <MPG.1494e31d74358dee989680@news.uswest.net>

Thank You.



In article <3A29CC43.5CE9B6C4@acm.org>, krahnj@acm.org says...
> "B.A." wrote:
> > 
> > How do you move directories?  I'm trying to learn Perl on Win32.  TIA
> > 
> > I tried using the
> > 
> > use File::Copy;
> > 
> > move ("dir1", "dir2");
> > 
> >       and
> > 
> > move ("/dir1", "/dir2");
> 
> $ perldoc -f rename
> =item rename OLDNAME,NEWNAME
> 
> Changes the name of a file.  Returns C<1> for success, C<0> otherwise.
> Behavior of this function varies wildly depending on your system
> implementation.  For example, it will usually not work across file
> system
> boundaries, even though the system I<mv> command sometimes compensates
> for this.  Other restrictions include whether it works on directories,
> open files, or pre-existing files.  Check L<perlport> and either the
> rename(2) manpage or equivalent system documentation for details.
> 
> John
> 




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

Date: Mon, 04 Dec 2000 00:11:53 -0500
From: WEI WANG <wangwei18@163.net>
Subject: Re: one question about perl return value
Message-Id: <3A2B2798.70C6DA91@163.net>

thanks, your answer gave me clear idea.

Bill

fallenang3l@my-deja.com wrote:

> In article <3A252FFE.844E14B9@hotmail.com>,
>   Bill Wang <wangbill18@hotmail.com> wrote:
> > This is a multi-part message in MIME format.
> > --------------2102C99B27BF6879706C3859
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
> >
> > How to use perl to return server time, then treat the time as a start
> > time, so I can use javascript to display a clock.
> >
> > --------------2102C99B27BF6879706C3859
> > Content-Type: text/x-vcard; charset=us-ascii;
> >  name="wangbill18.vcf"
> > Content-Transfer-Encoding: 7bit
> > Content-Description: Card for Bill Wang
> > Content-Disposition: attachment;
> >  filename="wangbill18.vcf"
> >
> > begin:vcard
> > n:Hurston;Pam
> > tel;fax:850 644 9763
> > tel;work:850 644 5772
> > x-mozilla-html:FALSE
> > adr:;;;;;;
> > version:2.1
> > email;internet:hurston@lis.fsu.edu
> > fn:Pam Hurston
> > end:vcard
> >
> > --------------2102C99B27BF6879706C3859--
> >
> >
>
> A: You can use Perl to send a cookie with the time so that javascript
> can retrieve it and do some processing and display a clock.
>
> B: Have Perl print a JavaScript snippet with a variable containg the
> server time so that JavaScript can get that value and display the clock.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Mon, 04 Dec 2000 00:33:20 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: Printing to System Que
Message-Id: <3A2B3AB0.C81A38B9@wrkhors.com>

Rudy Hermawan wrote:
> 
> Greetings,
> 
> Pls guide me to print to system queue.
> 
> My code is printing directly to the local printer.
> 
> =========
> 
> open (STDPRT, ">/dev/lp0");
> 
> print STDPRT "This will be printed directly to the port.....";
> 
> close (STDPRT);
> 
> =========
> 
> Regards
> 
> Rudy Hermawan


open FOO, "| lpr"

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: 4 Dec 2000 00:51:44 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Printing to System Que
Message-Id: <90feu0$nh$1@boomer.cs.utexas.edu>

In article <slrn92ig0k.hvd.efflandt@efflandt.xnet.com>,
David Efflandt <efflandt@xnet.com> wrote:
>On Sat, 02 Dec 2000, Rudy Hermawan <rhermawan@kafelinux.com> wrote:
>>Pls guide me to print to system queue.
>>
>>My code is printing directly to the local printer.
>
>open (PRN, "| /usr/bin/lpr") || die "Can't print: $!";

That won't work on all systems:

	$ uname -sr
	SunOS 5.8
	$ file /usr/bin/lpr
	/usr/bin/lpr:   cannot open: No such file or directory
	$ type lpr
	/usr/ucb/lpr
	$ 

It would be better to just not give the path at all and let the shell
find it from the user's PATH variable.

Actually, on Solaris, it would be better to use "lp" instead of "lpr",
but even that depends because some people will install things like
LPRng so that you find that regular "lpr" and "lp" don't work.

In other words, the *best* thing is to have a reasonable default on
most OSes, and then to allow the user to override the command too.

  - Logan


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

Date: Mon, 04 Dec 2000 07:44:35 GMT
From: tony@bigpond.com (Tony)
Subject: Re: Regex multiline html
Message-Id: <slrn92mnb7.1ho.tony@debian.aua1.com>

On Mon, 04 Dec 2000 02:19:36 GMT, Vinny Murphy
<VincentMurphy@mediaone.net> wrote:
>
>   Tony> Hi
>
>   Tony> Have been trying to remove five lines in one chunk from
>   Tony> html pages. Single lines are no problem but need to
>   Tony> remove their following <BR> tags also. Removing the <BR>
>
>you probably want to use the range operator ...  
>
>print while <DATA>;		# show all output.
>print '-' x 72, "\n";
>while ( <DATA> ) {
>  #            BEGIN TOKEN    ...      END TOKEN
>  next if /\# remove from here/ ... /\# to here .*$/;
>  # notice the three dots. ------^
>  print;
>}

Thanks Vinny, got it working with your suggestion.
Never even thought of doing it that way.
Tony


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

Date: Mon, 04 Dec 2000 05:04:00 GMT
From: mrsmith01@my-deja.com
Subject: regex prob: /(.*)-$1/ in perl 5.6
Message-Id: <90f8jv$708$1@nnrp1.deja.com>

Hi all,

Sorry if this is really simple/irrelevant/common
or whatever, but i can't seem to work it out.

I've just upgraded perl 5.005 => 5.6, and now
have got a bunch of broken code to fix up. One
such problem is using $1, $2's etc within //. For
example, when reading "SGML" into a hash:

if( $linein =~ m{<(\w+)>(.*)</$1>} ) { $sgml{$1}
= $2 }

eg. "<name>Fred</name>"    =>    $sgml{name}
= "Fred"

Obviously this used to work, but now doesn't
match. How can i do it in perl 5.6?

Thanks.

- Brae


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


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

Date: Mon, 04 Dec 2000 13:07:19 +0800
From: Douglas du Boulay <ddb@crystal.uwa.edu.au>
Subject: Re: regular expression help
Message-Id: <3A2B2687.75EF96D2@crystal.uwa.edu.au>

Bob Walton wrote:


> It looks like you'll need to break it into two statements:  one that
> finds the character count, and another that does the match.  Maybe
> something like:
> 
> $h='5habcdegarbage3hcatxxxx3hdogxxx';
> while(1){
>    last unless my $n=$h=~/(\d+)h/i;
>    last unless $h=~s/\d+h(.{$n})/$1/i;
>    print "h is now:$h\n";
> }
> 

> Note that that won't do a very good job of detecting valid Fortran
> syntax.  For example, the statement:

Thanks Bob,

For the record I am just trying to modify fortran format statements
and I can isolate those by matching on "label format(" 
So what you have suggested would work perfectly well for what I need to
do. 

I was just expecting that it was me being ignorant
about the true workings of the regexp ?{} functionality that 
was holding me back, and that a one liner like this was feasable: 
   s/(\d+)h(.{?{eval \1}})/\"$2\"/ig ;

I will probably have to parse the whole format statement in any case
but I thought this would give me a head start.

Thanks again
Doug


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

Date: Mon, 04 Dec 2000 00:41:31 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: regular expression help
Message-Id: <3A2B3C9B.24B4374A@wrkhors.com>

Douglas du Boulay wrote:
> 
> In fortran the hollerith format descriptor is of form
> 
>         xxhxx_arbitrary_characters
> 
> where xx is an integer number of characters,
> the subsequent 'h' implies what follows is a character string
> and xx arbitrary characters follow. (additional characters may
> exist beyond the final 's' but they should be preserved intact)
> 
> What i wanted was a simple conversion of
> 
> xxhxx_arbitrary_characters  into "xx_arbitrary_characters"
> 
> I thought I could do this with something simple like:
> 
>   s/(\d+)h(.{\1})/\"$2\"/ig ;
> 
> but apparently not.
> How do I convert \1 to a numerical value on the fly ?
> My experiments with evaluations ?{ \1} were not
> a great success.
> 
> thanks
> Doug


you might be able to get by w/ the /e switch and use perl code in 
the substitution.  this would use the matched string in a numeric
context but would probably be slow(er).

you might want to take a shot at Parse::RecDescent and just use a 
small parser on the hollerith strings, code would look something
like:

	my $parser = P::R->new( blah );

	...

	$string = $parser->parse( $string ) if $string =~ /$looks_like_hollerith/;

the P::R object definition will be a bit more verbose than a 
regular expression but look quite a bit less like line noise
if you have to maintain it :-)
	

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: Sun, 03 Dec 2000 23:07:07 -0800
From: Wayne Watson <mtn_view@sirius.com>
Subject: Re: Retrieving Files from a Linux Parition to DOS/NT
Message-Id: <3A2B429B.33C90528@sirius.com>

Let me simplify the question. I do believe Perl has an open statement to get to a disk drive. When I
last programmed in Perl on Unix some years ago, I recall being able to open a directory. Probably
something like open("/mydirectory", ...). I would expect DOS/NT to have something similar. For
example, open("C:",...) or something like open("E:\folderX"). Maybe there's something like
open("LinuxExt:H", ...). Once the directory is open it is then very easy to recursively work one's
way through subdirectories and the files contained in each directory. So the question is how does
one open a DOS folder in DOS/NT, and more to my particular concern, how does one open a Linux
extension found on DOS/NT disk? open(/dev/hda3,...) ????

If my question goes unanswered for a few days, I will post it to a Linux or NT newsgroup.

Chris Fedde wrote:

> In article <3A2A5A31.6DAC682@sirius.com>,
> Wayne Watson  <mtn_view@sirius.com> wrote:
> >A  few years ago I had Linux and NT running together and somehow
> >clobbered Linux. That is, I can no
> >longer boot Linux. However, I have a Linux partition that contains some
> >useful Perl scripts and a
> >number of very useful C programs.Although I had put them on a tape, it
> >is now very difficult to get
> >them from the tape. I would like to  write a perl script to access the
> >partition and rumble through
> >the filesystem there to pick off the source files and put them into a
> >DOS/NT partition. I have no
> >idea whether I can somehow selectively grab the partition. I imagine
> >(hope!) there's a file or
> >partition open statement that gets me to the partition I'd like to
> >search. Is what I'm asking
> >possible?
> >
>
> Perhaps your question could be better answered by posting it to a group
> that has Microsoft, NT, Linux, or clueless somewhere in it's name.
>
> Good Luck
> chris
> --
>     This space intentionally left blank

--
                              "It's better to wear out than rust out"
                                 -- Theodore Roosevelt, 26th U.S. President

                                            Wayne T. Watson




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

Date: Mon, 04 Dec 2000 00:53:23 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: SAMS-Perl in 24hrs
Message-Id: <3A2B3F63.D19B7424@wrkhors.com>


> Running an excersise in the book (p.53) for Prime numbers. The following
> errors are encountered:

might want to check if there is a TPJ review of the book.  they
usually note if the examples have coding errors.  something 
freudian wants me to believe i did see a review and that this
book has errors.

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: Mon, 04 Dec 2000 05:14:19 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Sort
Message-Id: <LKFW5.3386$xW4.32187@news-server.bigpond.net.au>

If you split the number from the front of the string you can do a numeric
comparison.
"Daniel J. Brill" <brill@hfhmn.org> wrote in message
news:3A2A8D8B.394AF98D@hfhmn.org...
> Dear John,
>
> One solution is to enter your data differently in your db.  If you enter 1
> as 01 and 2 as 02, then this will force your list to sort as 01, 02, 03,
> ... 09, 10.  If your list will go past 100, then enter 1 as 001.  If it
> will go past 1,000, then enter 1 as 0001, etc.
>
> If you are entering your data with Excel, a very common situation, this
can
> be a real pain because Excel doesn't like to have leading zeros.  You need
> to set the column format to text, as opposed to a number format.  It will
> then take 01.  However, you can't do any computations with the number
> because it isn't a number -- its text.  Thankfully perl doesn't care.
>
> Dan
>
> jtjohnston wrote:
>
> > I'm using this to sort the lines in a db file. The problem is each line
> > begins with a number.
> >
> > When the number is below 10, it sorts like this:
> >
> > 1       asdasd
> > 10      asdasd
> > 2       asdasda
> > 3       wsfdsdfs
> >
> > etc
> >
> > I would like to sort so that it would come out like:
> >
> > 1       asdasd
> > 2       asdasda
> > 3       wsfdsdfs
> > 10      asdasd
> >
> > What do I have to do differently?
> >
> > Thanks,
> >
> > John
> >
> > ---------snip----------
> >
> > foreach $key (sort keys %DB){
> > ($db_contact_name, $db_email, $db_title, $db_url, $db_desc,
> > $db_keywords, $db_hits, $db_flag, $db_date, $db_time)
> > = split (/\t/, $DB{$key});
> >
> > #...etc here I print html code
> > }
>




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

Date: Mon, 04 Dec 2000 05:35:24 GMT
From: tlynch001@my-deja.com
Subject: timeout for ftp client
Message-Id: <90faes$89m$1@nnrp1.deja.com>



What's the best way to 'timeout' and exit an FTP client if it doesn't
receive any communication from the server after 10 seconds?

Running under Unix.

Thanks,

-tl



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


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

Date: Mon, 04 Dec 2000 00:32:54 -0600
From: Steven Lembark <lembark@wrkhors.com>
Subject: Re: timeout for ftp client
Message-Id: <3A2B3A96.B9BFEDCC@wrkhors.com>

tlynch001@my-deja.com wrote:
> 
> What's the best way to 'timeout' and exit an FTP client if it doesn't
> receive any communication from the server after 10 seconds?
> 
> Running under Unix.
> 
> Thanks,
> 
> -tl
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

alarm w/ handler.

looks like:

	$SIG{ALRM} = sub { what do do about it };

or

	$SIG{ALRM} = \&abortsub;

then 

	alarm 10;

	do_something;

	alarm 0;

will call your sub in 10 sec if do_something doesn't return
and re-set the alarm.

-- 
 Steven Lembark                                   2930 W. Palmer St.
                                                 Chicago, IL  60647
 lembark@wrkhors.com                                   800-762-1582


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

Date: Mon, 04 Dec 2000 05:14:43 GMT
From: bartl@sprynet.com (Bart Lidofsky)
Subject: Re: Using goto
Message-Id: <3a2b2827.190124081@news.escape.com>

On Sat, 2 Dec 2000 09:34:09 -0500, tadmc@metronet.com (Tad McClellan)
wrote:
>>Yes. Rereading the camel it said (something like) for maintainability
>>gotos should be avoided.
>
>
>There is nothing Perl-specific about gotos.
>
>Gotos are "bad" in any language.

	That sure puts a crimp in assembly language programming....

	Bart Lidofsky



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

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 5023
**************************************


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