[7995] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1620 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 12 08:07:45 1998

Date: Mon, 12 Jan 98 05:00:47 -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           Mon, 12 Jan 1998     Volume: 8 Number: 1620

Today's topics:
     Re: ((keys %Pair) =~ /$Req/)) would it work (right)? (Martin Vorlaender)
     Re: ((keys %Pair) =~ /$Req/)) would it work (right)? <feng@haas.berkeley.edu>
     Re: A newbie and File::Find wonders (Martin Vorlaender)
     Re: A newbie is trying to use perl (George Russell)
     Re: A newbie's substitution question (Bart Lateur)
     Re: A newbie's substitution question (Tad McClellan)
     Re: Alphabetical Order <mgm@gxn.net>
     Re: Avoiding regular expressions (was: Re: Newbie quest <adavid@netinfo.com.au>
     Re: Can Perl talk smtp protocol under NT4? (Martin Vorlaender)
     defining Javascript <Carlos.de_Sousa@ebc.ericsson.se>
     Delay in perl... ? (Tobias Poppe)
     Re: Delay in perl... ? (Tad McClellan)
     Re: FILE SIZE LIMITS????? (10K)??? <rjk@coos.dartmouth.edu>
     Re: FILE SIZE LIMITS????? (10K)??? (Bart Lateur)
     Re: Find two strings in a file (Martien Verbruggen)
     Re: help compiling dynamic perl5_04 on hpux (frans postma)
     HELP!!!!!!!! <magostini@best-people.co.uk>
     Re: Looking for a perl script... <rjk@coos.dartmouth.edu>
     multiple keys with same value in declaration? (Chris Sherman)
     Perl / CGI newsgroup? <svetter@ameritech.net>
     perl CGI output to server file (Bernard M. Piller)
     Re: perl under windows95 <aprilk@dancris.com>
     Re: Problem with Getopt::Std (Johan Vromans)
     prog termination by server? (Tobias Poppe)
     serial port on sgi o2 <mbwenger@ifi.unizh.ch>
     Re: serious post about gmtime and year-1900 (was Re: Pe (Bart Lateur)
     Re: Simple array initialisation question <rjk@coos.dartmouth.edu>
     Re: Sinking STDOUT and STDERR <rjk@coos.dartmouth.edu>
     symbolic reference in subroutine ikarn@otenet.gr
     truncating <aaronp@weirdness.com>
     Re: truncating (Tad McClellan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Jan 1998 05:07:00 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: ((keys %Pair) =~ /$Req/)) would it work (right)?
Message-Id: <34b996e4.524144494f47414741@radiogaga.harz.de>

Patience (feng@haas.berkeley.edu) wrote:
: I am trying to see if any key element of a hash (%Pair) contains $Req.
: Would this work?

Did you try it?

The =~ operator takes a scalar expression as its left side, so what
you are matching against is the number of keys in %Pair.

(join( "\n", keys %Pair) =~ /$Req/)  does what you want, provided
that "\n" isn't part of any key (else choose some other character
known not to be in any key).

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Sun, 11 Jan 1998 23:29:27 -0800
From: Patience <feng@haas.berkeley.edu>
Subject: Re: ((keys %Pair) =~ /$Req/)) would it work (right)?
Message-Id: <34B9C657.81FA731C@haas.berkeley.edu>

Thank you all so much for helping out!  I am amazed by your ingenious
methods to solve my problem.  I learn so much from all of you.  : )

Thanks again!  : )

Patience



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

Date: Mon, 12 Jan 1998 05:24:18 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: A newbie and File::Find wonders
Message-Id: <34b99af2.524144494f47414741@radiogaga.harz.de>

Marek Jedlinski (cicho@free.polbox.pl) wrote:

: Metavariables can be fun, but then, in File::Find documentation I
: read:

: >=head1 SYNOPSIS
: >
: >    use File::Find;
: >    find(\&wanted, '/foo','/bar');
: >    sub wanted { ... }

: ...this, with no further reference to precisely what "/foo' and
: '/bar' represent.

I think this is a flaw in the POD. Please submit a bug report
(have a look at the perlbug script supplied with the standard
distribution).

: I simple-mindedly assumed the former would
: contain the starting directory and the latter, the required
: filemask

A quick glance at the source reveals the parameter structure:

sub find {
    my $wanted = shift;
    my $cwd = Cwd::cwd();
    # Localize these rather than lexicalizing them for backwards
    # compatibility.
    local($topdir,$topdev,$topino,$topmode,$topnlink);
    foreach $topdir (@_) {
      ...

So File::Find's first parameter is the function to be called on
each entry found, and any other parameters represent starting
points for the search.

: Also... Another newbie wonder. Before I even found the File::Find
: package, I tried my own hand at listing files in a single
: directory (no recursion intended). I got this far:

: @file_mask = "*"; 
: if (@ARGV) { @file_mask = @ARGV }
: #I.e., if no commandline parameters, we will list everything

: for (<@file_mask>) { 
: 	print "$_\n";
: }

: So now I can pass the file_mask to the script and have all the
: matching files listed. This works... Except when I specify a file
: mask that "should" return NO matches. Assuming that I have no
: file called "xxx" in the current directory, and run the script as

: 	perl findfile.pl x*x

: the script does not output anything - correctly, since no match
: exists. BUT, if I run

: 	perl findfile.pl xxx

: the script does output "xxx" AS IF a file by that name were
: found. And, again, I go "huh??"

In this case, I also go "huh?". My perl (5.004.04 on OS/2) doesn't
print anything in the latter case. Are you sure you don't have a
file named 'xxx'?

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Mon, 12 Jan 1998 11:42:06 GMT
From: george.russell@clara.net (George Russell)
Subject: Re: A newbie is trying to use perl
Message-Id: <34b9ff74.851532@news.clara.net>

The line to count the number of clara.net strings in $domain
sometimes, and only sometimes returns an error Argument
"xxxxx.yyyyy.zzz" isnt numeric in eq .  All i want to do there is
check if $domain contains clara.net, and at the moment I think it
checks if the string is equal to clara.net.  Any ideas?
======================================================================
#!/usr/bin/perl -w
use strict; 
# under advice to do so wonder why :-) ho hum, i do know, i'm not a cs
student
# for nothing
# not yet - it won't run
# tests for file open failure
use diagnostics;
my $filename = "access.log" || die "could not open 'access.log' $!" ;
my $number=0;
my $i;
my @indata;
my $claranets;
print "Content-type:text/html\n\n";
print "<html><head><title>Access Log</title></head>";
print "<body>";
   
open(INF,$filename)|| die "could not open 'access.log' $!" ;
@indata = <INF>;
close(INF);
       
print "<table border=1>";
print
"<tr><th>Domain</th><th>Time</th><th>File?</th><th>HTTP</th><th>No</th></tr>\n";
foreach  $i (reverse @indata) {
chomp($i);                    
my($domain,$datetime,$file,$extra1) =(split(/ /,$i))[0,3,6,7];
#take only needed stuff adjust numbers to pick stuff
# stuff seperated by spaces
# HERE, see if the variable $domain contains a match for
#  "clara.net". See the "perlre" and "perlop" manpages
next if $domain =~ /clara\.net$/;
# if when clara.net not at end of string - . is escaped
print <<TABLEROW; 
<tr>
<td>$domain</td>
<td>$datetime</td> 	  
<td>$file</td>
<td>$extra1</td>
<td>$number</td>
</tr>
TABLEROW
$number++; 
#trying to increment number for display of lines in file excluding
entries including clara.net
#actually $name is the date and time
next if $domain == /clara\.net$/;
$claranets++;
#hopefully count claranets that are excluded from report.
}
print "<tr><td colspan=5 align=center>";
print $claranets;
print "</tr></td>";
print "</table>";
print "</body></html>"



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

Date: Mon, 12 Jan 1998 09:42:47 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: A newbie's substitution question
Message-Id: <34bae1ba.3538268@news.tornado.be>

tadmc@flash.net (Tad McClellan) wrote:

>   s[([A-Z][A-Z]+?)|_(.+?)_][defined($1) ? "<b>$1</b>" : "<b>$2</b>"]ge;

I'd turn that into

>   s[([A-Z][A-Z]+?)|_(.+?)_][<b>$1$2</b>]g;

Since either $1 or $2 will be empty. It might trigger the "use of
undefined variable" warning, though (Grrr... I wish there was an easy
way to suppress those warnings. I usually DON'T use -w, because of these
irritating warnings).

	Bart.


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

Date: Mon, 12 Jan 1998 06:26:42 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: A newbie's substitution question
Message-Id: <262d96.sj.ln@localhost>

Bart Lateur (bart.mediamind@tornado.be) wrote:
: tadmc@flash.net (Tad McClellan) wrote:

: >   s[([A-Z][A-Z]+?)|_(.+?)_][defined($1) ? "<b>$1</b>" : "<b>$2</b>"]ge;

: I'd turn that into

: >   s[([A-Z][A-Z]+?)|_(.+?)_][<b>$1$2</b>]g;

: Since either $1 or $2 will be empty. It might trigger the "use of
: undefined variable" warning, though (Grrr... I wish there was an easy
: way to suppress those warnings. I usually DON'T use -w, because of these
: irritating warnings).


There _is_ an easy way to suppress those warnings:

$^W = 0;  # turn warnings off

s[([A-Z][A-Z]+?)|_(.+?)_][<b>$1$2</b>]g;

$^W = 1;  # turn warnings back on


Documented in 'perlvar'


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


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

Date: 12 Jan 1998 09:17:03 GMT
From: "Mark Morgan" <mgm@gxn.net>
Subject: Re: Alphabetical Order
Message-Id: <01bd1f3b$38b92070$86507ec2@simont>

Any way that you do come up with will just be a (likely) much more
inefficient sort routine.  Just use what perl has provided you with, and
all will be well. :)

Mark.

Gary C. New <gnew@southernvirginia.edu> wrote in article
<34B7AEF2.4FB3@southernvirginia.edu>...
> What is the simplest way to alphabatize data using Perl other than the
> "sort" command?
> 
> Example:
> 
>         Alex
>         Brenda
>         Carl
>         .
>         .
>         .
>         Xena
> 


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

Date: Mon, 12 Jan 1998 20:08:58 +1100
From: Anthony David <adavid@netinfo.com.au>
Subject: Re: Avoiding regular expressions (was: Re: Newbie question)
Message-Id: <34B9DDAA.202DDA20@netinfo.com.au>

Chipmunk wrote:

> John C. Randolph wrote:
> >
> > No, there are definitely people who shouldn't be using Perl *or* Python, *or*
> > anything other than the first language they learned  (Visual Basic: it causes
> > severe brain damage, just like all previous versions of Basic did.)
>
> Excuse me, but the first programming language I learned was BASIC.
>

Is it possible to be at Dartmouth and NOT use BASIC ?? :-)

--
Anthony David                      |     Opinions expressed ARE
Anthony David & Associates |     those of my employer




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

Date: Mon, 12 Jan 1998 05:30:16 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Can Perl talk smtp protocol under NT4?
Message-Id: <34b99c58.524144494f47414741@radiogaga.harz.de>

Neil Sedley (neil@nsedley.dircon.co.uk-antispam) wrote:
: Cool Yam wrote in message <34B787D3.5344@mars.dti.ne.jp>...
: >I need to make Form2Mail.pl under WindowsNT4.
: >But,I can't use any sendmail aplication.
: >I hear Perl can talk smtp protocol,but I don't know
: >how to make it.
: >Anybody know how to make that script??
: Get hold of the SMTP RFC ( 821 ISTR) and implement it yourself by opening a
: socket on port 25 (provided it is not already opened by another
: application). The protocol is very easy to implement ( I have written one to
: receive SMTP so one to send it should by quite easy).

No need to re-invent the wheel. Have a look at the Net::SMTP module.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: Mon, 12 Jan 1998 10:45:56 +0100
From: Carlos de Sousa <Carlos.de_Sousa@ebc.ericsson.se>
To: lstein@genome.wi.mit.edu
Subject: defining Javascript
Message-Id: <34B9E654.A93687B4@ebc.ericsson.se>

This is a multi-part message in MIME format.
--------------8148DB74AD626C435FEC9EEB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

I'm currently running CGI.pm 2.36

I wanna supply javascript code for both javascript 1.2 and javascript
1.1
but I can't get it to work.

Basically, I want to do this:

<SCRIPT LANGUAGE="JavaScript1.2">
code
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1">
Redefinition of 1.2 functions
</SCRIPT>

I can see in the manual that it would maybe be possible, by giving
a hash reference (what's that?), but how is it really done?

I can't figure out the -script parameter to start_html for the above
problem.
Should it be -script=>%HASH or -script=>@HASH or -script=>$HASH and
how should the array look like?

%HASH = ('JavaScript1.2',$JAVA1.2,'JavaScript1.1',$JAVA1.1); ?
or
%HASH = ('language=>','JavaScript1.2','code=>',$JAVA1.2,
         'language=>','JavaScript1.1','code=>',$JAVA1.1):
or how?

I want to have both code segments definied in my perl script as
following!

$JAVA1.2 =<<END:

code
END
$JAVA1.1 =<<END;

code
END

Please, I need it a.s.a.p!

Please answer me thru mail as I don't usually read comp.lang.perl groups

Regards
Carlos de Sousa

-- 
Carlos de Sousa        (NA/EBC/EN/TIL)      Senior Systems Programmer
Ericsson Business Networks AB
E-mail: mailto:Carlos.de_Sousa@ebc.ericsson.se
--------------8148DB74AD626C435FEC9EEB
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Carlos de Sousa
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Carlos de Sousa
n:              de Sousa;Carlos
org:            <IMG SRC="http://www.ebc.ericsson.se/pictures/smlelogo.gif">Ericsson Business Networks AB
adr:            Augustendalsv. 21;;Nacka Strand;Stockholm;;S-131 89;Sweden
email;internet: Carlos.de_Sousa@ebc.ericsson.se
title:          Senior Systems Programmer
tel;work:       +46 8 422 06 05
tel;fax:        +46 8 422 06 20
note:           EBC/EN/TIL             Room: NA06A76
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------8148DB74AD626C435FEC9EEB--



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

Date: 12 Jan 1998 12:06:34 GMT
From: udta@rz114s1.rz.uni-karlsruhe.de (Tobias Poppe)
Subject: Delay in perl... ?
Message-Id: <69d10a$f8s$1@nz12.rz.uni-karlsruhe.de>

Hello...

I want to print every 10 seconds "Hello World" to standart output.
Is there a "delay-statement2 in perl to wait maybe 10 or
more seconds ?
Like "delay(100000) in pascal ?

Thnx..

--
MfG Tobias Poppe - Informatik HQ Karlsruhe
  *** eMail udta@rz.uni-karlsruhe.de ***
          ** sysop@hmc-bbs.org **


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

Date: Mon, 12 Jan 1998 06:18:50 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Delay in perl... ?
Message-Id: <an1d96.sj.ln@localhost>

Tobias Poppe (udta@rz114s1.rz.uni-karlsruhe.de) wrote:

: I want to print every 10 seconds "Hello World" to standart output.
: Is there a "delay-statement2 in perl to wait maybe 10 or
: more seconds ?
: Like "delay(100000) in pascal ?


   sleep(10);


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


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

Date: Mon, 12 Jan 1998 02:28:46 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: ANB <anbgb@anbgb.demon.co.uk>
Subject: Re: FILE SIZE LIMITS????? (10K)???
Message-Id: <34B9C62C.9421A9D0@coos.dartmouth.edu>

[posted and mailed]

ANB wrote:
> 
> I am doing a simple read character from a file, and printing into another
> (print IN $letter).
> 
> The original file is 1Mb but the new file stops automatically when it
> reaches 10K....
> WHY?????
> 
> Anybody knows???? Grateful for an answer. I thought perl had no boundaries
> except for the system memory.
> Thank you
> Deli

Is it possible that the first 0 (zero) in your input file occurs
somewhere around the 10K mark?  And that you're testing the boolean
value of the characters that you are reading in, when you should
be checking their length or if they're defined?

It would be much easier to help you if you posted your code.

Chipmunk


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

Date: Mon, 12 Jan 1998 10:17:55 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FILE SIZE LIMITS????? (10K)???
Message-Id: <34bce75c.4980379@news.tornado.be>

"ANB" <anbgb@anbgb.demon.co.uk> wrote:

>I am doing a simple read character from a file, and printing into another
>(print IN $letter).
>
>The original file is 1Mb but the new file stops automatically when it
>reaches 10K....
>WHY?????

Urm... Could this be on a PC, and you it be that the (text) file
contains a chr(26) at that position in the file?

The PC OS won't read beyond a chr(26) (aka EOF character). Not in text
mode, anyway.

HTH,
Bart.


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

Date: 11 Jan 1998 22:38:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Find two strings in a file
Message-Id: <69bhl0$cdd$1@comdyn.comdyn.com.au>

In article <34B52094.29C8@min.net>,
	John Porter <jdporter@min.net> writes:
> Joseph N. Hall wrote:

>> No, that single & isn't a typo.
 
> Ok, but could the ||= be?

perldoc perlop
/Assignment Operators

:)

that will tell you that

	$a ||= $b;

is the same as

	$a = $a || $b;

It works for almost any operator.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 
Commercial Dynamics Pty. Ltd.       | What's another word for Thesaurus?
NSW, Australia                      | 


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

Date: Mon, 12 Jan 1998 11:56:20 GMT
From: fpostma@xs4all.nl (frans postma)
Subject: Re: help compiling dynamic perl5_04 on hpux
Message-Id: <34ba043f.13271142@hdxf08.telecom.ptt.nl>

On 1 Jan 1998 18:20:53 GMT, bobg@uic.edu (Bob Goldstein) wrote:

>Michael P Chandler (mpchandler@mema.mail.fedex.com) wrote:
>: I get this error message when trying to 'sh Configure'.....even
>: if I try to bypass with a -DCC=gcc   (version 2.7.3)
>
>: I need to know if there is a patch for cc that I need or an
>: option that I'm not stating.....for the reasons below....
>: >[from 'sh Configure']
>: >
>: >The bundled C compiler can not produce shared libraries, so you will
>: >not be able to use dynamic loading.

Remove any old install files and extract the tar-file again so you got
a clean try. Then try to run ./Configure -DCC=gcc , note that gcc must
be in your path.

It IS possible to get it working, did it on several machines over
here. If it still doesn't work, email me and I'll recompile it here to
see what's different.

>   You may need to purchase the ANSI C compiler from HP.  The bundled
>compiler is not full-featured :-)

True, but the poster already mentioned he had GCC available, configure
doesn't seem to pick it up though.




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

Date: Mon, 12 Jan 1998 10:14:36 GMT
From: "Melanie Agostini" <magostini@best-people.co.uk>
Subject: HELP!!!!!!!!
Message-Id: <01bd1f40$a123fc20$160a010a@L83GZ.best-people.co.uk>

I'm a contractor with C, unix and Oracle skills - I'm thinking of doing a
course in Perl can anybody tell me if this is the best course of action for
me at present. Is there a great deal of demand for Perl and what would be
the advantages?
Thanks for all your help in advance.

If you could reply to the below address (I'm using my agencies' email
address).

Alex


-- 
magostini@best-people.co.uk


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

Date: Mon, 12 Jan 1998 02:22:21 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Looking for a perl script...
Message-Id: <34B9C4AC.DF7DA2A1@coos.dartmouth.edu>

Mark Hazen wrote:
> 
> Tom Phoenix wrote:
> 
> > Do you mean you want a script which will hang at odd times? :-)
> 
> Ooo! Oooo! I do! I do! :)
> 
> Might just be a useful addition to that BadProgrammer package I'm working on.
> :)

if (time % 2) {
  1 while 1;
}

;-)

Chipmunk


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

Date: Mon, 12 Jan 1998 08:53:45 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: multiple keys with same value in declaration?
Message-Id: <EMny1L.Inx@unx.sas.com>

I want several keys in a hash to have the same ref to a value.

Is there way of doing that in the declaration of the hash, or do
I have to set it up afterwards?  

In my case, doing afterwards will be very ugly and awkward, and I'm trying
to get away from that. 

For example, I want to do something like:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
!/usr/local/bin/perl5 -w
# we are going to test to see if I can do a backref from within the same
# structure

# this is a failure, so far
%myhash = (
   foo => [
      "one",
      "two",
   ],

   bar => $myhash{foo},  # or something, but this doesn't work, 
                         # bar is just null
);

# uncomment this to get it to work
#$myhash{bar} = $myhash{foo};

print "myhash{foo}[0] is ", $myhash{foo}[0], "\n";
print "myhash{bar}[0] is ", $myhash{bar}[0], "\n";
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

With the line above commented, I get:
   myhash{foo}[0] is one
   Use of uninitialized value at try43 line 18.
   myhash{bar}[0] is

But uncommenting the line after the hash structure (ie, doing it the ugly
way), I get:
   myhash{foo}[0] is one
   myhash{bar}[0] is one

 ...which is what I want to see if I could do everything in the 
declaration of the hash.

Can anyone help???  (Does this make sense?)  Thanx!!!

-- 
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com


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

Date: Mon, 12 Jan 1998 07:21:56 -0500
From: Scott Vetter <svetter@ameritech.net>
Subject: Perl / CGI newsgroup?
Message-Id: <34BA0AE3.4562@ameritech.net>

Is there a Perl / CGI newsgroup around?  Or one that is strictly CGI?


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

Date: Mon, 12 Jan 1998 12:31:00 +0100
From: bernard@look.in.signature (Bernard M. Piller)
Subject: perl CGI output to server file
Message-Id: <199801121231001006293@cybertron132.cybertron.at>

Hi!

I am just starting to learn Perl. I want to write a little cgi that
records the version of the browser that is accessing pages on my web
server.

When I use ENV it works on the client side but not on the server
machine. There the Environmental data of the Server machine is recorded.

How can a cgi script invoked by a client visiting a web page, write the
ENV data of the client to a file on the server?

Bernard

-- 
* bmp System Support               Vienna *
* http://www.bmpsystems.com       Austria *
* reply to: bernard at bmpsystems dot com *



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

Date: Mon, 12 Jan 1998 05:33:59 -0700
From: "April Kirby" <aprilk@dancris.com>
Subject: Re: perl under windows95
Message-Id: <69d2np$b6q$1@usenet88.supernews.com>

I hadn't found out about that until yesterday when I was trying to figure
out how to do something else out so you are right about just doing "perl
myfile.pl". I am still a newbie at this thing.
April




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

Date: 12 Jan 1998 09:12:32 +0100
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Problem with Getopt::Std
Message-Id: <wl3yb0mp0un.fsf@plume.nl.compuware.com>

>use Getopt::Std ;
>getopts('h:lp:') ;
>
>and I type    myscript -h -l -p pathname filename
>
>Instead I get      opt_h = -l
>
>What am I missing? 

If you want -h to take an optional argument (e.g. only when the next
thing is not an option on itself), you should use Getopt::Long.
Despite the name, it handles single-letter options as well.

This will give you plain -l and -p, and -h with an optional
argument:

  use Getopt::Long;
  Getopt::Long::config ("bundling");
  GetOptions ("h:s", "l", "p");

------------------------------------------------------------------------------
Johan Vromans                                             jvromans@squirrel.nl
Squirrel Consultancy                                  Haarlem, the Netherlands
http://www.squirrel.nl                  http://www.squirrel.nl/people/jvromans
PGP Key 2048/4783B14D   KFP = 65 44 CA 66 B3 50 0B 34  CE 0E FB CA 2D 95 34 D0
------------------------ "Arms are made for hugging" -------------------------


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

Date: 12 Jan 1998 12:22:34 GMT
From: udta@rz114s1.rz.uni-karlsruhe.de (Tobias Poppe)
Subject: prog termination by server?
Message-Id: <69d1ua$fds$1@nz12.rz.uni-karlsruhe.de>

Hi..

if i start a cgi-perl-skript by connecting to a web-site (the
skript runs on the server in the cgi-bin-direct.), what happens, if:
- the user (netscape) goes to an other web-page
  and the skript is still running (maybe a loop-statement wich takes
  1 hour to complete, but the user (netscape) terminates the connecting to the
  internet after 2 minutes) ?

Does the server automaticly terminates the skript  ???


--
MfG Tobias Poppe - Informatik HQ Karlsruhe
  *** eMail udta@rz.uni-karlsruhe.de ***
          ** sysop@hmc-bbs.org **


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

Date: Mon, 12 Jan 1998 11:01:55 +0100
From: Martin Wenger <mbwenger@ifi.unizh.ch>
Subject: serial port on sgi o2
Message-Id: <34B9EA13.41C6@ifi.unizh.ch>

Hi

I've attached a steerable webcam (sony) to the 2nd serial port. I tried
to use ioctl to communicate with the device, but I've encountered
different problems. Is there a better way?
If anyone has an specific idea, I'd appreciate your answer.

Martin

 
----
Martin Wenger <mbwenger@icu.unizh.ch> or <mwenger@datacomm.ch>

Programmer: A device that converts coffee into code


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

Date: Mon, 12 Jan 1998 10:18:01 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: serious post about gmtime and year-1900 (was Re: Perl not Y2K compliant)
Message-Id: <34bde974.5515678@news.tornado.be>

pudge@pobox.com (Chris Nandor) wrote:

><Russell_Schulz@locutus.ofB.ORG> wrote:

>> personally, I'd guess that it's not just misreading, but also mistrust.
>> it's HEALTHY to mistrust anything that returns `98'.  why not `1998'?

I agree. I think it's a design flaw.

>Can't you figure that code out for yourself?  Simply add a few years to
>the date value, and put it through the routine.  I don't see what the
>difficulty is.

Nope. It should be in the docs; it probably is.

You can test all the code you want, but if anything is not in the docs,
then the behaviour is undefined. This means that it might work on YOUR
system, but it may just as well break if you transfer the script to
another Perl port on another computer, like from you local computer to a
CGI server.

However, I think that this particular case IS documented. So all this
concern isn't necessary in this case. Or is it?

I've seen too many posts claiming that Perl's behaviour depends on the
C-runtime. I don't trust C-runtimes. C-comilers are buggy. There are
hardly two different C-compilers in the world that produce sufficiently
similar code, in all cases. Bordercases in particular are very suspect.

So, I think that checking whether a date past 2000 actually produces a
number above 100, should be in the test suite (checking if Perl was
compiled properly). Or, like with sprintf, the code should be
incorporated into the Perl source, instead of depending on a C library.

HTH,
Bart.


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

Date: Mon, 12 Jan 1998 02:00:19 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Simple array initialisation question
Message-Id: <34B9BF82.446B93B9@coos.dartmouth.edu>

Bill Jones wrote:
> 
> Keith Oborn wrote:
> >
> > I have a variable, $users, which contains a string like this:
> >
> > fred,joe,bert
> >
> > I need to produce an array that contains the above, equivalent to
> > simply saying @userarray = (fred,joe,bert).
> >
> > For the life of me I can't see how--.
> 
> How about @users = $users?

That would be equivalent to @users = "fred,joe,bert";
Not the same thing.

eval "\@users = ($users)";

would work, but better ways have already been posted.

Chipmunk


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

Date: Mon, 12 Jan 1998 00:13:00 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: Mark Hattarki <hattarki@rsn.hp.com>
Subject: Re: Sinking STDOUT and STDERR
Message-Id: <34B9A65B.B000AD78@coos.dartmouth.edu>

[posted and mailed]

Mark Hattarki wrote:
> 
>        I have a program that dies if you are not a root user :
> 
> if ($username ne "root") {
>     die "Error: you must be root to run this, you lowly non-root person\a\n";
> }
> 
> Earlier in the code I have this :
> 
> if ($DEBUG!=0) {
>     print "* Debuging is on; level $DEBUG\n";
> }
> 
> if ($DEBUG>0) {
>         print "* Begining $HOME/setup.pl\n";
> }
> 
> My problem is that when the user is not root, the program terminates but
> does not print the messages to the screen in proper order:
> 
> Error: you must be root to run this, you lowly non-root person
> * Debuging is on; level 1
> * Begining /opt/scaf_setup/config/bind/setup.pl
> 
> I understand that the buffering is causing this. But I don't know how to
> do away with the buffering completely. I've tried bringing both stdout and
> stderr into focus, then setting $|= 1 (I've tried 0 too), but that doesn't
> work. How do I get the error message to be the last thing printed?

Alternatively, why don't you just print the debugging messages to STDERR
instead of STDOUT?

Chipmunk


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

Date: Mon, 12 Jan 1998 08:42:58 +0200
From: ikarn@otenet.gr
Subject: symbolic reference in subroutine
Message-Id: <34B9BB72.F93A0EE6@otenet.gr>

I  need to creat in a subroutne a number of hashes, called
%hash1,%hash2,%hash3 etc. Then, when I access then in the main, I can
only get the
 last one, i.e.
sub formhash{
@array=(1,2,3);
foreach $element(@array){
$symhash="hash".$element;
 ....
${$symhash}{$key}=...
}#end of array loop
}#end of S/R formhash

Then, the main accesses these hashes as
&formhash();
foreach $element(@array){
$symhash="hash" . $element;
 ...
print "${$symhash}{$key}\n"; }

but the values I get correspond to the last hash , hash3. How  can I get
around this??

Thanks, Spiros Alexiou
alexiou@moka.ccr.jussieu.fr



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

Date: Mon, 12 Jan 1998 00:52:14 -0500
From: "Aaron C. Paulley" <aaronp@weirdness.com>
Subject: truncating
Message-Id: <69cb67$cjf$1@usenet87.supernews.com>

Hello.  I fiddle with CGI a little, but I'm really no programmer.  The only
thing I need to do is to be able to take a string like this:

    "/usr/local/etc/htdocs/filename.txt"

and get just

    "filename.txt"

out of it.

Any help would be GREATLY appreciated, believe me.

Thanks a million!




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

Date: Mon, 12 Jan 1998 06:31:24 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: truncating
Message-Id: <se2d96.sj.ln@localhost>

Aaron C. Paulley (aaronp@weirdness.com) wrote:
: Hello.  I fiddle with CGI a little, but I'm really no programmer.  The only
: thing I need to do is to be able to take a string like this:

:     "/usr/local/etc/htdocs/filename.txt"

: and get just

:     "filename.txt"

: out of it.


File::Basename module would be best. It will work across different
Operating Systems.


To do it non-portably:

   $filename = $1 if m#.*/(.*)$#;


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


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

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

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