[15694] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3107 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 20 11:05:23 2000

Date: Sat, 20 May 2000 08:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <958835109-v9-i3107@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 20 May 2000     Volume: 9 Number: 3107

Today's topics:
    Re: "If" Not Being Evaluated - Vars Are Being Subsitute (Bart Lateur)
    Re: "If" Not Being Evaluated - Vars Are Being Subsitute <uri@sysarch.com>
    Re: a wacky idea (Bart Lateur)
    Re: a wacky idea <flavell@mail.cern.ch>
    Re: a wacky idea (Philip 'Yes, that's my address' Newton)
    Re: a wacky idea <flavell@mail.cern.ch>
    Re: alphabeticalize a perl array <iltzu@sci.invalid>
        Directory listing query with Net::FTP::list <miles@explorer.demon.co.uk>
    Re: Directory listing query with Net::FTP::list <sweeheng@usa.net>
        Exec <lankamp@casema.net>
    Re: Forum for 'how to do it' questions? (Eric Bohlman)
    Re: How to convert a long integer into hex <lr@hpl.hp.com>
    Re: HTML output from MS Word (Was: Re: alphabeticalize  (Eric Bohlman)
        I'm free to travel now (Randal L. Schwartz)
    Re: Novice request for help to simplify matching <ra.jones@NO_UCE*cwcom.net>
        OLE & Excel & Enum <simon.brown@kns.ch>
    Re: pc line breaks (David Efflandt)
    Re: pc line breaks (Eric Bohlman)
    Re: pc line breaks <flavell@mail.cern.ch>
    Re: pc line breaks (Philip 'Yes, that's my address' Newton)
        perl for windows 95 (Call Expedient)
    Re: PPMFIX Doesn't Fix Anything (Bart Lateur)
    Re: Q: children, signals, etc... (Bart Lateur)
        Sorry... (Lobo)
    Re: the use of $_ (Bart Lateur)
    Re: the use of $_ (Philip 'Yes, that's my address' Newton)
    Re: the use of $_ (Tad McClellan)
    Re: Use/Require Difference (Bart Lateur)
    Re: What book on perl-cgi for a perl-programmer? <fty@mediapulse.com>
    Re: Windows: Accesing a DLL <john.alderson@fmr.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 20 May 2000 09:00:16 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: "If" Not Being Evaluated - Vars Are Being Subsituted?
Message-Id: <392653c1.267429@news.skynet.be>

Uri Guttman wrote:

>  BL> 	  <IMG SRC="test.jpg"  BORDER=0 ALT="Test">

>  BL> How does Perl interpret this... junk?
>
>ever heard of a file glob?

I thought of that. Only, I had assumed that Perl would reject globs
containing spaces, and without any '?' or '*'.

-- 
	Bart.


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

Date: Sat, 20 May 2000 13:47:43 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: "If" Not Being Evaluated - Vars Are Being Subsituted?
Message-Id: <x78zx5fi4h.fsf@home.sysarch.com>

>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:

  BL> Uri Guttman wrote:
  BL> <IMG SRC="test.jpg"  BORDER=0 ALT="Test">

  BL> How does Perl interpret this... junk?
  >> 
  >> ever heard of a file glob?

  BL> I thought of that. Only, I had assumed that Perl would reject globs
  BL> containing spaces, and without any '?' or '*'.

but perl doesn't interpret the contents of <GLOB>. it just passes the
string to csh (pre 5.6) and returns its results. in 5.6 there is an
module which does this without a fork but i bet perl still doesn't look
at the contents of <GLOB>.

anyhow it iwas one of larry's few mistakes, making that an operator and
not a named function. even with glob() around now, most still use
<>. it's not like you write globs right and left and you need some short
symbol for it. glob() would have been just fine and it would have
eliminated one of the more annoying aspects of i/o by allowing
<$foo->{handle}> to work as expected.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 20 May 2000 09:40:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: a wacky idea
Message-Id: <39285cdc.2598886@news.skynet.be>

Nico Zigouras wrote:

>Jonah wrote:
>> Ok, is it possible to run a perl script from a graphic on a standard
>> html page?
>> 
>> Example.
>> <img src="http://www.server.com/cgi-bin/image.cgi">

>Yes, you can do this two ways.
>
>1. redirect your script to an image like:
>print"Location: /images/my_image.gif\n\n";
>
>2. Use a graphics module to create it on the fly.
>See the GD.pm module on CPAN - it is a great tool.

Third: you can make the script pick a (random) file from your server,
and in a loop, read a few k from the file and print it out. But first,
you need a proper content-type header (like "image/gif" or
"image/jpeg"), and you should apply binmode() on both the file handle
and the STDOUT handle.

-- 
	Bart.


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

Date: Sat, 20 May 2000 12:08:47 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: a wacky idea
Message-Id: <Pine.GHP.4.21.0005201157130.27071-100000@hpplus01.cern.ch>


On Fri, 19 May 2000, Nico Zigouras alerted the world by hanging
upside down from the nearest nntp server:

> 1. redirect your script to an image like:
     ^^^^^^^^
> print"Location: /images/my_image.gif\n\n";

This is one of the two distinct kinds of CGI Location response.
The other one is the one that causes a redirection.  This one, 
which doesn't cause a redirection, might very well be the one
that's wanted, if I could understand what it is that the original
poster is trying to achieve.  Then again, it might not.

The CGI authoring group would seem a more appropriate place to raise
this question if the OP wants a useful discussion about it.

I suppose they might just be looking for <IMG ...
SRC="/path/to/image.cgi?foo=bar&amp;baz=lala"> kind of thing, but it's
hard to tell.  After all, they wanted to "save the query string to
file", but they didn't have a query string to save.  It isn't a Perl
language issue, anyhow.





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

Date: Sat, 20 May 2000 10:56:03 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: a wacky idea
Message-Id: <392649a1.311474360@news.nikoma.de>

On Fri, 19 May 2000 23:38:10 -0400, Nico Zigouras
<zigouras@mail.med.upenn.edu> wrote:

>Yes, you can do this two ways.
>
>1. redirect your script to an image like:
>print"Location: /images/my_image.gif\n\n";
>
>2. Use a graphics module to create it on the fly.
>See the GD.pm module on CPAN - it is a great tool.

3. Read a file from disk and spit it out to STDOUT. (Usual caveat about
'binmode' applies on the appropriate systems.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Sat, 20 May 2000 14:11:54 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: a wacky idea
Message-Id: <Pine.GHP.4.21.0005201340280.3170-100000@hpplus01.cern.ch>

On Sat, 20 May 2000, Philip 'Yes, that's my address' Newton wrote:

> >1. redirect your script to an image like:
> >print"Location: /images/my_image.gif\n\n";
[..]
> 3. Read a file from disk and spit it out to STDOUT.

Yes, but there's no point, because the results are entirely equivalent
to what item 1 is documented to do anyway (in a parsed-headers CGI
script, I should have stressed).  The server is mandated to send HTTP
status 200 OK and the contents of the cited URLpath.

> (Usual caveat about 'binmode' applies

It would, yes, if you insist on doing the work yourself.  Not
forgetting to do it on input _and_ output, of course.

> on the appropriate systems.)

binmode() is entirely appropriate on all systems, including those on
which it has a null effect.  IME the unix bigots cause far more
trouble by trying to omit it.  (Disclaimer: I use unix systems too,
but have used far to many other OSes also.)

By the way, I now see that this thread had also been launched on
comp.infosystems.www.authoring.cgi, where it would have been more
appropriate in the first place.  Presumably the OP was responding to
Jeff Z's helpful suggestion, but doing it in such a way that we didn't
get to hear about it here. f'ups prophylactically suggested.




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

Date: 20 May 2000 08:20:46 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: alphabeticalize a perl array
Message-Id: <958810377.29278@itz.pp.sci.fi>

In article <Pine.GHP.4.21.0005191722540.4238-100000@hpplus01.cern.ch>, Alan J. Flavell wrote:
>On 19 May 2000, Ilmari Karonen wrote:
>> tidied-up version up at http://www.sci.fi/~iltzu/sort_paper_tidy.html
>> temporarily
>
><pedant>Still missing one ALT attribute, and contains two proprietary 
>extensions</pedant>

Indeed.  Html-tidy is a marvellous program, but one can't expect it to
do miracles.  There are several obvious-to-a-human things that could
be done with its output, such as removing TT tags from PRE blocks.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: Sat, 20 May 2000 09:22:52 +0100
From: "Miles Davenport" <miles@explorer.demon.co.uk>
Subject: Directory listing query with Net::FTP::list
Message-Id: <958810346.27657.0.nnrp-12.d4e4dc01@news.demon.co.uk>

I have been trying to capture a directory listing from an FTP server using
the "list" method (part of Net::FTP).

I can't figure out how to put the list into an array or hash, and cannot
reference the type glob it returns.

Been looking for an example on the web, but can't find one.

Any help would be appreciated.

thanks

Miles.




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

Date: Sat, 20 May 2000 17:07:24 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Directory listing query with Net::FTP::list
Message-Id: <8g5jup$1eg$1@violet.singnet.com.sg>

Miles Davenport <miles@explorer.demon.co.uk> wrote in message
news:958810346.27657.0.nnrp-12.d4e4dc01@news.demon.co.uk...
> I have been trying to capture a directory listing from an FTP server using
> the "list" method (part of Net::FTP).
You should really be using the ls() method.

> I can't figure out how to put the list into an array or hash, and cannot
> reference the type glob it returns.
>
> Been looking for an example on the web, but can't find one.
Looking in the wrong place. Try "perldoc Net::FTP" instead.

Here is some code that worked for me:

====
use Net::FTP;

($ftpserver, $user, $passwd) = @ARGV;
exit unless $passwd;

$ftp = Net::FTP->new($ftpserver);
$ftp->login($user, $passwd);
# list user directory AND gfx/ sub-directory
@dirlist = $ftp->ls('.', 'gfx');
$ftp->quit;

print "@dirlist\n";
====

General advice: When using module Cool::Stuff, do "perldoc Cool::Stuff"
first. If the docs is unclear, do "perldoc -m Cool::Stuff" to read the
source. Still don't understand? Then go deja.com to look for "Cool::Stuff"
in "comp.lang.perl.*". If all else fails and your boss is threatening you,
post to comp.lang.perl.misc/modules. Finally, pray very hard. :)

Swee Heng




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

Date: Sat, 20 May 2000 12:46:47 +0200
From: "Michiel Lankamp" <lankamp@casema.net>
Subject: Exec
Message-Id: <39266d8b$0$7294@reader2>

Which command must I use to execute a shell command, while continuing the
perl-script? Why?
I want to execute a shell command using my browser, I don't want to see the
result of the executed command!!

Thankz..




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

Date: 20 May 2000 07:31:00 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Forum for 'how to do it' questions?
Message-Id: <8g5evk$h0k$1@slb7.atl.mindspring.net>

Lauren Smith (lauren_smith13@hotmail.com) wrote:
: If you ask a question that is covered in the FAQ here in clpm, you'll
: usually get a terse redirect to the FAQ.  If you ask more than once, you run
: the risk of having all your questions ignored.

That probably should read "...redirect to the FAQ from those who know what
they're talking about, plus any number of answers that may or may not be
correct." 

: If you have done your homework and still can't figure something out, the
: kind folks of comp.lang.perl.misc are a great resource.  Here's a template
: for posting:
: 
: 1) Clear title
: 2) Clear explanation of the problem
:     - What you expect
:     - What is actually happening
: 3) Short snippet of code that exhibits the unexpected behavior

  - Cut-and-pasted into your post, not retyped.  Retyping can introduce 
    additional errors, and can even mask the actual error.
   -Snippet should compile without syntax errors.


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

Date: Sat, 20 May 2000 06:48:14 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to convert a long integer into hex
Message-Id: <MPG.138f82829bb2f75d98aaa2@nntp.hpl.hp.com>

In article <3925A5AC.C982FBF6@scanlaser.nl> on Fri, 19 May 2000 22:35:56 
+0200, Bert IJff <bert@scanlaser.nl> says...

 ...

I don't know how important efficiency is in this problem, but the two 
changes I've made below should help.

> #!/usr/local/bin/perl -w
> use strict;
> 
> sub l2h
> {
>     my $v = shift;
>     my @i ;
>     while($v) {
>         @i = ($v%16, @i);

          unshift @i, $v%16;

>         $v = int($v/16);    # <-- indicated line
>     }
>     join('', map (sprintf("%X", $_), @i));

      sprintf '%X' x @i => @i

> }
> 
> print l2h(9969772182300) . "\n";

Alternatively, you could just push the digits onto the array, then use 
reverse() before printing them.

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


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

Date: 20 May 2000 11:39:20 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: HTML output from MS Word (Was: Re: alphabeticalize a perl array)
Message-Id: <8g5th8$ifr$1@slb7.atl.mindspring.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: Well aware of the vagaries of MS Word's HTML output, I wrote a minimal 
: filter needed to produce correct output on the Nutscrape and Exploder 
: browsers.  At no time was any concern or interest given to HTML 
: validation.  To put it bluntly, who the hell cares?  My task was to 
: produce viewable HTML; I did it.  If I addressed only 99% of the world's 
: browsers, I guess I should apologize, but I won't.

The history of the Web is full of cases of pseudo-HTML that worked on 99% 
of the world's browsers at the time it was written, and less than half of 
them a year later (the classic example is the way early versions of 
Netscape tolerated unclosed quotes around attribute values).



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

Date: 20 May 2000 07:18:13 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: I'm free to travel now
Message-Id: <m1u2ft4862.fsf@halfdome.holdit.com>


[Please excuse the off-topic post in comp.lang.perl.misc, but I
presume this is information in which many of the Perl community are
interested.]

Just got word from my lawyer that Judge Bonebrake has authorized
me to transfer from supervised probation to bench probation.

Among other things, this means I can now travel freely for the first
time since my indictment in March 94.

To celebrate, I drove across the bridge north of Portland, Oregon to
Vancouver, Washington.  And stood in a different state for the first
time in six years of my own free will.  (Of course I took pictures --
they'll be at http://www.stonehenge.com/merlyn/Pictures/ soon. :)

On the appeal front, the Oral Presentation to the Oregon Appeals Court
was nine months ago.  I'm told it could still be a while longer before
the judges hand down a decision.  And for those of you that keep
thinking "well, that's all over for Randal now", nope... this is just
round 2 of what's likely to be a process that will continue for a few
more years.

But today is a good day.

For information about my ongoing legal case, send email to my perlbot
at <fund@stonehenge.com> (content ignored), or visit the websites at:

  http://www.lightlink.com/fors/

and

  http://www.rahul.net/jeffrey/ovs/

print "Just another Perl hacker," # and convicted felon

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sat, 20 May 2000 11:39:19 +0100
From: jones <ra.jones@NO_UCE*cwcom.net>
Subject: Re: Novice request for help to simplify matching
Message-Id: <rR8BnKAXtmJ5EwRK@cwc.com>

Jeff,

Thanks for the suggestions. Although it doesn't work as written, I used 
your idea of using 'if it matches then exit', as in:

  ($ENV{'REMOTE_ADDR'} =~ /$ipx[$i]/) {
         $xcount = $count - $i;
         last
         }

The fix is not as elegant as yours, but it works - I tested it up to 50 
lines of a log file. I'm not sure why your suggestion didn't work - it 
did not return a value for $xcount.  Perhaps I should have given you the 
code to load the log file array:

open(DB,"$logfile");
   @list = <DB>;
   $zz = @list;
close(DB);

# then:
  @listr = reverse(@list);
   for ($i = 0; $i < $zz; $i++) {
# etc.

The idea is to match a visitors IP address to a reload log file, and 
subtract a value of 1 for each line up from the bottom their IP matches. 
The reason for only using the first 3 elements of the IP is that 
visitors from some ISP's eg AOL get a different IP address for each hit, 
but usually only the fourth element changes.

On Fri, 19 May 2000 at 23:11:51, Jeff Helman <jhelman@wsb.com> wrote:
>Okay.  So if I get you correctly, if the first line in the file matches
>the user's IP, then $xcount is given a value of 1?  If so, do this:
>
>foreach ($i = $count; $i > 0; $i--) {
>        ($date, $time, $addr) = split(/ /, $_);
>        $addr =~ s/\.\d+$//;
>       ## NOTE THE CHANGE HERE -- THANKS, BRAD
>        if ($ENV{'REMOTE_ADDR'} =~ /^\Q$addr\E/) {
>                $countx = $i;
>                last;
>        }
>}
>
>If the first line in the file should return 0, just subtract 1 from
>whatever value of $countx this thing returns.
>
>JH
-- 
Richard Jones, Leeds, UK
rajones (at) mail.com


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

Date: Sat, 20 May 2000 14:12:26 +0200
From: "Simon Brown" <simon.brown@kns.ch>
Subject: OLE & Excel & Enum
Message-Id: <8g5vfa$mtbn$1@fu-berlin.de>

Hi All,

How do I get at msoTextureParchment, a member of Office.msoPrestTexture? I
don't know the necessary syntax. I want to use it in a statement like:

$Chart->PlotArea->Fill->PresetTextured({PresetTexture =>
msoTextureParchment});

Thanks,

Simon - please reply to simon.brown@kns.ch as well.

--
Simon Brown, 7031 Laax, Switzerland




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

Date: 20 May 2000 11:29:29 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: pc line breaks
Message-Id: <slrn8ictob.kt0.efflandt@efflandt.xnet.com>

On Sat, 20 May 2000, Markus Svilans <bh447@freenet.carleton.ca> wrote:
>
>Does anyone know the regular expression to match PC line breaks? I'm
>reading data in from a file that has PC linebreaks, and due to
>circumstances it is not possible to convert the file to Unix format.

Line breaks in DOS/Win text files are \r\n

Note that unconverted DOS/Win Perl scripts will not run on a Unix system
automatically because the shell will not be able to find "perl^M".
However, they will run as "perl scriptname".

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: 20 May 2000 12:00:57 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: pc line breaks
Message-Id: <8g5upp$ifr$2@slb7.atl.mindspring.net>

David Efflandt (efflandt@xnet.com) wrote:
: On Sat, 20 May 2000, Markus Svilans <bh447@freenet.carleton.ca> wrote:
: >
: >Does anyone know the regular expression to match PC line breaks? I'm
: >reading data in from a file that has PC linebreaks, and due to
: >circumstances it is not possible to convert the file to Unix format.
: 
: Line breaks in DOS/Win text files are \r\n

It's really best to write that as \015\012 instead, as that will represent
a CRLF sequence on any platform, whereas the actual value of \n varies
from platform to platform; the values just happen to be correct on Unix, 
but would be wrong on a Mac or on a Win32 system reading a file in binary 
mode.




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

Date: Sat, 20 May 2000 14:05:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: pc line breaks
Message-Id: <Pine.GHP.4.21.0005201352281.3170-100000@hpplus01.cern.ch>

On 20 May 2000, David Efflandt wrote:

> Line breaks in DOS/Win text files are \r\n

I don't find that helpful, sorry.  \r and \n are logical functions:
their representation in terms of ASCII control characters is
platform-dependent (and that's even before we start to consider
EBCDIC-based platforms).

The perlport document has helpful notes on cross-platform newline
issues.

I suggest it would be more effectively expressed by saying that
"DOS/Win text files, if read in binary mode, will be found to have
\015\012 as their line breaks".

> Note that unconverted DOS/Win Perl scripts will not run on a Unix system

Perl scripts are text files, and should be transferred as such. Then,
there is no problem.  The problem that you are describing, only occurs
when files are inappropriately accessed (e.g FTP-ed cross-platform in
binary mode, Samba remote file access etc.).

IBM mainframe NFS even had(*) different file mounting modes for binary
and for text files, as a solution to the dilemma.

(*)presumably still has, but I don't work with them any more.



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

Date: Sat, 20 May 2000 14:08:01 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: pc line breaks
Message-Id: <39269c09.332573890@news.nikoma.de>

On 20 May 2000 11:29:29 GMT, efflandt@xnet.com (David Efflandt) wrote:

>Note that unconverted DOS/Win Perl scripts will not run on a Unix system
>automatically because the shell will not be able to find "perl^M".
>However, they will run as "perl scriptname".

Hm? They will run just fine, since the system will be looking for a
program called 'perl'. The option '-w^M' that perl gets passed might
look a bit strange.

Or what does your shebang line look like?

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: 20 May 2000 15:04:35 GMT
From: callexpedient@aol.com (Call Expedient)
Subject: perl for windows 95
Message-Id: <20000520110435.10281.00000608@ng-md1.aol.com>

I recently downloaded perl for windows 95.  I have a perl tutorial from
www.ebb.org/pickingupperl.  I am trying to create a small program to determine
if perl is installed properly on my computer, however I have no idea how to go
about getting perl to work.

Can someone give me an overall view of the process I should follow to test my
simple program?  What program do I use to actually write my program?  Once I
have written my program, how do I go about running it to see if it works?

Thanks A Million to whoever can help me!
callexpedient@aol.com


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

Date: Sat, 20 May 2000 10:52:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: PPMFIX Doesn't Fix Anything
Message-Id: <3927689a.345533@news.skynet.be>

mschore@mindspring.com wrote:

>Does anyone understand the following behavior:
>J:\Perl>ppmfix
>
>J:\Perl>ppm verify --upgrade --location=. PPM
>Failed to load PPM_DAT file

Eh? This file doesn't even exist.

>Error verifying PPM: Package 'PPM' has not been installed by PPM
>
>I unzipped the fix file directly to the Perl directory.

Oops. You shouldn't. You'd better unzip it into a temporary directory,
while maintaining the directory structure in the ZIP file.

>I just did a fresh install of Perl on a Win 2K machine and I am seeing
>behavior not seen before. PPM is totally inoperative as well. I was
>hoping the the "fix" would solve this problem.

No, PPM ought to work without any fix. It's not *taht* broken.

At least I hope you did a reboot after installing Perl? The only reason
is that the bin directory of your Perl installation should be in the
PATH environment variable. It is in AUTOEXEC.BAT, but not yet in PATH
without a reboot.

If you add that directory to PATH in a DOS window, chdir to the
directory containing PPMFIX.BAT, and run it from there, then it ought to
work, too.

I haven't tried it on Win2k, though. I don't have a copy of that
monster.

-- 
	Bart.


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

Date: Sat, 20 May 2000 09:02:31 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Q: children, signals, etc...
Message-Id: <39275438.387056@news.skynet.be>

Gwyn Judd wrote:

>You mean any correctly written signal handler (for some definition of
>correctly written) will eventually crash? Why is that?

It must be in the docs somewhere. I have read of it, at one time.

The main thing is that the memory allocation primitives are not
reentrant. If a signal comes in the middle of one, and your signal
handler does some memory allocation (hard to prevent in Perl), it goes
boom.

-- 
	Bart.


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

Date: Sat, 20 May 2000 11:19:43 GMT
From: er@matrix.com.br (Lobo)
Subject: Sorry...
Message-Id: <39267487.11395672@news.matrix.com.br>

I don't konw why, but my newsreader didn't show me your answers for my
"Perl for Windows Question".

Sorry for the spam.

Best regards,




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

Date: Sat, 20 May 2000 10:52:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: the use of $_
Message-Id: <39296ad7.918346@news.skynet.be>

Brian McDonald wrote:

>I am confused by the manner in which Perl assigns values to the default
>variables.

># get next input file from command line
>while (<>) {

This reads into $_

>    my $outfile = $_;
>    $outfile =~ s/.txt/.xml;

You forgot chomp(). Your "filename" still has a newline at it's end.

>    # open file for read
>    open (TXTIN,$_) || die "";
>    # open file for output
>    open (XMLOUT,">$outfile") || die "";
>    # THE ORGINAL OUTER LOOP
>    # loop over all lines in the file

>    while (<TXTIN>) {

This overwrites the "filename" you got from the file.

>    ...
>    }
>}
>
>The problem here is (clearly) that I am already using $_ to hold the input
>file name. What are my options?

Read it into another variable?

	while($infile = <>) {
		chomp $infile;
		($outfile = $infile) =~ s/\.txt$/.xml/;
		open TXTIN, $infile or die "horrible death $!";
		open XML, ">$outfile" or die "aaaaargh $!";
		while(<TXTIN>) {
		   ...
		}
	}

Don't use $_ for temporary files in nested loops, if you're not
absolutely sure you don't need the value from the outer loop again,
because it will be gone. Forever.

-- 
	Bart.


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

Date: Sat, 20 May 2000 10:56:02 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: the use of $_
Message-Id: <39264916.311335637@news.nikoma.de>

On Fri, 19 May 2000 15:54:39 -0400, tadmc@metronet.com (Tad McClellan)
wrote:

>On Fri, 19 May 2000 11:53:29 -0700, Brian McDonald <mcdonabNO@SPAMyahoo.com> wrote:
>
>>    my $outfile = $_;
>>    $outfile =~ s/.txt/.xml;
>
>
>   foreach my $infile ( @ARGV ) {  # foreach instead of while
>      my $outfile = $infile;
>      $outfile =~ s/.txt/.xml;

You missed the opportunity to correct his substitution by adding the
third slash and the backslash before the dot. (And maybe there should be
a '$' after '\.txt' as well.)

    $outfile =~ s/\.txt/.xml/;

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Fri, 19 May 2000 21:10:28 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: the use of $_
Message-Id: <slrn8ibpg4.9ka.tadmc@magna.metronet.com>

On Fri, 19 May 2000 15:55:54 -0700, Brian McDonald <mcdonabNO@SPAMyahoo.com> wrote:


>But, I was just abbreviating, since I was
>typing as opposed to pasting.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Don't do that.

Or, let me rephrase that:

Don't do that if you want me to see your posts  :-)


I have, on rare occasions, killfiled people for posting typos
that are not even in the code they are having trouble with.

I have killfiled people, on frequent occasions, for posting in 
Jeopardy style.

Please don't do that either.


You would benefit by reading some of the articles posted to

   news.announce.newusers

if you want folks to read your articles.



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


You should never quote .sigs either.

You are stomping all over netiquette here. Better fix that soon.


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


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

Date: Sat, 20 May 2000 10:52:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Use/Require Difference
Message-Id: <39286a41.768565@news.skynet.be>

Scott Pritchett wrote:

>> Because require happens at run time, use at compile time.

>I know this, but what difference does that make here?

Execution order. Put some print statements both in your module and in
the mains script before and after the library load instruction, and see
the difference.

-- 
	Bart.


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

Date: Fri, 19 May 2000 09:09:57 -0400
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: What book on perl-cgi for a perl-programmer?
Message-Id: <8g3eum$l4$1@news3.icx.net>


"Koos Schut" <schut@rugth1.phys.rug.nl> wrote in message
news:8g0q6o$pb3$1@info.service.rug.nl...

> I intend to create wwwpages in which data can be
> viewed from different databases (Informix, Oracle).
> I know how to write Perl programs which do the
> querying and complex things like that, it is the
> http stuff that I do not know to do well, and
> especially the interacting with databases.
>
> So can anyone suggest some book/reference/www-site
> which might be very useful for me?

2 books:

Programming the Perl DBI
Database programming with Perl
By Alligator Descartes & Tim Bunce
ISBN 1-56592-699-4

OFFICIAL GUIDE TO PROGRAMMING WITH CGI.PM
Lincoln D. Stein
ISBN 0-471-24744-8

The latter book is a bit dated but you can get updated documentation at:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html

jay




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

Date: Fri, 19 May 2000 10:27:09 -0400
From: "John Alderson - LTS" <john.alderson@fmr.com>
Subject: Re: Windows: Accesing a DLL
Message-Id: <_acV4.28$s65.38@news-srv1.fmr.com>

"Mike Denton" <mikesnews@stakeholderuk.org> wrote in message
news:$bsMQBAhdUJ5EADs@stakeholderuk.org...
> I've written various Perl CGI scripts for use on a Unix server. I now
> have to switch to a Windows NT server, because I have a Windows DLL that
> I have to query.
>
> The DLL is an OLE Server DLL which can be called from any application
> that supports OLE Automation.
>

Mike,

If the DLL supports the IDispatch interface, you can use it with the
Win32::OLE module.  Quick example pseudo-code...

$MikesObject = Win32::OLE->new('ThirdParty.DLL');
#  The new() method takes the moniker that the DLL was registered with when
installed.  These #  monikers can be found in the Registry in
HKEY_CLASSES_ROOT.  The docs should
#  contain this info.
$MikesObject->Method;

If the DLL was not available via OLE automation, you could call it directly
with Win32::API.

hth,
John Alderson





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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 3107
**************************************


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