[9664] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3258 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 26 22:17:14 1998

Date: Sun, 26 Jul 98 14:04:52 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 26 Jul 1998     Volume: 8 Number: 3258

Today's topics:
    Re: [Q] Multiplexing STDOUT to  already opened  Filehan (Mark-Jason Dominus)
        can't resolve symbol 'fgetpos' <sicher@adis.at>
    Re: comparing files in perl (Mark-Jason Dominus)
    Re: Deutsche Boerse sucht 100 neue Mitarbeiter im IT-Be (=?iso-8859-1?Q?Thomas_K=F6hler?=)
    Re: File::Path::rmtree and Taint (Marc Haber)
    Re: GMTIME (I R A Aggie)
        How to easily detect file perms on Unix files? (Rick Crelia)
    Re: How to easily detect file perms on Unix files? (Mark-Jason Dominus)
        How to put mailbox contents on HTML? <bahram@netcomuk.co.uk>
        HTTP POST FORMAT Help! (CGI-Unix) <431854@cienz.unizar.es>
    Re: newbie string questions. (Craig Berry)
    Re: Perl(sendmail) and Psiweb problem (Greg Bacon)
    Re: program used to pass switches (Tad McClellan)
    Re: program used to pass switches Garp
    Re: program used to pass switches (Sean McAfee)
    Re: Recent Secret Government Experiments Killing People <somewhere@over.the.rainbow>
    Re: Script Security Problem (brian d foy)
    Re: Simple (I hope) Apache/NT/Perl question (Ivan Fernandez Lobo)
    Re: Simple (I hope) Apache/NT/Perl question <flavell@mail.cern.ch>
    Re: Simple (I hope) Apache/NT/Perl question (Craig Berry)
        Simple text file editing script (Perry Lowe)
        struggling with date (Boson)
    Re: struggling with date darrensw@pacbell.net
    Re: struggling with date <rick.delaney@shaw.wave.ca>
    Re: struggling with date (Mike Stok)
    Re: Tcl is better than Perl (Ken Irving)
    Re: Y2K problem in PERL with localtime() (John Stanley)
    Re: Y2K problem in PERL with localtime() (Craig Berry)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 26 Jul 1998 14:31:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: [Q] Multiplexing STDOUT to  already opened  Filehandle(s)
Message-Id: <6pfsmt$9pq$1@monet.op.net>

In article <6pe34l$7am$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>1. Attach STDOUT to the `tee' program:
>2. Fork a child process to run your own private `tee' code:

Sorry; there were so many plausible approaches that you rejected that
I forgot that usnig a child process to multiplex the output was among
them.


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

Date: Sun, 26 Jul 1998 18:03:17 +0200
From: Michael Sicher <sicher@adis.at>
Subject: can't resolve symbol 'fgetpos'
Message-Id: <35BB5345.5E534804@adis.at>

hello,

when running make test (perl 5.004_04 and 5.005) i always get the
lib/io_xs.t error:

 ./perl lib/io_xs.t
1..4
ok 1
ok 2
 ./perl: can't resolve symbol 'fgetpos'

i am using linux with kernel 2.0.33 and gcc 2.7.2.1. when running
Configure i uses the default values except for

dynamic_ext='DB_File Fcntl GDBM_File IO NDBM_File Opcode SDBM_File
Socket'
because including POSIX produced a second error when using make test.

usenm='false'

how could this be solved?

thanks a lot for your help!

bye,
michael




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

Date: 26 Jul 1998 15:24:38 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: comparing files in perl
Message-Id: <6pfvpm$9ue$1@monet.op.net>


In article <35B78E82.490B@min.net>, John Porter  <jdporter@min.net> wrote:
>Actually, I have already whipped up a version that does exactly that.
>It was AMAZINGLY faster than without memoize.

All this talk got me interested, so I wrote `diff' in Perl.  Most of
the interesting work is in the Algorithm::LCS module, which I'll be
uploading to CPAN sometime soon.  It's not even too slow to use.
Once some interface issues are worked outI think it'll be very handy
for people who want better control over the output of `diff'.

Unfortunately, I don't have time to put in on my web page today, but
it should be along soon, and I'll announce it when it is.



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

Date: 26 Jul 1998 19:13:57 GMT
From: jean-luc@picard.franken.de (=?iso-8859-1?Q?Thomas_K=F6hler?=)
Subject: Re: Deutsche Boerse sucht 100 neue Mitarbeiter im IT-Bereich
Message-Id: <slrn6rmvvl.4bq.jean-luc@picard.franken.de>

On 26 Jul 1998 20:03:00 +0200,
 Detlef Bosau <detlef@jojo.escape.de> wrote:
> stolze@paxp01.mipool.uni-jena.de meinte am 26.07.98
> zum Thema "Re: Deutsche Boerse sucht 100 neue Mitarbeiter im IT-Bereich":
> 
> 
> > 
> > Werter Detlef,
> > 
> > Da ich das grosse Vergnuegen hatte, schon mehr von Deinen Postings
> > zu lesen, als mir lieb ist, wuerde ich Dich bitten, hier nicht mehr
> > zu posten. 
> 
> Wo ist "hier", und ich bin mir bewusst, dass ich gerade in eine Vielzahl
> von Brettern poste.

Bretter gibt's bei Obi, aber nicht hier.

[snip]

Der Rest ist irgendwelches Rumgeflame, das in allen Newsgruppen offtopic
ist, in denen es so gelandet ist.

Daf|r gibt es passendere Gruppen.

> Detlef
> --
> Detlef Bosau                                    detlef@jojo.escape.de
> 
> Bienroder Weg 79                                Tel.: +49 531 303383
>                                                 D2:   +49 172 6819937
> 38106 Braunschweig, Germany                     Fax:  +49 531 303364
>          >>>> PGP Public Key als Empfangsbestaetigung <<<<
> ## CrossPoint v3.1 R ##

BTW ist deine Signature zu lang, falsch abgetrennt und hat einen
XPoint-Footer. Mu_ man eigentlich diplomiert sein, um sich Verstv_e
gegen die Netiquette erlauben zu d|rfen? :)

CU,
Thomas

-- 
    Thomas Kvhler    Email:     jean-luc@picard.franken.de
        <><           WWW:    http://home.pages.de/~jeanluc/
                      IRC:               jeanluc
      LCARS --- Linux for Computers on All Real Starships



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

Date: Sun, 26 Jul 1998 20:52:31 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: File::Path::rmtree and Taint
Message-Id: <6pg4ph$pci$2@nz12.rz.uni-karlsruhe.de>

mjd@op.net (Mark-Jason Dominus) wrote:
>In article <6paedm$qfb$4@nz12.rz.uni-karlsruhe.de>,
>Marc Haber <Marc.Haber-usenet@gmx.de> wrote:
>>everything that is read from a directory is tainted.
>>
>>Is this a bug or a feature? 
>
>It's a feature.  Anything under control of a (possibly hostile) user
>is tainted.  The user could put files with bizarre names into a
>directory, so filenames are tainted.

Yes, but I feel that a subroutine that I call should trust me that _I_
have taken care of the file. I am handing a path name to the
subrouting that clearly is untainted..

What should bizarre filenames in a program part like below do?

opendir DIR,"/tmp/some_dir";
my @dir = readdir DIR;
closedir DIR;
foreach $file( @dir )
{
  unlink $file;
}

How can bizarre file names in this code snippet do any harm? And yes,
I know that I am not handling symlinks, directories and other
non-plain files in that example code :-)

>>How am I suppose to delete entire subtrees in a secure environment?
>
>Untaint the filenames.  But what is the point of running such a
>program in -T mode to begin with?

Just imagine a virus scanner wrapper that tries to unpack archives
before the scanner itself is run. That wrapper will have to clean its
workspace after it has finished.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Sun, 26 Jul 1998 15:30:10 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: GMTIME
Message-Id: <fl_aggie-2607981530100001@aggie.coaps.fsu.edu>

In article <35b7f79f.13698522@news.pacbell.net>, darrensw@pacbell.net wrote:

+ I am trying to find a routine to allow me to parse GMTIME and then
+ recalculate and then rename as $GMTIME1 for example.

It would helpful if you told us what you're trying to do, and what you've
tried...

$string=gmtime();
print "$string\n";

Output: Sun Jul 26 19:29:28 1998
 
+ I have searched CPAN.

And you found? I searched, and found via 'perl -MCPAN -e shell':

cpan> d /date/
Distribution    ANDK/Date-GetDate-2.02.tar.gz
Distribution    B/BZ/BZAJAC/DateTime-Precise-0.03.tar.gz
Distribution    GBARR/TimeDate-1.08.tar.gz
Distribution    MORTY/DateConvert-0.14.tgz
Distribution    SBECK/DateManip-5.31.tar.gz
Distribution    SREZIC/Tk-Date-0.21.tar.gz
Distribution    STBEY/Date-Calc-4.1.tar.gz

Pick a module, any module.

James


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

Date: Sun, 26 Jul 1998 19:34:52 GMT
From: creliar@etoho.gactr.uga.edu (Rick Crelia)
Subject: How to easily detect file perms on Unix files?
Message-Id: <6pg0dt$kn9$1@cronkite.cc.uga.edu>

Can anyone point me in the direction of how to interpret the numbers for file 
mode returned by stat/lstat? I need to check files using standard Unix 
permissions in octal and I haven't been able to figure out what scale is
used for the values in stat/lstat[2].  I know that a file mode of 0600 returns
as 33152, and one of 0755 returns as 33261 - but, I'd like to know what those
values represent. I've checked the perlfunc man page and looked around on some
sites but still have no clue.  Thanks!

Rick



-Rick

----------------------------------------------------------------------
1.3.6.1.2.1.1.5 => Rick Crelia
1.3.6.1.2.1.1.1 => Network Admin
1.3.6.1.2.1.1.6 => UGA Center for Continuing Ed. / Athens, GA / 30602
1.3.6.1.2.1.1.4 => creliar@gactr.uga.edu / (706) 542-8728

  -= PGP Public Key: http://etoho.gactr.uga.edu/~creliar/pgp.html =-
----------------------------------------------------------------------


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

Date: 26 Jul 1998 15:49:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to easily detect file perms on Unix files?
Message-Id: <6pg195$a14$1@monet.op.net>

In article <6pg0dt$kn9$1@cronkite.cc.uga.edu>,
Rick Crelia <creliar@etoho.gactr.uga.edu> wrote:
>Can anyone point me in the direction of how to interpret the numbers for file 
>mode returned by stat/lstat?

The Stat::lsMode module might be helpful here.  You can give it the
number that you get from `stat' and it'll return a string like
"drwxr-xr-x".

It's available from CPAN and from
<URL:http://www.plover.com/~mjd/perl/lsMode/>


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

Date: Sun, 26 Jul 1998 21:55:16 +0100
From: "Bahram Pourghadiri" <bahram@netcomuk.co.uk>
Subject: How to put mailbox contents on HTML?
Message-Id: <6pg567$ke6$1@taliesin.netcom.net.uk>

Is it possible to write a cgi to check a mailbox every 5 minutes say, and
display the contents (with a little bit of formatting) on a pre-specified
HTML page?

Bahram.




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

Date: Sun, 26 Jul 1998 15:52:14 +0200
From: miedo <431854@cienz.unizar.es>
Subject: HTTP POST FORMAT Help! (CGI-Unix)
Message-Id: <35BB348E.1950AC40@cienz.unizar.es>

<HTML>
I am using this function but it don&acute;t works correctly, for example
i tried:
<BR><I>print "&amp;get_page("www.arrakis.es", "/index.htm", 80)";</I>
<BR>but it returns me socket bind and conect ok but nothing else;&nbsp;
trying other pages it returns socket bind and conect ok and the error page
when the page doesn&acute;t exist, but from my browser I tried <I><A HREF="http://www.arrakis.es/index">http://www.arrakis.es/index</A></I>.htm
and the page exist.
<BR>What is the problem?
<BR>
<HR NOSHADE WIDTH="600">
<BR><I><FONT SIZE=-1>sub get_page {</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;my($n,@values);</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;($n,@values) = @_;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;my(@result);</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;my($them,$pagina,$port);</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;($them,$pagina,$port)=@_;</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;$them = 'localhost' unless $them;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;$pagina = '/' unless $pagina;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;$port = 80 unless $port;</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;#print "#debug: them is $them, pagina is $pagina,
port is $port\n";</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;#@result=(1,2,3);</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;#return @result;</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;$AF_INET = 2;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;$SOCK_STREAM = 1;</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;$SIG{'INT'} = 'dokill';</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;sub dokill {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; kill 9,$child if $child;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;$sockaddr = 'S n a4 x8';</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;#chop($hostname = `hostname`);</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;($name,$aliases,$proto) = getprotobyname('tcp');</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+$/;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;($name,$aliases,$type,$len,$thisaddr) =&nbsp;
gethostbyname($hostname);</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;$this = pack($sockaddr, $AF_INET, 0, $thisaddr);</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;$that = pack($sockaddr, $AF_INET, $port, $thataddr);</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;if (socket(S, $AF_INET, $SOCK_STREAM, $proto))</FONT></I>
<BR><I><FONT SIZE=-1>{</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; print stderr "socket ok\n";</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;else {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; die $!;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;if (bind(S, $this)) {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; print stderr "bind ok\n";</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;else {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; die $!;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;if (connect(S,$that)) {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; print stderr "connect ok\n";</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;else {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp; die $!;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;select(S); $| = 1; select(STDOUT);</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;print S "GET $pagina\n"; # vergeet niet die \n
!!!!</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;while( &lt;S> ) {</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; $result .= $_;</FONT></I>
<BR><I><FONT SIZE=-1>&nbsp;}</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>&nbsp;return $result;</FONT></I><I><FONT SIZE=-1></FONT></I>

<P><I><FONT SIZE=-1>} # sub get_page</FONT></I>
<BR>&nbsp;</HTML>




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

Date: 26 Jul 1998 07:29:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: newbie string questions.
Message-Id: <6pelsj$3hc$1@marina.cinenet.net>

rainkid (rainkid@rainkid.com) wrote:
: Ok, i have  avariable, say $para, that contains a whole paragraph of text.
: what is the command that would cut $para so i stops when it sees a certain
: character?
:
: for example... let say i want &para to be the first sentence and not the
: whole paragraph so how would i set $para so i contains all the characters
: from the first to the first period?

I presume that $para is a slip of the ginfers and not a function name.

Note that grabbing text from start-of-string to the first period won't
necessarily get you the first sentence; it can return less

  Hi...I'm a sentence that has internal periods.

or more

  Do interrogatives count?  I'd sure hope so.

than that.  Allowed English punctuation and sentence structure is so
fiendishly complicated that I doubt there's a completely general
algorithmic approach to pulling sentences out of text.

That said, if you really know enough about your text to be confident that
first-char-to-first-period is good enough, here's one way:

  $para =~ s/\..*/./s;

(The /s is just in case your $para text has embedded newlines.)  This
basically says "find everything from the first period on, and replace all
of it with just a period" -- which leaves everything up to the first
period intact.

---------------------------------------------------------------------
   |   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: 26 Jul 1998 20:44:06 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Perl(sendmail) and Psiweb problem
Message-Id: <6pg4em$99q$3@info.uah.edu>

In article <6pbkub$sau$1@client3.news.psi.net>,
	abigail@fnx.com (Abigail) writes:
: Big error 1: There is no -w
: Big error 2: There is no -T
: Big error 3: There is no use strict;
: Big error 4: There is no use CGI;
: Big error 5: You aren't use a module to send mail.

I'm not convinced that your fifth claim is justified.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Sun, 26 Jul 1998 13:10:41 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: program used to pass switches
Message-Id: <1frfp6.ic3.ln@localhost>

Enter Net News (dhartman@enter.net) wrote:
: I saw this program in the Camel (2nd ed pg. 55) book and I am not quite sure
: of one line.  the chunk of code looks like this:

[snip]

:      last if /^--$/;       # what does this line do 


   That line exits the loop if the $_ variable contains 1 of these 2 strings:

      '--'         # two hyphen chars
      "--\n"       # three chars, two hyphen chars and a newline char



: (why the $)


   That looks like a Regular Expression to me.

   Wonder where to look for help with Regular Expressions...?


   How about the 'perlre' (titled: Perl regular expressions) 
   man page that is included with every perl distribution? 

   Golly. It sure has lots of sections. Which one should I look at...?


   I guess I'll just go with the 'Regular Expressions' heading near
   the top...


      "$   Match the end of the line (or before newline at the end)"



   So I'd guess that the $ is matching the end of the line 
   (or before newline at the end)   

   ;-)



: Thanks for any help.

   Learn to check the docs *first* when you have a question if
   you want to get the answer faster than posting and waiting.



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


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

Date: Sun, 26 Jul 1998 19:24:03 GMT
From: Garp
Subject: Re: program used to pass switches
Message-Id: <35bb81dc.32881781@news.demon.co.uk>

On Sun, 26 Jul 1998 13:10:41 -0500, tadmc@flash.net (Tad McClellan)
wrote:

>Enter Net News (dhartman@enter.net) wrote:
>: I saw this program in the Camel (2nd ed pg. 55) book and I am not quite sure
>: of one line.  the chunk of code looks like this:
>[snip]
>:      last if /^--$/;       # what does this line do 
>   That line exits the loop if the $_ variable contains 1 of these 2 strings:
>      '--'         # two hyphen chars
>      "--\n"       # three chars, two hyphen chars and a newline char
>
<sarcasm snipped>
>--
>    Tad McClellan                          SGML Consulting
>    tadmc@metronet.com                     Perl programming
>    Fort Worth, Texas

I don't have the Camel (haven't needed it yet) so I'm probably missing
context, but I'm interested as to why you'd want to stop switch
processing after '--' - is this common?


Cheers,
Garp


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

Date: Sun, 26 Jul 1998 20:07:25 GMT
From: mcafee@stargate.rs.itd.umich.edu (Sean McAfee)
Subject: Re: program used to pass switches
Message-Id: <10Mu1.5232$24.31242604@news.itd.umich.edu>

In article <35bb81dc.32881781@news.demon.co.uk>,
 <garp@syb7aris.demon.co.uk.with.no.7> wrote:
>I don't have the Camel (haven't needed it yet) so I'm probably missing
>context, but I'm interested as to why you'd want to stop switch
>processing after '--' - is this common?

Yes, it's a Unix convention, observed by many (but not all) commands, as
well as the getopt() library function.  Without it, it's difficult to deal
with arguments that begin with a hyphen, as they'll be interpreted as
switches.  For instance, to remove a file called "-hyphen", you have to
say "rm -- -hyphen".

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Sun, 26 Jul 1998 13:24:24 -0400
From: Nobody <somewhere@over.the.rainbow>
Subject: Re: Recent Secret Government Experiments Killing People!!!
Message-Id: <6pfon9$6p1@bgtnsc03.worldnet.att.net>

Let me guess this place out in Nevada. It was an old abandon base which also
known as Area 51???!!??

Daniel (dS=dQ/T) Key wrote:

> blowclinton@my-dejanews.com wrote in message
> <6pc4eu$32r$1@nnrp1.dejanews.com>...
> >Okay...
> >
> >A friend of mine, whose identity must remain anonymous has agreed for me to
> >let everyone know what she has seen.
> >
> >
> >---------
> >
> >
> >Remember the SR-71, created and operational in the 1950's and de-classified
> >in the 1990's???  In 1950, conventional science and technology could never
> >have designed the SR-71, yet a SUPER SECRET facility out in the Nevada
> desert
> >was it's birthplace.  This technology in 1950, quote "did not exist"
> unquote.
> > Any sighting of the SR-71 was excused as fantasy and the product of
> >hallucinations.
>  ------------- snip----------------
>
> OK, I've read this post three times and it still makes minimal sense, but I
> have a question for the voices in your head. What is it about the SR-71 that
> could not have been built in the late 60's-early 70's (when it was
> *actually* designed/constructed) ?
> --
> Daniel (dS=dQ/T) Key
> UIN 2160337
> PGP Key ID 0x81A7049C
>
> 'You cannot be serious!'John McEnroe
>



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

Date: Sun, 26 Jul 1998 12:08:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Script Security Problem
Message-Id: <comdog-2607981208560001@news.panix.com>
Keywords: just another new york perl hacker

[follow-ups set]

In article <35bab328.5558995@news.m.iinet.net.au>, sbrowne@iinet.net.au posted:

> I made an html page directly from the code the script generated and
> tried displaying  this on the secure server. No problems, security
> grade displayed, certificate displayed, everythings fine. So why can't
> I get the browser to recognise the security certificate from script
> generated pages??!!

this isn't a Perl issue.  see your server documentation or check your
certificate to see if it is trusted by the browser (the browsers
trust certificates issued by certain companies, such as Verisign).

good luck :)

-- 
brian d foy                                 <http://computerdog.com>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 26 Jul 1998 18:51:09 GMT
From: lobo@pinon.ccu.uniovi.es (Ivan Fernandez Lobo)
Subject: Re: Simple (I hope) Apache/NT/Perl question
Message-Id: <6pftqt$3fo$1@sci.cpd.uniovi.es>

> Posting the same off-topic question four times does not make it any more
> topical.  This is *very* clearly a server question, not a Perl question.
> In all honesty, what in the world made you think that this newsgroup was
> the right place to ask?  Why not a CGI newsgroup, or a server newsgroup,
> or Apache tech support, or...?

> ---------------------------------------------------------------------
>    |   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."

Well Craig,

      why don't we start call this Newsgroup "Craig's Personal Newsgroup".
I don't think Mark's question is so out of place. If you just don't know
the answer DON'T BOTHER and let other people check it out. 

By the way, I have the same problem with Apache and perl scripts. Hope
somebody can help.

Thanks.

	 Ivan F. Lobo




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

Date: Sun, 26 Jul 1998 21:32:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Simple (I hope) Apache/NT/Perl question
Message-Id: <Pine.HPP.3.95a.980726212302.18279G-100000@hpplus07.cern.ch>

On 26 Jul 1998, Ivan Fernandez Lobo quoted:

> > Posting the same off-topic question four times does not make it any more
> > topical.  This is *very* clearly a server question, not a Perl question.

Indeed it was..

> > In all honesty, what in the world made you think that this newsgroup was
> > the right place to ask?  Why not a CGI newsgroup, or a server newsgroup,
> > or Apache tech support, or...?

and then, to demonstrate to all his familiarity with usenet conventions,
IFL continued:

> > ---------------------------------------------------------------------
> >    |   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."

to which he then saw fit to comment:

>       why don't we start call this Newsgroup "Craig's Personal Newsgroup".
> I don't think Mark's question is so out of place. If you just don't know
> the answer DON'T BOTHER and let other people check it out. 

The answer, in the context of this group, was clear enough: the question
clearly had nothing to do with the perl language, and therefore was
clearly off-topic.  There are excellent reasons for having usenet rules,
and you are a living demonstration of why the moderated perl group was
needed.

> By the way, I have the same problem with Apache and perl scripts. Hope
> somebody can help.

You don't want to read, do you?  A good answer has already been
supplied: so go and post the appropriate details of your problem to an
appropriate group, where help is no doubt already available. 

Heaven knows how you think you can tell that it's "the same problem".
The only "same problem" that I can see here is an inability to choose an
appropriate group for posting.



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

Date: 26 Jul 1998 20:42:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Simple (I hope) Apache/NT/Perl question
Message-Id: <6pg4be$k93$3@marina.cinenet.net>

Ivan Fernandez Lobo (lobo@pinon.ccu.uniovi.es) wrote:
:       why don't we start call this Newsgroup "Craig's Personal Newsgroup".

I was actually rather miffed that 'comp.lang.perl.moderated' was chosen as
the name for the new Perl newsgroup over 'c.l.p.craigs.personal.group'.
I'm considering a separate RFD on the latter.

: I don't think Mark's question is so out of place.

It was, obviously, totally, without question.  It was the equivalent of
asking for directions on how to drive to Boston on a car mechanics'
newsgroup.  The fact you're using a car for the trip doesn't make it a car
question. 

: If you just don't know the answer DON'T BOTHER and let other people
: check it out. 

What if people start asking for souffle recipes?  And besides, I *did*
answer the question, by redirection.  If you walk into my office and ask
"Who was the seventh president of the US?", and I answer "You can probably
find out at the library," have I not provided a useful answer?

: By the way, I have the same problem with Apache and perl scripts. Hope
: somebody can help.

Me too.  Best of 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: Sun, 26 Jul 1998 13:51:38 -0400
From: pelowe@airmotion.com (Perry Lowe)
Subject: Simple text file editing script
Message-Id: <pelowe-2607981351390001@port15.tserver1.ao.net>

I am looking for a simple script that will edit
a message.txt file, by means of a webpage form,
to change the text of a scrolling text applet.
Any suggestions would be greatly appreciated.

Please email me as well as posting, as I do not
have freaquent access to newsgroups.

Thanks

-- 
Perry E. Lowe
Airmotion, Inc.
127 W. Fairbanks Ave. Suite 414
Winter Park, FL 32789
1-888-340-5286
1-407-740-5286
www.airmotion.com
pelowe@airmotion.com


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

Date: Sun, 26 Jul 1998 17:26:59 GMT
From: boson@earthlink.net (Boson)
Subject: struggling with date
Message-Id: <35bb6522.10427739@news.earthlink.net>

Hi,

I am looking for a way to get a date depending of the current weekday.
Here is my pseudo-code:

if weekday = sunday then date = today's date
else date = last sunday's date

I have been trying to use localtime but I cannot find the solution. I
know I cannot just substract the number of days between current
weekday and last sunday - that would be wrong when last sunday
occurred last month.

Please help.

Boson




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

Date: Sun, 26 Jul 1998 18:38:01 GMT
From: darrensw@pacbell.net
Subject: Re: struggling with date
Message-Id: <35bb7706.9851068@news.pacbell.net>

On Sun, 26 Jul 1998 17:26:59 GMT, boson@earthlink.net (Boson) wrote:

>Hi,
>

>I have been trying to use localtime but I cannot find the solution. I
>know I cannot just substract the number of days between current
>weekday and last sunday - that would be wrong when last sunday
>occurred last month.

Hi

Whenever I am calcualting dates I use the time function:

Today = Time

Tomorrow = (86400 + Time)

Tuesday = (2 * 86400 + Time)

This may help, hope so...

Darren



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

Date: Sun, 26 Jul 1998 19:16:05 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: struggling with date
Message-Id: <35BB81DF.42C63006@shaw.wave.ca>

Boson wrote:
> 
> Hi,
> 
> I am looking for a way to get a date depending of the current weekday.
> Here is my pseudo-code:
> 
> if weekday = sunday then date = today's date
> else date = last sunday's date
> 
> I have been trying to use localtime but I cannot find the solution. I
> know I cannot just substract the number of days between current
> weekday and last sunday - that would be wrong when last sunday
> occurred last month.
> 

No it wouldn't.  Just make sure you subtract days in seconds.

print most_recent_sunday(time);
sub most_recent_sunday {
    my $time = $_[0];
    my @T    = localtime($time);
    $T[6] ? localtime($time - 86400 * $T[6]) : @T;# assume list context 
}

But you would probably be better off using Date::Manip or Date::Calc.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 26 Jul 1998 20:52:29 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: struggling with date
Message-Id: <6pg4ud$53t@news-central.tiac.net>

In article <35bb6522.10427739@news.earthlink.net>,
Boson <boson@earthlink.net> wrote:
>Hi,
>
>I am looking for a way to get a date depending of the current weekday.
>Here is my pseudo-code:
>
>if weekday = sunday then date = today's date
>else date = last sunday's date
>
>I have been trying to use localtime but I cannot find the solution. I
>know I cannot just substract the number of days between current
>weekday and last sunday - that would be wrong when last sunday
>occurred last month.

Assuming you're using a perl where localtime gives a ctime style string
when used in a scalar context then does this (untested) work?  I hope I've
interpreted "last Sunday" reasonably...

  $now = time;
  $dayNo = (localtime $now)[6];
  $date = localtime ($now - $dayNo * 60 * 60 * 24);

If a ctime style string isn't good enough then you might consider using
strfitme which comes as part of the POSIX module e.g.

  use POSIX 'strftime';

  ...

  $date = strftime '%x', localtime ($now - $dayNo * 60 * 60 * 24);

If that's not good enough then there are plenty of date & time modules
available on the comprehensive perl archive network (CPAN, visit
http://www.perl.com and follow the links or ftp to ftp.funet.fi and look
under /pub/languages/perl/CPAN)

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Sun, 26 Jul 1998 20:58:27 GMT
From: jkirving@mosquitonet.com (Ken Irving)
Subject: Re: Tcl is better than Perl
Message-Id: <35bb7b10.4431442@news.mosquitonet.com>

On 25 Jul 1998 19:59:02 GMT, Tom Christiansen <tchrist@mox.perl.com>
wrote:

>In comp.lang.perl.misc, 
>    jkirving@mosquitonet.com (Ken Irving) writes:
>:On 25 Jul 1998 13:57:09 GMT, Tom Christiansen <tchrist@mox.perl.com>
>:Presumably I'm missing something, but I get an error:
>:
>:  Odd number of elements in hash list at C:\PERL\lib/IO/Socket.pm line
>:130.
>:
>:when running this script under 5.004_02 on winnt, and 5.004_01 on
>:linux. 
>
>    % perl -v 
>    This is perl, version 5.004_04 built for i686-linux
>
>    % perl -MIO::Socket -le 'print IO::Socket->VERSION'
>    1.1603

My IO::Socket is version 1.1602 on both platforms; time for an upgrade
apparently.  The revision notes for the IO modules indicate that the
IO::Socket::INET->new method was changed to accept a single argument
at version 1.16.

--ken



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

Date: 26 Jul 1998 19:47:10 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Y2K problem in PERL with localtime()
Message-Id: <6pg13u$t4$1@news.NERO.NET>

In article <MPG.10246eb2933cb2a3989791@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <6pefja$r1d$1@news.NERO.NET> on 26 Jul 1998 05:42:02 GMT, John 
>Stanley <stanley@skyking.OCE.ORST.EDU> says...
>> It is a lot simpler to assume that he intended to get two digits back by
>> using a %02d format. 
>
>Then he should have computed the value mod 100.

What he should have done is not the issue, what he intended is.  And why
should he have done this, when it should be possible to say "print this
number with two digits" and have the system do it or die trying?

>What it is 
>being asked to do is to print the value of the corresponding argument as 
>a decimal integer in *AT LEAST TWO* digits, left-padding with a zero if 
>less than 10 in absolute value and preceding with a minus sign if 
>negative.  

If I use a format of "%2d", I am asking for two characters to be
returned. I am not asking for at least two digits. If I were, then the
system would have failed to comply when it returns " 1" for the number
1. When I use "%02d", I am asking for a two character wide result that
is zero filled on the left. That it will actually return more than were
asked for is obvious to an experienced C programmer, but C is not a
prerequisite for perl programming, nor is the C result obviously the
best.

I'd also point out that your interpretation of the format fails for
scanf, where the "2" means "two", not "two or more".

>> However, 02-29-** would be obvious.
>
>You are complaining about 

Nothing. I am pointing out a place where the standard library behaves
non-intuitively and can cause errors to propogate when it could flag
them for the user.

>This ensures that reasonable further computer processing of the output 
>file will deal with correct numerical values, not truncated ones.

That is incorrect. Further "reasonable processing" in this example could
quite easily result in the year being interpreted as 2010, for any real
year from 2000 to 2010. 

>Reports from poor old Fortran (that's how it's spelled these days) were 

I spelled it that way, even if spelling flames were a game worth playing.

>intended for human eyeballs, 

Sometimes, and sometimes not. I programmed lots of FORTRAN that was not
intended to be looked at directly.

>and ** might be more obvious than a three-
>digit field where two were expected, say.  

I would say that ** is always more obvious an error than "10" would be,
when dealing with numeric data. 

>But -- unless anticipated -- 
>it would give an input number-parsing routine serious hiccups.

Yes, and that would be one more chance to catch erronious data before it
spread.  That's a Good Thing, in most places.

>As the behavior of ANSI/ISO Standard C printf is fully documented this 
>way, it is not going to change, nor is Perl's adaptation of it.  But you 
>seem to enjoy complaining about it anyhow.

And you seem to enjoy seeing complaints where none were made. 



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

Date: 26 Jul 1998 20:31:52 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Y2K problem in PERL with localtime()
Message-Id: <6pg3no$k93$2@marina.cinenet.net>

John Stanley (stanley@skyking.OCE.ORST.EDU) wrote:
: In article <MPG.10246eb2933cb2a3989791@nntp.hpl.hp.com>,
: Larry Rosler <lr@hpl.hp.com> wrote:
: >In article <6pefja$r1d$1@news.NERO.NET> on 26 Jul 1998 05:42:02 GMT, John 
: >Stanley <stanley@skyking.OCE.ORST.EDU> says...
: >> It is a lot simpler to assume that he intended to get two digits back by
: >> using a %02d format. 
: >
: >Then he should have computed the value mod 100.
: 
: What he should have done is not the issue, what he intended is.  And why
: should he have done this, when it should be possible to say "print this
: number with two digits" and have the system do it or die trying?

  length($num = sprintf "%2d", 100) == 2 or die 'trying';
  print $num;

Admittedly a bit verbose, but I for one would rather have the real value
printed than silently get digits chopped off, and dieing on a format
overflow would both break with long C-lineage convention and kill a lot of
existing code.

: >What it is 
: >being asked to do is to print the value of the corresponding argument as 
: >a decimal integer in *AT LEAST TWO* digits, left-padding with a zero if 
: >less than 10 in absolute value and preceding with a minus sign if 
: >negative.  
: 
: If I use a format of "%2d", I am asking for two characters to be
: returned. I am not asking for at least two digits. If I were, then the
: system would have failed to comply when it returns " 1" for the number
: 1.

Wrong.  The '2' is a minimum field width specifier, not a minimum digit
count specifier.

: When I use "%02d", I am asking for a two character wide result that
: is zero filled on the left. That it will actually return more than were
: asked for is obvious to an experienced C programmer, but C is not a
: prerequisite for perl programming, nor is the C result obviously the
: best.

True enough.  However, it does have the advantage of being widely used,
well known, and also being the basis for a lot of working code.

: Nothing. I am pointing out a place where the standard library behaves
: non-intuitively and can cause errors to propogate when it could flag
: them for the user.

I wonder if -w could provide a warning for format overflows?  This should
probably wait until finer-grained warning control is available, if ever.

---------------------------------------------------------------------
   |   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: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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