[8156] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1774 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 30 21:07:34 1998

Date: Fri, 30 Jan 98 18:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 30 Jan 1998     Volume: 8 Number: 1774

Today's topics:
    Re: Another "uninitialized variable" problem ()
        automated posting via forms with LWP, HTTP, ... <"|\\|0$PAMchrisf"@ks.uiuc.edu>
    Re: Behavior of NaN and Infinity are system dependent (Chip Salzenberg)
    Re: Compiling regexs for efficency <ebohlman@netcom.com>
    Re: daemonizing -- value of setpgrp()? (Earl Hood)
    Re: daemonizing -- value of setpgrp()? (Chip Salzenberg)
    Re: Don't forget the Perl Journal (was Re: Good place t <joseph@5sigma.com>
    Re: Don't use signal handlers (was Re: Child processes) (Chip Salzenberg)
    Re: Don't use signal handlers (was Re: Child processes) (Chip Salzenberg)
    Re: Don't use signal handlers (was Re: Child processes) <joseph@5sigma.com>
        easy question about ARGV <dwu@svcam.amd.com>
    Re: easy question about ARGV (Craig Berry)
    Re: easy question about ARGV <joseph@5sigma.com>
    Re: Error executing Perl script (Tad McClellan)
        File Locking: why not use fcntl? <mlevy@uvic.ca>
        Forcing 7-digit number? <anthony@outshine.com>
    Re: Forcing 7-digit number? <anthony@outshine.com>
    Re: Forcing 7-digit number? (Craig Berry)
        gnuplot=freeware GIF creation <dgoddard@us.oracle.com>
    Re: Help: h2ph and perl include files <sgordon@athena.lbl.gov>
        HTTP::is_success not found <KlausRusch@atmedia.net>
    Re: loading page after cgi call causes path problems. (David Efflandt)
        Locking files <berub00@DMI.USherb.CA>
    Re: Locking files <dgoddard@us.oracle.com>
    Re: modulo operator <aas@sn.no>
    Re: Re-using STDIN (Earl Hood)
    Re: Really Stupid Question (Tad McClellan)
        Sort::Fields[Re: Help with SORT] <joseph@5sigma.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 31 Jan 1998 01:08:29 GMT
From: faverNoSpam@austin.ibm.com ()
Subject: Re: Another "uninitialized variable" problem
Message-Id: <6attid$gde$2@ausnews.austin.ibm.com>

Greg Andrews (gerg@shell.) wrote:
: ged@fortec.tuwien.ac.at writes:
: >
: >i tried the following for quick and dirty testing:
: >
: >$fence_bits="00000";
: >print $fence_bits."\n";
: >$fence_bits = ($fence_bits | "10000");
: >print $fence_bits."\n";
: >
: >and the output is:
: >
: >00000
: >Use of unitialized value at test.pl line 3.
: >10000
: >
: >so $fence_bits is initialized and in the next line uninitialized???
: >

: It's the quotes around 10000, probably interacting with the
: parentheses.

: If you change the above to:

:     $fence_bits="00000";
:     print $fence_bits."\n";
:     $fence_bits |= "10000";
:     print $fence_bits."\n";

: or
:     $fence_bits=00000;
:     print $fence_bits."\n";
:     $fence_bits = ($fence_bits | 10000);
:     print $fence_bits."\n";


  I'd like to that everyone for all the help.
  Removing the parentheses and putting an extra space between
  the quote and the bracket like:

  if ($xnode_num eq "1")
       { $fence_bits |= "10000" }

  solved my problem.  Seems I was the victim of multiple errors.
  First, the error message pointed to the wrong line.  Next,
  the parser doesn't seem to like the quote being immediately adjacent
  to the paren.

  Dave


--


My views are my own, and not necessarily those of my employer.


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

Date: Fri, 30 Jan 1998 18:00:47 -0600
From: "Who knows..." <"|\\|0$PAMchrisf"@ks.uiuc.edu>
Subject: automated posting via forms with LWP, HTTP, ...
Message-Id: <34D269AF.48992E34@ks.uiuc.edu>

I am trying to post automatically in HTML-forms. E.g. I wnat to make an
automated AltaVista search (looking for 'blah') I thought about like
this:

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

use LWP::UserAgent;
$ua = new LWP::UserAgent;

my $req = new HTTP::Request
'GET','http://www.altavista.digital.com/cgi-bin/query/';
$req->content_type('application/x-www-form-urlencoded');
$req->content('pg=q&what=web&kl=XX&q=blah');

my $res = $ua->request($req);
print $res->as_string;

Doesn't work. I only get to the query-page and don't get query-results.
Do I miss something (either code or query-options)?

thanks
    Christian

PS: Remove the fancy 'NOSPAM' to send e-mail.

--
Note: People who are sending uninvited solicitations by email to me accept
following terms stated in http://www.ks.uiuc.edu/~chrisf/spam.html.





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

Date: Fri, 30 Jan 1998 23:05:08 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Behavior of NaN and Infinity are system dependent
Message-Id: <6atme6$ch4$1@cyprus.atlantic.net>

Time had long run out on 5.004 before I thought to address this.
We should have put it into the traps doc.  Sorry.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Fri, 30 Jan 1998 22:44:26 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Compiling regexs for efficency
Message-Id: <ebohlmanEnMCI2.AKp@netcom.com>

Jerome O'Neil <joneil@cks.ssd.k12.wa.us> wrote:
: After grepping the perlop and perlre pages, I am a bit confused as to
: the use of regexs in loops, and how they are compiled.  The prelre
: document discusses a /o operator that can be used with s///
: (s/PATTERN/REPLACEMENT/) to cause it to only compile once.  The prelre
: document refers you to this for "...a description on how to use regular
: expressions with matching and substitution...).

: So, having said that, can you use /o on a normal expression?  It doesn't
: cause me any grief in my code, but I was curious if it had any effect?

It has no effect.  If a regular expression doesn't contain any 
interpolated variables, it's compiled the first time it's seen and never 
recompiled.  Perl only recompiles regular expressions if they contain 
interpolated variables; the /o switch tells it not to do this and stick 
with the result of the first compilation.


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

Date: 30 Jan 1998 23:04:43 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: daemonizing -- value of setpgrp()?
Message-Id: <6atmab$629@news.service.uci.edu>
Keywords: daemon setpgrp TIOCNOTTY

In article <david-2901982225230001@prokofiev.cnation.com>,
David Alan Pisoni <david@cnation.com> wrote:

>I looked in the Perl FAQ, and it stated
>that using the TIOCNOTTY ioctl on /dev/tty, and closing the STDERR,
>STDOUT, and STDIN pipes would effectively daemonize the process.  But when
>I looked back in some of my old code, I was using setpgrp() to achieve
>this state.  Is that a deprecated methodology?

I use setsid().  It is part of the POSIX module.  setsid has the
effect of detaching from the controlling terminal.  I am not
clear on what is the "prefered" method, but U just copied the
method used in the R Stevens APUE.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Fri, 30 Jan 1998 23:16:15 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: daemonizing -- value of setpgrp()?
Message-Id: <6atn3g$cjd$1@cyprus.atlantic.net>

According to jdporter@min.net:
>David Alan Pisoni wrote:
>> that using the TIOCNOTTY ioctl on /dev/tty, and closing the STDERR,
>> STDOUT, and STDIN pipes would effectively daemonize the process.  But when
>> I looked back in some of my old code, I was using setpgrp() to achieve
>> this state. 
>
>setpgrp() seems to be a BSD-oriented function, which means that it is
>undependably available on SysV systems, such as Solaris.

Actually, that's not quite true.  SysV systems have setpgrp(), but it's
a version with no parameters, unlike the BSD function of the same name
(which was a STUPID thing for the BSD people to do! but I digress).

The semantics of SysV's setpgrp() are perverse.  But, hey, it's SysV.
I'm not familiar with the semantics of BSD's setpgrp().  Perl's setpgrp()
takes two arguments; if they're (0,0) then it'll probably work (for
some definition of 'work') on all UNIX-like systems.

POSIX invented setsid() and setpgid() to paper over the mess.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Fri, 30 Jan 1998 18:16:04 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Don't forget the Perl Journal (was Re: Good place to start in Perl 5)
Message-Id: <34D27AC5.EA7205CE@5sigma.com>

Jonathan King wrote:

> >    Programming Perl
> >    Advanced Perl Programming
> 
> These two, especially the first, are really, really, important for
> any serious perl programmer.  Buy them if you're even tempted.
> 
> HOWEVER (and I do mean to shout here),  I was really *pissed* at the
> number of typos and other flaky things that turned up in my copies
> of these books.  

As an author of one of the books Tom recommended but which you
didn't list :-), I have to say that I can't fault a book for a few
errors in its first printing, especially now that I have perspective
on how how hard it was to purge them from *my* book.  I have a list 
of errata that is a little longer than I expected.  The manuscript 
was reviewed by several well known Perl authors and developers.  I 
ran every line of source code that I possibly could.  I read and 
re-read the manuscript myself God only knows how many times.  The
book was copyedited and subsequently proofread in its entirety.
Still, I have a list of a dozen or so goofs, most of which were
sent to me by readers in early to mid January.  I know how much
care and attention went into trying to keep errors out of my
book, and my conclusion is that a few in a first printing are not
a big deal and, so far as I can see, unavoidable.

A book that has errors lasting into later printings -- now that's
a different animal.  Or a book that has *lots* of errors, or errors
that look like lapses in understanding rather than just writing
or editing goofs.

	-joseph

--
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Fri, 30 Jan 1998 22:53:24 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6atlnn$cfb$1@cyprus.atlantic.net>

According to steve.tolkin@fmr.com:
>Chip Salzenberg wrote:
>> I've creatd a patch for reliable signals, but because it
>> incurs a 3% performance penalty (though modifying the main Perl
>> operation loop) it hasn't been incorporated into official Perl....
>
>For 3% ?!

Larry has his priorities.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Fri, 30 Jan 1998 22:55:10 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6atlrv$cfu$1@cyprus.atlantic.net>

According to ilya@math.ohio-state.edu (Ilya Zakharevich):
>Not only this, but also semantic change (the handlers will be delayed,
>what is not always possible - consider SIGCHLD and SIGSEGV).

There's no point in writing a SEGV handler in Perl.

The semantics of SIGCHLD _were_ handled in the patch -- they required
special coding, which was done.

What's missing isn't tuits, but approval.
-- 
Chip Salzenberg               - a.k.a. -                <chip@pobox.com>
    Like Perl?  Want to help out?  The Perl Institute: www.perl.org
           ->  Ask me about Perl training and consulting  <-
             "It's the lemon zester of death!!"   // MST3K


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

Date: Fri, 30 Jan 1998 18:23:44 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <34D27C91.40FD463A@5sigma.com>

I will also point out that the microprocessor industry gives us
an average 3% performance improvement in less time than was spent 
arguing about this on p5p.  I forget; I think this was Larry's call
and my superficial observation is that it was a bad one.

	-joseph

Steven Tolkin wrote:
> 
> For 3% ?!
> 
> Chip Salzenberg wrote:
> 
> > ...I repeat, with feeling: IT DOES NOT WORK CONSISTENTLY.  I know this
> > for a fact.  I've creatd a patch for reliable signals, but because it
> > incurs a 3% performance penalty (though modifying the main Perl
> > operation loop) it hasn't been incorporated into official Perl....
> 
> I am very curious about this.  A 3% performance hit, even if it affects
> every Perl programm even those not using signals, is really quite small in
> exchange for correct behavior!  Who decided this should not be
> incorporated? [...]

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Fri, 30 Jan 1998 17:56:51 -0600
From: CS44 Personel <dwu@svcam.amd.com>
Subject: easy question about ARGV
Message-Id: <34D268C3.4C85@svcam.amd.com>

ok this is a pretty basci question so bear with me.
I'm reading in a file from one location on my unix system.
And printing the contents to another location.  Heres my code.
open (guesthandle2 , "/usr/printtwo.html"):
open (guesthandle2 , "/var/blah/printfrom.log");
while (<guesthandle3>) {
print guesthandle2;
(location for needed instruction)
}
Anyway i want to save the last line printed from the file
printfrom.log.
I have tried @a = @ARGV;
and then print @a at the end of the program.
If anyone can provide any help it would be greatly appreciated.


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

Date: 31 Jan 1998 00:42:12 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: easy question about ARGV
Message-Id: <6ats14$b6u$1@marina.cinenet.net>

CS44 Personel (dwu@svcam.amd.com) wrote:
: ok this is a pretty basci question so bear with me.
: I'm reading in a file from one location on my unix system.
: And printing the contents to another location.  Heres my code.

: open (guesthandle2 , "/usr/printtwo.html"):
: open (guesthandle2 , "/var/blah/printfrom.log");

Forgot to run with -w enabled (I'm nearly certain).  Forgot to check for 
success on open (e.g. open(FOO, '<bar') or die $!).  Did not follow 
recommended practice of naming filehandles in ALL CAPS.  Syntax error at
end of first line (: rather than ;).  Both opens name the same filehandle 
(guesthandle2); I'm guessing the second one is supposed to end with 3.  
Both files are opened (implicitly) in read mode; presumably you meant the 
first(?) one to be in write mode.  Oh, and this is a nit, but there's no 
need for double-quoted (interpolating) strings in your filename arguments 
to open; single-quotes would probably be prefered here.

Wow, that's a lot of mistakes to pack into two lines! :)

: while (<guesthandle3>) {
: print guesthandle2;

Can't print to guesthandle2, as you opened it in read-only mode.

: (location for needed instruction)
: }

Indenting the statements in a block makes your code easier to read.

: Anyway i want to save the last line printed from the file
: printfrom.log.

Save it to what/where?

If you added '$lastline = $_' in your 'location of needed instruction'
position, then $lastline would contain the last line read on exit from the
while loop. 

: I have tried @a = @ARGV;
: and then print @a at the end of the program.

What does the list of arguments on the program's command line have to do 
with anything you've said above?

: If anyone can provide any help it would be greatly appreciated.

My suggestions:

* Post your actual running code next time.  If necessary, craft a
  short example that highlights your problem area.  Cut&paste or
  read it directly into your News editor.

* Always always _always_ use the -w switch.  Add a #! first line to
  make it painless.

* When you repost with the above done, be clearer about precisely what
  you're trying to accomplish.

Good luck!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 30 Jan 1998 18:27:25 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: easy question about ARGV
Message-Id: <34D27D6E.9AAB9282@5sigma.com>

I would say don't even pick that nit.  Using double quotes 
on ordinary strings is perfectly acceptable style.  It's
"$filename" that is worth arguing about.

	-joseph 

Craig Berry wrote:
> Oh, and this is a nit, but there's no
> need for double-quoted (interpolating) strings in your filename arguments
> to open; single-quotes would probably be prefered here.

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: Fri, 30 Jan 1998 19:24:55 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Error executing Perl script
Message-Id: <7huta6.vr3.ln@localhost>

Hans Van Lint (hvanlint@lodestar.be) wrote:

: I made a script file for a customer and put it online on our provider's
: server and it worked fine.

: Our customer has put it online on his provider's server and when they try to
: execute the script from there they get the following error:

: ExecCGI Error : No valid exec mapping found.

: Does anyone know what this error means and how it can be fixed??


So where is your perl question? This is the Perl newsgroup you know.

I don't see any perl code.

I don't see any perl error messages.


I expect you would have much better luck with a CGI/server question
in a newsgroup that is in some way connected to CGI/server stuff...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jan 1998 17:03:54 -0800
From: mlevy <mlevy@uvic.ca>
Subject: File Locking: why not use fcntl?
Message-Id: <34D2787A.789EDE16@uvic.ca>

flock is a useful function, but it doesn't always work across NFS
systems.
In particular, my httpd runs on a different machine than the machine
that has my files. The Perl FAQ suggests as a solution a re-installation

of Perl to force flock to use fcntl. My question is, why doesn't the
FAQ suggest the direct use of fcntl? For example:

use Fcntl;
    @list = (F_WRLCK,0,0,0,0); # exclusive write lock, entire file
    $struct = pack("SSLLL",@list);
    fcntl(FILE,&F_SETLKW,$struct) or die("cannot lock because: $!\n");

You can unlock the file by closing it, or by another fcntl call. This
code seems
to work for me, although it is not as nice as flock for reasons given
below.

The problem: FILE must be open for writing or appending, so this is
not as nice as flock, since you may want to:
1. lock the file
2. read it
3. write it
4. unlock it
which seems (a) perfectly reasonable and (b) impossible to do with fcntl
unless you do sysopen and lseeks.

For that matter, I am not sure that I believe that the reinstall option
that
forces Perl to use fcntl makes flock work properly either, since
flock can work on closed files. Too bad Perl doesn't simply use
the more modern lockf instead of flock.

Anyway, I'd appreciate the comments of someone who knows Perl and Unix
better than I do.

 ...Michael Levy, Part-time Perl hacker.




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

Date: 31 Jan 1998 00:21:12 GMT
From: Anthony Boyd <anthony@outshine.com>
Subject: Forcing 7-digit number?
Message-Id: <6atqpo$8iq$1@news.ncal.verio.com>

I have a 5-line script that generates a user id:

srand;
$now = time;
$extra = sprintf("%7d",int(rand 9999999));
$visitorid = $now . $extra;
print "$visitorid\n";

The script works well most of the time, returning an id like this:

8795466346006617

The problem is that if the random number is not 7 digits, sprintf adds a
space in, instead of a zero:

886203413 665343

Programming Perl says on p 222 that printf should give me padding with
zeros for numbers.  I think my shortcoming is not understanding the
various format options -- perhaps %7d is incorrect?  Perhaps I need to
convert from a scalar, which might be interpreted as a string?

-Tony


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

Date: 31 Jan 1998 01:04:56 GMT
From: Anthony Boyd <anthony@outshine.com>
Subject: Re: Forcing 7-digit number?
Message-Id: <6attbo$a0e$1@news.ncal.verio.com>

Jason Christian <jason@primal.ucdavis.edu> wrote:
> On 31 Jan 1998, Anthony Boyd wrote:
>
> > Programming Perl says on p 222 that printf should give me padding with
> > zeros for numbers.  I think my shortcoming is not understanding the
> > various format options -- perhaps %7d is incorrect?  Perhaps I need to
> > convert from a scalar, which might be interpreted as a string?
>
>man sprintf

Thanks, I feel stupid.  I tried to have due dilligence, reading
Programming Perl & Learning Perl first.  Another question, (checked the
books & man page, but maybe I don't understand it):

I'm running the script more than once per second.  I was _hoping_ that the
random number would cause IDs assigned in the same second to be unique.
Instead, they're the same:

$ userid.pl
8862077421852111
$ userid.pl
8862077421852111

Clearly, the time is being used to seed the random number.  I cannot find
an example of how to get a random number that will vary independent of the
time, although the man pages and books all say it's possible.  Anyone have
a pointer?

-Tony


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

Date: 31 Jan 1998 01:02:05 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Forcing 7-digit number?
Message-Id: <6att6d$b6u$2@marina.cinenet.net>

Anthony Boyd (anthony@outshine.com) wrote:
: I have a 5-line script that generates a user id:
[snip]
: $extra = sprintf("%7d",int(rand 9999999));

Any special reason that's not just 1e7?  Your version excludes 9999999 as
a possible value, which seems a bit odd.

: $visitorid = $now . $extra;
[snip]
: The problem is that if the random number is not 7 digits, sprintf adds a
: space in, instead of a zero:
: 
: 886203413 665343
: 
: Programming Perl says on p 222 that printf should give me padding with
: zeros for numbers.  I think my shortcoming is not understanding the
: various format options -- perhaps %7d is incorrect?  Perhaps I need to
: convert from a scalar, which might be interpreted as a string?

The fill character is space by default, but you can put an initial zero 
on the format spec to get zero padding.  So the format '%07d' will solve 
your problem.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 30 Jan 1998 17:04:19 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
To: landman@sgi.com
Subject: gnuplot=freeware GIF creation
Message-Id: <34D27893.F3CCCEC0@us.oracle.com>

DOH! I goofed!

Denis Goddard wrote:
> Yes. The version I'm using (4.6) supports gifs.


I should have said: 3.6beta will create GIF files directly.
It also handles time-series data very nicely.
I have had *no* trouble with it, though it is listed as "beta"
(and has been so for over a year).

Get it!

The offical site for the 3.6 betas is cmpc1.phys.soton.ac.uk
It is also available at:
http://science.nas.nasa.gov/~woo/gnuplot/beta/





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

Date: Fri, 30 Jan 1998 17:04:20 -0800
From: Shawn Gordon <sgordon@athena.lbl.gov>
To: Edgar Torres-Silva <etorres@mti.sgi.com>
Subject: Re: Help: h2ph and perl include files
Message-Id: <34D27894.DAB00B3E@athena.lbl.gov>

Edgar Torres-Silva wrote:
--clip--
>         I am trying to make a daemon in Perl (5.004_04).
--clip--

egads, I never knew that making a daemon process could be so hard -
I have some that run quite well and they consist of the following:

fork() && exit();  # you should check if you CAN fork - but, hey, I 
		   # like to live life on the edge...

chdir("/") || die "Cannot change directory $!\n"; 
setpgrp() || die "$!\n"; # make it a session leader 
open(STDOUT,">>$LogDir/stdout.log") || 
        die "Cannot open $LogDir/log for write\n"; # pipe output to the
logfile 
open(STDERR,">>$LogDir/isf.errlog") ||
        die "Cannot open $LogDir/errlog for write\n"; # pipe errors to
the error log


This is executed on a unix system (solaris), And I have never had to
run h2ph on the files you mention.

What system are you running on? Unix, WinNT...

shawn


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

Date: 30 Jan 98 23:31:03 GMT
From: Klaus Johannes Rusch <KlausRusch@atmedia.net>
Subject: HTTP::is_success not found
Message-Id: <34d262b7.0@news1.ibm.net>


The following simple program fails with an error message
that HTTP::is_success cannot be found on one system but 
works on another, without any obvious difference in
configurations.


use LWP;
$ua = new LWP::UserAgent;
my $req = new HTTP::Request 'GET', "http://localhost/";
$res = $ua -> request($req);
print $res -> is_success;         # failing statement HTTP::is_success


@INC has the following entries:


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

Date: Sat, 31 Jan 1998 01:42:31 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: loading page after cgi call causes path problems.
Message-Id: <34d580df.4554449@flood.xnet.com>

Mark Pryor <mpryor@shareone.com> wrote:

>I have a perl cgi that get some form input, and upon completion,
>loads a canned html page - thanking the user for submitting.  However,
>if I place links along with the thank you text, it wants to look
>in the cgi-bin directory (where the cgi was called) for the files.
>
>Is there a way to just call the cgi, wherever it may be, and return
>back to the top to continue normal browsing?
>
>TIA

Wrong newsgroup, but try using full URL paths for the links like
"/~mpryor/index.html" instead of just "index.html".  Then pages will
work from any dir even if you relocate them or spit them out of a CGI.

David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Fri, 30 Jan 1998 18:37:29 -0500
From: BENJAMIN BERUBE <berub00@DMI.USherb.CA>
Subject: Locking files
Message-Id: <34D26439.62F349F2@DMI.USherb.CA>

Hello,

My question is about locking file so that when I open a file, nobody
else can open it.  For example, I want to update a file called
"users.dat".  My script open the file, make some modifications in it,
then re-write it.  But if someone else run the script at the same time,
everything's lost.

I tried flock, but didn't seem to work.  How can I protect my file ???

Take note that if someone else try to use the file while it's already
open, it should be waiting for the file to close (so it re-try opening
the file as long as it can't).

Thanks for the help!

Benjamin

---
 Benjamin Berube  [berub00@dmi.usherb.ca]
 Informatique    Universite de Sherbrooke




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

Date: Fri, 30 Jan 1998 17:27:35 -0800
From: Denis Goddard <dgoddard@us.oracle.com>
Subject: Re: Locking files
Message-Id: <34D27E07.E7033F4C@us.oracle.com>

BENJAMIN BERUBE wrote:

> My question is about locking file so that when I open a file, nobody
> else can open it.

Use flock, as described in /pod/perlfunc.pod
Note that this will *not* work properly for NFS-mounted filesystems.
(As described in the abovementioned pod).


-Denis



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

Date: 31 Jan 1998 01:19:31 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: modulo operator
Message-Id: <m3btwtpka4.fsf@furu.g.aas.no>

Nathan Franzen <franzen@pmel.noaa.gov> writes:

> Oops!  
> A 5.004 perl (under OpenVMS, even) gives:
> 
>    franzen> perl -e "print 5 % 3,qq/\n/;"
>    2
>    franzen> perl -e "print -5 % 3,qq/\n/;"
>    1
>    franzen> perl -e "print 5 % -3,qq/\n/;"
>    -1
>    franzen> perl -e "print -5 % -3,qq/\n/;"
>    -2
> 
> Much better!

 ...and when 'use integer' is in scope % gives you direct access to %
as implemented by the C compiler.

$ perl -le 'use integer; print -5 % 3'
-2
$ perl -le 'print -5 % 3'
1

-- 
Gisle Aas


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

Date: 30 Jan 1998 22:57:29 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Re-using STDIN
Message-Id: <6atlsp$5tc@news.service.uci.edu>

In article <34D0817C.2296@cilea.it>,
Matteo Boschini  <boschini@cilea.it> wrote:
>I have the following problem:
>without going into to much detail, I need to read STDIN without clearing
>it. That is, I do a 
> 
> read(STDIN, $mybuffer, $mylength);
>
>and use $mybuffer for all I need, but at the end of the script, I need
>STDIN again , the same one as before, to be passed to another script ?

If STDIN is a file, you can use seek.  If STDIN is the terminal,
its a little more trouble.  You can use the -t file test operator
to see which it is.  If a terminal, you'll probably have to copy
the input into a temp file and pipe it as stdin to the other
script.

BTW, you did not state how this other "script" is called from
the first.  How that is done depends on your what you need to
do?  From your use of read() looks like your are doing it within
a CGI program.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Fri, 30 Jan 1998 19:16:22 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Really Stupid Question
Message-Id: <61uta6.ir3.ln@localhost>

John Doen (tmagnum@coredcs.com-nospam) wrote:
: On Fri, 30 Jan 1998 19:30:32 GMT, chip@mail.atlantic.net (Chip
: Salzenberg) wrote:

: >According to tmagnum@coredcs.com-nospam (John Doen):
: >>I'm working on a form where the user submits info a perl script
: >>processes their choice and outputs the appropriate page.  Easy right?
: >>Yes it should be.  I'm having problems getting the script, contacted
: >>below, to get through the If statement.  When I run it in debug mode I
: >>get a "Use of Uninitialzed Variable" error on the line with the If
: >>statement.
: >
: >Well, then maybe it's using an uninitialized variable?
: >
: >"Hello?  McFly?!"
: >
: >CGI, CGI, CGI.  Will no one rid me of this accursed CGI?
: >-- 
: >

: I said it was a stupid question, but ummm no kidding.  how do I fix
: it?  


You ensure that $FrontChoice is defined  ;-)

 ... and since it is set from $form_data{'choice'}, you ensure that
it is defined too.


After your ReadParse() call (I almost skipped answering when I saw
cgi-lib.pl. You really should be using CGI.pm by now...) check
to see if it is getting your form stuff correctly:


if (defined ($form_data{'choice'}))
   {print \$form_data{'choice'} is defined\n"}
else
   {print \$form_data{'choice'} is NOT defined\n"}


Of course you need to figure out some way to see the output of
the if/else. Use warn() instead of print and check your server
log, or chang the Content-type, or some other CGIy thing that's
best discussed in a newsgroup about CGI. This one isn't.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jan 1998 18:18:37 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Sort::Fields[Re: Help with SORT]
Message-Id: <34D27B5E.FA2794B2@5sigma.com>

I pushed version 0.90 onto CPAN earlier today.  It should do what
you want!

	-joseph

Jim Michael wrote:
> 
> Joseph N. Hall wrote:
> > Perhaps you'd like to run the code I posted?
> 
> Hey, I've been looking for a hierarchical sorting routine. Cool.

-- 
Joseph N. Hall, prop., 5 Sigma Productions       mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training  . . . . . . . . . . . . . . .  http://www.perltraining.com


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1774
**************************************

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