[12123] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5723 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 19 11:07:19 1999

Date: Wed, 19 May 99 08:00:21 -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           Wed, 19 May 1999     Volume: 8 Number: 5723

Today's topics:
        [win32 module] where are the *.al files ? <jquelin@ifaedi.insa-lyon.fr>
    Re: _Please_ improve localtime! (John Klassa)
    Re: _Please_ improve localtime! <news@thebeaches.to>
    Re: _Please_ improve localtime! (Tramm Hudson)
        An /e for a match rather than a substitution <steven.peter.primrose-smith@avl.com>
    Re: An /e for a match rather than a substitution (Tad McClellan)
    Re: best way to database stuff using Perl? <a.daniels@umist.ac.uk>
    Re: can someone help me with locking??? <camerond@mail.uca.edu>
        eliminating lines in extracted text <rbbdsb@erols.com>
    Re: FAQ 4.55: How do I look up a hash element by value? <droby@copyright.com>
    Re: FAQ 4.65: Why does passing a subroutine an undefine (Larry Rosler)
        File locks don't. <s1dugan@nospam.exnet.iastate.edu>
    Re: Help: Win32::Registry (Abhijit Sovakar)
        How can I skip the "." and ".." files when reading in a <barcode@ice.net>
    Re: How can I skip the "." and ".." files when reading  (Bart Lateur)
    Re: How to access a https site mjzanghi@my-dejanews.com
    Re: How to access a https site (yong huang)
    Re: negative subscripts (M.J.T. Guy)
        or vs || <arpin@adan.kingston.net>
    Re: or vs || <garethr@cre.canon.co.uk>
    Re: or vs || (Bart Lateur)
    Re: Removing a directory with contents <gdnova@enteract.com>
    Re: Saving/Reading Hashes (Randal L. Schwartz)
    Re: Sorting arrays <awalrant@softhome.net>
    Re: Sorting arrays (Larry Rosler)
    Re: Sorting arrays (Tad McClellan)
    Re: Tie Fighter (Bart Lateur)
        value from variable in a string <cousin@ensam.inra.fr>
    Re: Y2K. localtime(time) (Clinton Pierce)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 19 May 1999 14:42:18 GMT
From: Jerome Quelin <jquelin@ifaedi.insa-lyon.fr>
Subject: [win32 module] where are the *.al files ?
Message-Id: <7huika$ieo$1@tempo.univ-lyon1.fr>

Hi there,

After installing any prebuild version of perl (activestate's latest build,
or perl5.00402-bindist04 from CPAN/ports/win32), i always get an error
message telling me it cannot find *.al files in the path.

	use Win32::NetAdmin;
	Win32::NetAdmin::GetUser(,,);

And in the lib path, when looking in auto/Win32/NetAdmin, i can not see
the .al file corresponding to the differents functions... All i have is
a .dll and a .pm... No autoloaded functions files.
When i try to reinstall the libwin32 module, once again it doesn't install
those *.al files...

Ever seen that, any clue to this problem ?

Thanks,
Jerome
-- 
jquelin@ifhamy.insa-lyon.fr


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

Date: 19 May 1999 12:46:59 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: Re: _Please_ improve localtime!
Message-Id: <7hubs3$ehu$1@aurwww.aur.alcatel.com>

On Tue, 18 May 1999 21:41:05 GMT, Daniel <occitan@esperanto.org> wrote:

  > Going from 2 to 3 digits in the year returned by localtime is hardly a
  > feature, though it should mostly avert the Y2k headaches.  This likely
  > means touching a lot of proggies before year's end.

This has been hashed and rehashed here, time and time again.  It's
documented to return "the number of years since 1900".  If people have
written code makes use of the "year" value in some other way (like
$year = "19$year"), you certainly can't fault perl.  It's documented, and
there's nothing wrong with it.

John "not understanding why this comes up so often" Klassa

-- 
John Klassa / Alcatel USA / Raleigh, NC, USA


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

Date: Wed, 19 May 1999 09:31:09 -0400
From: "Jim The Perl Guy" <news@thebeaches.to>
Subject: Re: _Please_ improve localtime!
Message-Id: <7huefi$noj$1@news.auaracom.net>

Nope. Don't touch local time.

Perfect just the way it is!

Jim


Daniel Pfeiffer wrote in message <7hsmpi$r6q$1@nnrp1.deja.com>...
>Going from 2 to 3 digits in the year returned by localtime is hardly a
>feature, though it should mostly avert the Y2k headaches.  This likely
>means touching a lot of proggies before year's end.
>
>The other hassle is the absurd month number (time and again I have
>fallen into the trap).  It prevents me from writing something neat like
>join '.', (localtime)[5,4,3].  Instead I have to assign to variables and
>increment the month.  The only advantage of this weird numbering is
>indexing a month-name-array, but then I need a scalar anyways, so it
>doesn't hurt to subtract one.
>
>So, hey, give us poor programmers a break.  Introduce a $^something
>option to give localtime more useful semantics.  And announce that it
>will be the default in 5.007.  Or a more kludgy variant, that will
>however never break existing programmes:  Add two elements to the
>returned list, with alternative proper values.
>
>--
>Perl |berallhin:
>Perl everywhere: http://beam.to/iPerl/
>Perl ^cien:
>
>
>--== Sent via Deja.com http://www.deja.com/ ==--
>---Share what you know. Learn what you don't.---




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

Date: 19 May 1999 08:17:09 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: _Please_ improve localtime!
Message-Id: <7huh55$lks@llama.swcp.com>

[posted and cc'd to cited author]

Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
[snip]
> And the documentation for localtime C function says:
> 
>     Declarations of all the functions and externals, and the tm structure,
>     are in the <time.h> header file.  The structure declaration is:
> 
>        struct  tm {
>                int     tm_sec;   /* seconds after the minute - [0, 59]  */

To be pedantic, this field actually has the range of 0..60 inclusive.
Leap seconds do occur and some of our time sources reflect this.

[snip]
>                long    tm_tzadj; /* seconds from GMT (east < 0) */

I've always thought this was backwards.  Japan is GMT+9:00, but the TZ
variable must be set to "JST -9:00".  Grrr.

[snip the rest]

Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.266.59.96   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Wed, 19 May 1999 15:58:58 +0100
From: "Steven Primrose-Smith" <steven.peter.primrose-smith@avl.com>
Subject: An /e for a match rather than a substitution
Message-Id: <7hug34$1qh@fstgal00.tu-graz.ac.at>

Hi,

If I want to evaluate the right side of a substitution as an expression, I
just use /e. Can I do the same for a match? For example:

$string = "Mississippi";
$expression = "Mis+is+p+i";

if ($string =~ /$expression/) {
    # it should match
}

Best wishes,
Steven
steven.peter.primrose-smith@avl.com




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

Date: Wed, 19 May 1999 05:20:42 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: An /e for a match rather than a substitution
Message-Id: <apvth7.usb.ln@magna.metronet.com>

Steven Primrose-Smith (steven.peter.primrose-smith@avl.com) wrote:

: If I want to evaluate the right side of a substitution as an expression, I
: just use /e. Can I do the same for a match?


   No.

   A m// doesn't even *have* a "right side".

   I dunno what you are meaning there...


: $string = "Mississippi";
                    ^
                    ^   the $expression cannot match that letter...

: $expression = "Mis+is+p+i";

: if ($string =~ /$expression/) {
:     # it should match
: }


   That is interpolation, not code eval()uation.

   That you _can_ do in a m// since it is "double quotish".


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


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

Date: Wed, 19 May 1999 15:11:37 +0100
From: "Dr. A R Daniels" <a.daniels@umist.ac.uk>
Subject: Re: best way to database stuff using Perl?
Message-Id: <7hugql$2pr$1@yama.mcc.ac.uk>

I have found that Win32 - ODBC works well.  Try the following web site for
more information:

http://www.roth.net/perl/odbc/

Note:  This only applies to WinNT based servers - and lets face it lots of
people (apart from the die hard 'shag microsoft' strange people) are moving
over to this platform according to a survey by a leading IT company over
here in the UK.

Tony

<owner@btinternet.com> wrote in message
news:373B76BE.34D09921@btinternet.com...
> OK.....to be short and sweet, access to a cgi-bin on a virtual server.
I've
> heard a lot about these modules, and am wondering if someone can
> explain/advise on the best way of modifying/querying a database file
(created
> from scratch or an existing, preferably MS Access, one)
>
> Thanks again
>
> Ben
>
> Charles R. Thompson wrote:
>
> > [ Congratulations, owner@btinternet.com you could be a winner! Return to
> > comp.lang.perl.misc to claim your prize. ]
> >
> > In article <373B6C9D.7F18C9B@btinternet.com>, owner@btinternet.com
> > says...
> > > I know that the preffered way these days is Cold Fusion, but
> >
> > Like #%(*%# it is. Bad newbie! Bad! :)
> >
> > > say I want to do this via Perl, how would I go about this?
> >
> > Depends on alot. There is a big difference between your choices if you
> > are running your own server in a LAN or WAN deal and renting a little
> > virtual server. Also, depends on what platform you are going to run on.
> >
> > What is the target enviroment for the script(s)? Owned LAN, Virtual
> > Server, Self Maintained Web Server, Windows, UNIX, MAC. The list goes
on.
> >
> > --
> > Charles R. Thompson
> > RainCloud Studios
> > "That? That's no script. That's your attempt at a rather complex README
> > file."
>
>
>




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

Date: Wed, 19 May 1999 09:08:23 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Marc Dietrich <marc.dietrich@physik.uni-giessen.de>
Subject: Re: can someone help me with locking???
Message-Id: <3742C5D7.5F594F39@mail.uca.edu>

[cc'd to md]

Marc Dietrich wrote:
> 
> try the flock mechanism. See perldoc -f flock or man flock. This only
> works on Unix Systems.

BRAAAK! Wrong! Next contestant spin the Wheel, please. flock works on
WinNT, but not on Win9x. I believe I have also seen that it works on
VMS, but have had no experience with that OS since 1982.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Wed, 19 May 1999 09:19:31 -0400
From: "rbbdsb" <rbbdsb@erols.com>
Subject: eliminating lines in extracted text
Message-Id: <7huefg$m5h$1@autumn.news.rcn.net>

Using the range operator, it is easy to extract lines that occur between two
patterns, for example

if (/foo/ .. /bar/) { print; }

It is also possible to exclude specific absolute lines by doing something
like:

next line if (1 .. /^$/);   # skip header lines

What I need to do is eliminate a couple of header and trailer lines at from
the extracted lines, but the absolute line numbers aren't known in advance.
What is the most efficient way to do this?  Is pattern matching the only
option?




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

Date: Wed, 19 May 1999 13:06:34 GMT
From: Don Roby <droby@copyright.com>
To: perlfaq-suggestions@perl.com
Subject: Re: FAQ 4.55: How do I look up a hash element by value?
Message-Id: <7hud0p$vih$1@nnrp1.deja.com>

[Posted and mailed]

In article <37411105@cs.colorado.edu>,
  perlfaq-suggestions@perl.com (Tom and Gnat) wrote:

<snip>

>
>         while (($key, $value) = each %by_key) {
>             $by_value{$value} = $key;
>         }
>
>     If your hash could have repeated values, the methods above will
>     only find one of the associated keys. This may or may not worry
>     you.
>

     But if it does worry you, you can reverse the hash into a
     hash of lists instead, by using

         while (($key, $value) = each %by_key) {
             push @{$key_list_by_value{$value}}, $key;
         }

Of course you know this...  It just might be worth mentioning a
solution to the problem of repeated values once you reference the
problem.

--
Don Roby


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 19 May 1999 06:17:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.65: Why does passing a subroutine an undefined element in a hash create it?
Message-Id: <MPG.11ac599db6d60f39989a9e@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <374270d2@cs.colorado.edu> on 19 May 1999 02:05:38 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
 ... 
>   Why does passing a subroutine an undefined element in a hash create it?
> 
>     If you say something like:
> 
>         somefunc($hash{"nonesuch key here"});
> 
>     Then that element "autovivifies"; that is, it springs into
>     existence whether you store something there or not. That's because
>     functions get scalars passed in by reference. If somefunc()
>     modifies `$_[0]', it has to be ready to write it back into the
>     caller's version.
> 
>     This has been fixed as of perl5.004.
> 
>     Normally, merely accessing a key's value for a nonexistent key does
>     *not* cause that key to be forever there. This is different than
>     awk's behavior.

This is a very strange FAQ.  It refers to a bug that was fixed in the 
major release previous to the current release.  The premise of the 
question itself is now incorrect.

Perhaps the best thing to do with this 'F'AQ is to drop it completely.  
As the Question has no relationship to current reality, it can no longer 
be Frequently Asked, can it?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 19 May 1999 09:34:18 -0500
From: "Darin Dugan" <s1dugan@nospam.exnet.iastate.edu>
Subject: File locks don't.
Message-Id: <7hui5q$v59$1@news.iastate.edu>

Below is the main code I'm using for file locks while reading / writing
files.  The files do NOT get locked.  Any ideas what I could be overlooking?

The basic code is taken from O'Reilly's "Programming Perl" by Randal
Schwartz & Larry Wall.  (A little help, Randal?)  I've tried avoiding the
passed / local variables as well, but it doesn't seem to make any
difference.

Thanks, all.
Darin
----------------
Perl v. 5.00404
Slakware Linux 2.0.34
Sendmail 8.9.0 (actual script runs on /var/spool/mail files if this is
important)

#!/usr/local/bin/perl
#

$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;

open(FILE,"testfile.txt");

&lock(FILE);

# Pause the program to see if it's really locked.
$junk=<STDIN>;

&unlock(FILE);

print "Done\n\n";

sub lock {
  local($handle);
  flock($handle, $LOCK_EX);
  seek($handle, 0, 2);
}

sub unlock {
  local($handle);
  flock($handle, $LOCK_UN);
}





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

Date: Wed, 19 May 1999 16:42:13 +0200
From: 0241968890-0001@t-online.de (Abhijit Sovakar)
To: Michel Dalle <michel.dalle@usa.net>
Subject: Re: Help: Win32::Registry
Message-Id: <3742CDC4.64144642@yahoo.com>

This is a multi-part message in MIME format.
--------------D27838579BE17DF087C89979
Content-Type: multipart/alternative;
 boundary="------------0F0DBB347CB9D14158EB57F8"


--------------0F0DBB347CB9D14158EB57F8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi Michel,

The next lines show my little test program.

use Win32::Registry;

$key  = "SOFTWARE\\TEST";
$name = "TestValue";

$main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die "Open: $!";

$CurrVer->QueryValue($name, $value);

print "value: $value\n";

It should be alright! I created the key and the string value. When I start the script with 'perl
-w test.pl' it only says 'Use of uninitialized value at test.pl line 10.' (print "value:
$value").  That tells me, $value is undefined, isn't it? My conclusion is: it doesn't work!

By the way, I'm using Perl version 5.005_03 built for MSWin32-x86-object.

Greetings,
Abi




Michel Dalle wrote:

> In article <37419990.D7B497E5@yahoo.com>, 0241968890-0001@t-online.de (Abhijit Sovakar) wrote:
> >Hi,
> >
> >I'm a Perl novice, just started a few hours ago. I guess, I have a very
> >simple problem. I just want to read out a value from the registry using
> >the QueryValue() function of the key-object.
> >The key exists, the value exists, but the function does not return the
> >value.
> >
> >What I did:
> >
> >  use Win32::Registry;
> >  $key = "SOFTWARE\\TEST";
> >  $name = "TestValue"
> You seem to be missing a ; after this line (but then Perl should have
> told you that when you try to execute this, no ?).
>
> F:\Perl>perl -w testreg
> Scalar found where operator expected at testreg line 5, at end of line
>         (Missing semicolon on previous line?)
> syntax error at testreg line 5, near "$main::HKEY_LOCAL_MACHINE"
> Execution of testreg aborted due to compilation errors.
>
> >  $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die   "Open: $!";
> >
> >  $CurrVer->QueryValue($name, $value);
> Good
>
> >I tried also
> >
> >  $CurrVer->QueryValue($name, \$value);
> Bad
>
> Otherwise, it should work as advertised :-)
>
> Michel.

--------------0F0DBB347CB9D14158EB57F8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi Michel,
<p>The next lines show my little test program.
<p><tt>use Win32::Registry;</tt>
<p><tt>$key&nbsp; = "SOFTWARE\\TEST";</tt>
<br><tt>$name = "TestValue";</tt>
<p><tt>$main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die "Open: $!";</tt>
<p><tt>$CurrVer->QueryValue($name, $value);</tt>
<p><tt>print "value: $value\n";</tt>
<p>It should be alright! I created the key and the string value. When I
start the script with 'perl -w test.pl' it only says 'Use of uninitialized
value at test.pl line 10.' (print "value: $value").&nbsp; That tells me,
$value is undefined, isn't it? My conclusion is: it doesn't work!
<p>By the way, I'm using Perl version 5.005_03 built for MSWin32-x86-object.
<p>Greetings,
<br>Abi
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p>Michel Dalle wrote:
<blockquote TYPE=CITE>In article &lt;37419990.D7B497E5@yahoo.com>, 0241968890-0001@t-online.de
(Abhijit Sovakar) wrote:
<br>>Hi,
<br>>
<br>>I'm a Perl novice, just started a few hours ago. I guess, I have a
very
<br>>simple problem. I just want to read out a value from the registry
using
<br>>the QueryValue() function of the key-object.
<br>>The key exists, the value exists, but the function does not return
the
<br>>value.
<br>>
<br>>What I did:
<br>>
<br>>&nbsp; use Win32::Registry;
<br>>&nbsp; $key = "SOFTWARE\\TEST";
<br>>&nbsp; $name = "TestValue"
<br>You seem to be missing a ; after this line (but then Perl should have
<br>told you that when you try to execute this, no ?).
<p>F:\Perl>perl -w testreg
<br>Scalar found where operator expected at testreg line 5, at end of line
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Missing semicolon on previous
line?)
<br>syntax error at testreg line 5, near "$main::HKEY_LOCAL_MACHINE"
<br>Execution of testreg aborted due to compilation errors.
<p>>&nbsp; $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die&nbsp;&nbsp;
"Open: $!";
<br>>
<br>>&nbsp; $CurrVer->QueryValue($name, $value);
<br>Good
<p>>I tried also
<br>>
<br>>&nbsp; $CurrVer->QueryValue($name, \$value);
<br>Bad
<p>Otherwise, it should work as advertised :-)
<p>Michel.</blockquote>
</html>

--------------0F0DBB347CB9D14158EB57F8--

--------------D27838579BE17DF087C89979
Content-Type: text/x-vcard; charset=us-ascii;
 name="a_sovakar.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Abhijit Sovakar
Content-Disposition: attachment;
 filename="a_sovakar.vcf"

begin:vcard 
n:Sovakar;Abhijit
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:a_sovakar@yahoo.com
end:vcard

--------------D27838579BE17DF087C89979--



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

Date: Wed, 19 May 1999 08:43:42 -0500
From: "Barcode" <barcode@ice.net>
Subject: How can I skip the "." and ".." files when reading in a directory
Message-Id: <927121423.993.7@news.remarQ.com>

I have a script which reads a named directory, opens each file and removes
the specified line.  However, when I encounter the working and parent
directory files (. and ..) the rename function fails.

How can I skip the opening of the two files and continue with the rest?

Thanks in advance

Troy Olson


My code (so far):

#!/usr/local/perl5/bin/perl -w
# TDO: Script removes desired line of text
# from screen files.

print "Where are the Screens? ";
chomp($newdir = <STDIN>);
chdir($newdir) ||
        die "Cannot move to $newdir: $!";
opendir(SCREEN,".") ||
        die "Can't open $newdir: $!";
foreach (sort readdir(SCREEN)) {
        print "$_\n";
$old = "$_";
$new = "$_.tmp.$$";
$bak = "$_.bak";
open(OLD, "< $old") || die "can't open $old: $!";
open(NEW, "> $new") || die "can't open $new: $!";
while (<OLD>) {
        s/STAGE RIGHT//;
        (print NEW $_)
}
close(OLD) || die "can't close $old: $!";
close(NEW) || die "can't close $new: $!";

# here is where I have trouble renaming files
# when I encounter the working and parent file
# names "." and ".." I would like to skip the
# two files.
rename($old, $bak) || die "can't rename $old to $bak: $!";
rename($new, $old) || die "can't rename $new to $old: $!";
}
closedir(SCREEN);
print "\n\n\nDONE!!\n";





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

Date: Wed, 19 May 1999 13:57:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How can I skip the "." and ".." files when reading in a directory
Message-Id: <3742c2db.18149801@news.skynet.be>

Barcode wrote:

>I have a script which reads a named directory, opens each file and removes
>the specified line.  However, when I encounter the working and parent
>directory files (. and ..) the rename function fails.
>
>How can I skip the opening of the two files and continue with the rest?

	foreach (readdir(DIR)) {
		next if $_ eq '.' or $_ eq '..';
		# go ahead!
		print "Entry: $_\n"; #example
	}

BTW shouldn't you check for subdirectories too?

	Bart.


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

Date: Wed, 19 May 1999 13:18:12 GMT
From: mjzanghi@my-dejanews.com
Subject: Re: How to access a https site
Message-Id: <7hudmj$1m$1@nnrp1.deja.com>

Hi, I have the same problem as you have!  Has anyone responded yet?  I
haven't seen any postings to deja news regarding your question.  I was
wondering if anyone has emailed you with a response and if so, could
you please pass the info on to me.  I would really appreciate it.

Thanks,

Mike
mjz01@health.state.ny.us



In article <7hs55u$f76$1@nnrp1.deja.com>,
  yong321@yahoo.com wrote:
> I want to write a simple Perl script to access a Web page using Secure
> Socket Layer. But lwp-request doesn't support https. All I want is to
> go to https://ourserver/ and send a username/password to see if our
> database is down again. I want to run it every midnight for this check
> until I find the real problem with our database.
>
> Can anyone tell me how to access a SSL web page? Thanks.
>
> Yong
> Email:yong321@yahoo.com
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 19 May 1999 06:42:00 -0800
From: yong321@yahoo.com (yong huang)
Subject: Re: How to access a https site
Message-Id: <w8A03.446$kd3.417561@WReNphoon3>

After I posted the question, I found www.openssl.org. And also found
Net::SSLeasy module on CPAN. But since I use ActiveState Perl for WindowsNT,
I haven't figured out how to install a module not shown by the "ppm search"
command. (ppm is ActiveState's perl package manager). I'll do a little
research. What's your $^O?

Yong



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: 19 May 1999 13:49:57 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: negative subscripts
Message-Id: <7hufi5$64b$1@pegasus.csx.cam.ac.uk>

Thomas Wade Vaughan <vaughan@well.com> wrote:
>A co-worker wanted to know if we could start the index of an array
>with a negative value. Initially I said no, but later thought of
>changing the $[ variable to -5. This seemed to work until I put the 
>array in a for loop and the behavior was what I thought a negative
>index should be. I mean the array was indexed from the end.  Is this
>bug or what.? I agree that I have no need to start an array index off 
>with a negative value, but what is going on here where it works correctly
>before the for loop.

The for loop stuff is a red herring.    Try this:

$[=-5;
@array=(1..10);
$i = -5;
print "Last element $#array , -5 the 1st element is $array[-5]\n";
print "Last element $#array , -5 the 1st element is $array[$i]\n";

which prints

Last element 4 , -5 the 1st element is 1
Last element 4 , -5 the 1st element is 6

I'd guess it's something to do with whether the subscript is evaluated
at compile time or run time.

But as others have pointed out, the behaviour is undefined and deprecated.


Mike Guy


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

Date: Wed, 19 May 1999 09:53:28 -0400
From: "Andre Arpin" <arpin@adan.kingston.net>
Subject: or vs ||
Message-Id: <3742c1e9.0@news.cgocable.net>

Given the following definition I would not expect the output from my
program.

Logical and, or, not, and xor
     As more readable alternatives to &&, ||, and !, Perl provides the and,
    or and not operators. The behavior of these operators is identical--in
    particular, they short-circuit the same way.[34]

from
  Programming Perl
  By Larry Wall


It seems that >>> or and || <<<  are different in more ways then precedence.
Any one knows the proper definition.

sub a
{
 $x='';
 print "$x  a  ";
 return $x;
}

sub b
{
 print "b  ";
 return 1;
}

print "or >>";
print a or b;
print "\n";
print "|| >>";
print a || b;

##################################################

OUTPUT:

or >>  a
|| >>  a  b  1






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

Date: Wed, 19 May 1999 14:17:07 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
To: "Andre Arpin" <arpin@adan.kingston.net>
Subject: Re: or vs ||
Message-Id: <sivhdpdtzw.fsf@cre.canon.co.uk>

Andre Arpin <arpin@adan.kingston.net> wrote:
> It seems that "or" and "||" are different in more ways then
> precedence.

Precedence rules mean that

> print a or b;

is the same as "(print a) or b;" while

> print a || b;

is the same as "print +(a || b);"

If you look at the precedence table in the perlop manpage, you'll see

         left        ||
         ...
         nonassoc    list operators (rightward)
         ...
         left        or xor

meaning that the list operator "print" binds tighter than "or" but less
tightly than "||".

-- 
Gareth Rees


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

Date: Wed, 19 May 1999 14:37:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: or vs ||
Message-Id: <3743cbb0.370633@news.skynet.be>

Andre Arpin wrote:

>print "or >>";
>print a or b;

Does:
	(print a) or b; 

(where print() returns 1 if succesful) 

>print "\n";
>print "|| >>";
>print a || b;

Does:
	print +(a || b);

Yup. It's precedence alright.

	Bart.


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

Date: Wed, 19 May 1999 09:26:35 -0500
From: "Jeff Foege" <gdnova@enteract.com>
Subject: Re: Removing a directory with contents
Message-Id: <7huhod$lc7$1@eve.enteract.com>

Thanks David.  The only thing that is happening is it prints out the die
line and $0 is whatever I put. I guess I should have said that I am also
doing this on NT for now. I don't have that #!/usr/bin/perl line in my code
at all. I thought it was a comment and since it was showing unix folders I
didn't bother. Where do I feed in the folder that I want deleted?

Sorry about the text lines. I am heading into work right now and they don't
have a ng port set up yet so I won't be able to respond until I get home,
unless you use the email below.

Thanks for your help!

Jeff

use File::Find qw(finddepth);
die "usage: $0 dir ..\n" unless @ARGV
*name = *File::Find::name;
finddepth \&zap, @ARGV;
sub zap {
    if (!-1 && -d _) {
        print "rmdir $name\n";
        rmdir ($name) or warn "couldn't rmdir $name: $!";
    } else

        print "unlink $name\n";
        unlink ($name) or warn "couldn't unlink $name: $!";
    }
}


David Cassell wrote in message <3742039F.81E55C22@mail.cor.epa.gov>...
>Jeff Foege wrote:
>>
>> First let me start off by saying I am new to Perl, as I'm sure you know
by
>> the subject line. I'm having problems with the routine out of the
cookbook
>> for removing a directory and anything below it.
>
>Actually, your subject line looks good.  It doesn't have the
>annoying word 'newbie', nor does it have an all-caps desperate
>shout for help.
>
>Your text lines are a hair long, though.  They really wrapped
>when I was writing this response.
>
>> I was looking at Example 9.3 rmtree1 I could type the example but I
figured
>> I wouldn't waste anyones bandwidth plus I'm sure a lot of people might
have
>> the cookbook already.
>
>It wouldn't have hurt, since the code is only 15 lines.
>
>Always cut-and-paste, though.  Never re-type.  If you make a
>typo, no one will be able to tell whether it's in your real
>code or not.
>
>Now then, let me tell you that TomC's code has a sort of a
>bug in it.  It's not a bug for the code in the book.  It's
>a bug for anyone else using it.  Change the first line to:
>
>#!/usr/bin/perl -w
>
>This will turn on warnings, which may help you track down
>any little typos or glitches.
>
>> I trying to delete a folder : e:\aveenon\base\bldback
>>
>> That folder contains another folder \disk1 which may contain some files.
I
>> want Perl to delete the whole bldback folder and anything below it. I
guess
>> I just wasn't using the example correctly. If someone could point me the
>> right direction or maybe explain that example a little more would help a
>> great deal.
>
>Well, the code should print out a series of messages, listing the
>directories and files that couldn't be removed.  What errors did
>you get when you tried it?
>
>> Thanks, Jeff
>>
>> If you could also send your response to jeff_foege@nmss.com
>
>Since you didn't ask for e-mail only, I did it.
>
>David
>--
>David Cassell, OAO                     cassell@mail.cor.epa.gov
>Senior computing specialist
>mathematical statistician




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

Date: 19 May 1999 06:42:05 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Saving/Reading Hashes
Message-Id: <m1btfhgor6.fsf@halfdome.holdit.com>

>>>>> "Eric" == Eric Bohlman <ebohlman@netcom.com> writes:

Eric> : But both are far slower and less robust than something like Storable
Eric> : for large data in keys/values or complicated interrelationships.

Eric> use MLDBM qw(DB_File Storable); and get the best of both worlds.

Not really.  MLDBM doesn't handle assignment to nested data structures
transparently.  You have to make sure that you're always changing the
toplevel data structure at some point before exiting so that the
->STORE method is called to flush to disk.  Not to mention that the
tie interface isn't the speediest.

No, for my money, when someone wants to put something on disk, I say
"use Storable" still.  MLDBM offers very little advantage (stuff gets
on disk sooner *if* you do it just right) for a huge potential
disadvantage (you might do it wrong and not store at all).

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Wed, 19 May 1999 15:08:07 +0200
From: Alain Walrant <awalrant@softhome.net>
Subject: Re: Sorting arrays
Message-Id: <3742B7B7.B3A84327@softhome.net>

If your talking about sorting list, just use the sort function.

@x = sort @y;

You can even specify the comparison function you'll use.

If your talking about sorting hashes, it's just a little more complex. Sort the
keys or the values and then fetch the data back via the list returned.
Refer to the Pod for more infiormation and sample.

Alain.


Sam Allen wrote:

> Can you sort arrays to order their entries alphabetically, without having to
> write a shit load of sorting code yourself!



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

Date: Wed, 19 May 1999 06:23:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting arrays
Message-Id: <MPG.11ac5b1551df9d8b989a9f@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7hu4ik$a3h$1@supernews.com> on Wed, 19 May 1999 11:40:05 
+0100, Sam Allen <sa@community.net.uk> says...
> Can you sort arrays to order their entries alphabetically, without having to
> write a shit load of sorting code yourself!

Yes, I can.

    my @sorted = sort @array;

Now what was your question again?  Did you do *any* investigation before 
asking it?

Perl comes with a rich set of built-in functions with which you should 
get acquainted.

    perldoc perlfunc

and, in particular,

    perldoc -f sort

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 19 May 1999 03:37:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Sorting arrays
Message-Id: <enpth7.dhb.ln@magna.metronet.com>

Sam Allen (sa@community.net.uk) wrote:
: Can you sort arrays to order their entries alphabetically, without having to
: write a shit load of sorting code yourself!


   Yes.

      @sorted = sort @stuff;  # no shit load here (ASCIIbetical sort).

      @sorted = sort {lc($a) cmp lc ($b)} @stuff;  # case insensitive sort


   The Perl FAQ has several questions, and even more example code,
   for sorting.


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


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

Date: Wed, 19 May 1999 13:25:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Tie Fighter
Message-Id: <3746bbb3.16317778@news.skynet.be>

Chris Nandor wrote:

># Instead of returning the tied scalar, return a reference to it.  Then assign
># the reference to a typeglob.
>
>A solution requiring the use of global variables is no solution at all.

Aren't you being a little too "strict"?

[duck&run]

	Bart.


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

Date: Wed, 19 May 1999 13:36:40 +0000
From: Xavier Cousin <cousin@ensam.inra.fr>
Subject: value from variable in a string
Message-Id: <3742BE68.4184D783@ensam.inra.fr>

Hello,

i have graphical variable defined as follow (it's for fly) :

arc $x-100 $y 20 100 180 0 255 0 0

each one parsed in an array. When $x and $y are defined, i use

$graph =~ s/\$(\w+)/${$1}/eg;

and $x and $y are converted to their numerical values

but $graph become 170-100 and not 70.

How can i force the script to execute this operation ??

Thanks,

Xavier

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xavier Cousin                     cousin@ensam.inra.fr

    INRA - DCC                        tel. (33) 04 99 61 28 14
    2, place Pierre Viala             fax  (33) 04 67 54 56 94
    34060 Montpellier Cedex 1

    ESTHER URL http://www.ensam.inra.fr/cholinesterase/





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

Date: Wed, 19 May 1999 13:44:24 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: Y2K. localtime(time)
Message-Id: <3745bffe.430308721@news.ford.com>

On 19 May 1999 09:55:50 +1000, norm@turing.une.edu.au (Norman Gaywood)
wrote:
>fl_aggie@thepentagon.com (I R A Aggie) writes:
>
>>Perl's localtime gets its information from the underlying system. If
>>you really do have a Y2K problem in a perl script, the odds are very
>>good that you have a Y2K problem in your OS...
>
>Not quite. It's not hard for idiots to introduce Y2K bugs. Look at
>these lines from the popular(!?) perl message board program, wwwboard.pl:
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
>
>OK so far, but after some truly horrible lines of code we get to this
>shocker:
>
> $long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
>
>So the year 2000 will look like "19100". Smart stuff!

This is the same program with open() statements that don't check their
success.

Human stupidity is boundless.


-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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