[12175] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5774 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 25 13:07:33 1999

Date: Tue, 25 May 99 10:00:27 -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           Tue, 25 May 1999     Volume: 8 Number: 5774

Today's topics:
        Baffled by regexp behaviour simon@whitestar99.demon.co.uk
    Re: Baffled by regexp behaviour (Sam Holden)
    Re: Chdir not working since I went to IIS4 (Larry Rosler)
    Re: Chdir not working since I went to IIS4 (Greg Bacon)
    Re: conditional regexp matching. Please advise. <ravik@cyrix.com>
        database backed perl function <1918@1918.com>
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Larry Rosler)
    Re: In favor of extending "my" to apply to subroutines  (Andrew Allen)
    Re: jerri rigged forms instead of CGI... bad? <gellyfish@gellyfish.com>
    Re: List of files in a directory? <mthomas@archa9.cc.uga.edu>
        MySql DBD test failure - compiles fine idubraws@deja.com
    Re: need an anti-leech script <tchrist@mox.perl.com>
    Re: need an anti-leech script (Sam Holden)
    Re: need an anti-leech script <gellyfish@gellyfish.com>
    Re: Newbie  Perl --> HTML <cassell@mail.cor.epa.gov>
        RE: O'Reilly's Programming Web Graphics with Perl & GNU <dsaff@tvisions.com>
        Open a textfile with a cgi-programm (Hans Bolte)
    Re: Open a textfile with a cgi-programm <jeromeo@atrieva.com>
    Re: Perl "constructors" zenin@bawdycaste.org
    Re: Perl "constructors" <jdporter@min.net>
    Re: Perl on Win32 - How can I hide the process? hansene3824@my-dejanews.com
    Re: PERLFUNC: tr/// - transliterate a string (Larry Rosler)
    Re: PERLFUNC: truncate - shorten a file (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 25 May 1999 15:16:06 GMT
From: simon@whitestar99.demon.co.uk
Subject: Baffled by regexp behaviour
Message-Id: <7ieerj$vde$1@nnrp1.deja.com>

Hi,

I have some text from a file which is slurped into string and I am
trying to remove some lines off the end. Now I have got a solution but
I am unsure as to why the first idea failed.

Take the following where I want to lose everything after and including
the last occurence of 'SIMON':

$string = 'aaaaaaSIMONbbbbbbSIMONccccccc';
$string =~ s/SIMON.*?$//;

After this $string is 'aaaaaa', not what I want so I have resorted to
doing:

$string =~ s/(.*)SIMON.*?$/$1/;

Which gives 'aaaaaaSIMONbbbbbb' which is what I want.

I can't understand why the first example didn't choose the 2nd of the
two possible matches as then the '.*?' has matched as little as
possible.

Or am I just being stupid!?

Simon


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


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

Date: 25 May 1999 15:42:02 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Baffled by regexp behaviour
Message-Id: <slrn7klh6a.ljm.sholden@pgrad.cs.usyd.edu.au>

On Tue, 25 May 1999 15:16:06 GMT, simon@whitestar99.demon.co.uk wrote:
>Hi,
>
>I have some text from a file which is slurped into string and I am
>trying to remove some lines off the end. Now I have got a solution but
>I am unsure as to why the first idea failed.
>
>Take the following where I want to lose everything after and including
>the last occurence of 'SIMON':
>
>$string = 'aaaaaaSIMONbbbbbbSIMONccccccc';
>$string =~ s/SIMON.*?$//;
>
>After this $string is 'aaaaaa', not what I want so I have resorted to
>doing:
>
>$string =~ s/(.*)SIMON.*?$/$1/;
>
>Which gives 'aaaaaaSIMONbbbbbb' which is what I want.
>
>I can't understand why the first example didn't choose the 2nd of the
>two possible matches as then the '.*?' has matched as little as
>possible.

The .*? matches as little as possible locally in order to get a successful
match. The regex engine progresses from left to right so it finds the
first SIMON, and then the .*? can match the rest of the string (due to
the $).

Regexes always match the match that starts as far to the left as possible.
If there is more than one successful match starting at that character then
the greediness or non-greediness comes into play.

If SIMON is always a literal string with no regex meta characters then you
could use rindex() to find the string and substr() to chop off the end
of the string...

-- 
Sam

If your language is flexible and forgiving enough, you can prototype
your belief system without too many core dumps.
	--Larry Wall


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

Date: Mon, 24 May 1999 14:51:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Chdir not working since I went to IIS4
Message-Id: <MPG.11b369bf8290cf0e989aea@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7icco6$d29$1@info2.uah.edu> on 24 May 1999 20:27:50 GMT, 
Greg Bacon <gbacon@itsc.uah.edu> says...
> In article <FC91Lt.Iyp@news.boeing.com>,
> 	"news.boeing.com" <jim.ray@west.boeing.com> writes:
> : The following code use to work under IIS 3 and now has stop working
> : under IIS4.  The main code that is not working is the "chdir" command.
> : I am running NT 4.0 sp3 and IIS 4.  I am also using ActiveState Perl.
> 
> My heart goes out to you. :-(

You should be clear -- not about using ActivePerl, which in my 
experience is quite fine.  I wonder if there are any stats about the 
number of downloads of that vs *nix perl ports.  I'll bet there are 
already many more, despite the newness of the code.

> : Is there a URL that list what commands are the same and differnent
> : from UNIX and NT?
> 
> There should be no differences.  Some of Perl's operators are
> unimplemented in the NT port, but that's because NT is an inferior
> operating system.

s{an inferior operating system}
 {an operating system different from that on which Perl was originally 
implemented}

The argument shouldn't be about inferiority (against which I would be 
hard pressed to argue :-) but about disjoint capailities.

> : $filedir = $query->param(keywords);
> 
> You appear to be using the CGI module.  Good. :-)
> 
> : $filepath = "//NT-ZZZ-ZZ//epmr//Telecon//$filedir//;
> 
> Hmm.. why are you doubling your slashes?  You get bonus points for
> using the One True Slash,

Cool.  Tell that to the Mac folks too.  :-)

>                           but you have to give them back because
> you forgot that you only have to double *back*slashes.

Within double-quotes.  Why do people insist on using them when there is 
no interpolation or escape interpretation???

>                                                        Still, NT's
> kernel understands the One True Slash as a path separator.

Shhh...  That's the best kept secret!

>                                                             It's
> DOS's idiot command interpreter that visited this madness upon you.
> There's a reason NT did away with command.com. :-)

I doubt that CMD.EXE is that much better.  The problem isn't in the 
implementation of the command interpreter as it is in the malignant spec 
that arbitrarily replaced '-' to prefix options by '/'.

 ...

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


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

Date: 25 May 1999 17:00:20 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Chdir not working since I went to IIS4
Message-Id: <7iekv4$qnc$3@info2.uah.edu>

In article <MPG.11b369bf8290cf0e989aea@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:
: In article <7icco6$d29$1@info2.uah.edu> on 24 May 1999 20:27:50 GMT, 
: Greg Bacon <gbacon@itsc.uah.edu> says...
: > My heart goes out to you. :-(
: 
: You should be clear -- not about using ActivePerl, which in my 
: experience is quite fine.

God save The Sarathy!! :-)

: I wonder if there are any stats about the 
: number of downloads of that vs *nix perl ports.  I'll bet there are 
: already many more, despite the newness of the code.

Who cares?  Well, I take that back.  I would love to see those data
because that would just make us documentation reading, source code
sharing Unix people more of a commodity and, hence, more valuable.

: > There should be no differences.  Some of Perl's operators are
: > unimplemented in the NT port, but that's because NT is an inferior
: > operating system.
: 
: s{an inferior operating system}
:  {an operating system different from that on which Perl was originally 
: implemented}

Hold that order!

: The argument shouldn't be about inferiority (against which I would be 
: hard pressed to argue :-) but about disjoint capailities.

    From Webster's Revised Unabridged Dictionary (1913) (web1913)

    Inferior \In*fe"ri*or\, a. [L., compar. of inferus that is below,
    underneath, the lower; akin to E. under: cf. F.  inf['e]rieur. See
    {Under}.] 1. Lower in place, rank, excellence, etc.; less important
    or valuable; subordinate; underneath; beneath. 

NT seems to fit that definition very nicely with respect to Unix.  NT
culture seems to fit that definition very nicely with respect to Unix
culture.  The political correctness is unnecessary (and I hope I'm long
dead when operating systems start demanding it).  Unix and NT don't
have disjoint capabilities.  One is a superset of the other.

Greg
-- 
If I wanted to listen to an asshole I woulda farted.


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

Date: Tue, 25 May 1999 10:41:07 -0500
From: Ravi Kumar <ravik@cyrix.com>
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <374AC492.C16A096@cyrix.com>

Ronald J Kimball wrote:

> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>
> > "Work better"?  It is not clear what you mean here.  I assume "look
> > better".
>
> Also "more efficient", as implied in the previous sentence.
>
> In particular, problems of the type "match this and this and not this",
> where each "this" is not necessarily adjacent to the others in the
> target string, are best done with separate regexes.
>
> /dog/ and /cat/ and !/bird/
>
> vs.
>
> /^(?=.*dog)(?=.*cat)(?!.*cat)/
>
> I definitely prefer the first in this case.

That's because the problem is misunderstood. Consider thisaddress 0xG00D data
0xG00D expect 0xBADh ....

If you wanna issue a warning like so
'Warning: Hex after 'expect' is incorrect: 0xBADh" (in line no. blah....)
You should be able to capture the badness with the surrounding
context and print out something relevent. Multiple regexs solve
this problem more tediously. (hence inconvenient).  Also a regex for
each token is sloooow. (hence inconvenient). Think of a logic analyser
captured trace of say 10 million lines.

Ilya's example, slightly modified solves the problem though binding
me to perl5.005 or higher.
/(?:0x)?([\da-fx]+)(?(1)|h)/i;
# this way I can always use $1 to get the number too


--
Cheers,
--ravi, (ravik,8643)





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

Date: Tue, 25 May 1999 11:38:05 -0400
From: Phil Buckley <1918@1918.com>
Subject: database backed perl function
Message-Id: <374AC3DD.BDF4041E@1918.com>

I built a real simple admin feature for a database (MySQL) backend
website, where the administrator can add new news stories. The client
now wants to also add hyperlinks into the text field. I mentioned that
the easiest way was to put the <a href... right into the text where he
wants it. No good. He wants something a little more "html editor" like.
I am not familiar with anything perl related that can do what he wants.
My suggestion was a follows: Put in some type of tag like # and then
have a pull down showing files on the server that the guy could link to
then substitute the <a href> in where the # was and write in the proper
file to link to.
Is there a more interactive way? Is there a module I'm over looking?

Thanks in advance,
Phil Buckley


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

Date: Mon, 24 May 1999 12:48:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <MPG.11b34ccf547de0a989ae6@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7ibv93$ntq$1@mathserv.mps.ohio-state.edu> on 24 May 1999 
16:37:55 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
 ...
> ...  Perl documentation *does not
> describe* what Perl operations do.  In many cases it at most *hints*
> on what one may expect from the operations.  (`perldoc -f vec' gives a
> worst possible case, but at least at this case somebody did *try* to
> document things, it is just that the documenter did not realize that
> his prose contains no description of the operation.)
> 
> Try to find a definition what $a = $b + $c does.  Or what $a = $b | $c
> does.  In fact the absence of such documenation is quite
> understandable: *all* the existing versions of Perl have the result of
> 
>    $a = $b + $c;
> 
> *undefined*!  You need one of my latest jumbo patches to make $a
> depend on *values* of $b and $c (and, of course, active pragmas) only,
> and not on the *history of access* to the values of $b and $c.  And my
> patch works on 32-bit machines only, 64-bit Perl is another can of
> worms.

This cannot refer to the superficial definition of the '=' operator, 
which is the same in Perl as in C (the *sum* of the two operands, where 
*sum* is not defined explicitly but must be assumed from mathematics).  
So I guess you mean that:

    $a = ${\$b} + ${\$c};

so that unfortunate things can happen 'under the sheets', as it were.  

This same issue has surfaced recently in regard to the evaluation of 
elements in a list, where the evaluations apparently reduce to 
references, and ill-timed side effects can affect the values.

   my $i = 0;
   my @a = ($i, $i++);
   print "@a\n";

astoundingly prints "1 0".  Certainly such behavior should be either 
eliminated from the implementation or ruled out by documentation of 
where the 'sequence points' in such an expression lie (to use a term 
introduced into the C Standard by Tom Plum, who writes compiler and 
application verification suites and cares about such things a great 
deal).

> >  Can you give some examples of the things
> >     that are being fixed?  Also, is Perl better or worse than
> >     other languages?  (e.g. C, which you more or less describe as
> >     "silly"?)
> 
> What has localtime() (which I discussed) has to do with C?  It is in
> C90, but in my ballpark it does not make it into C as a *language*.
> But this is of course only a linguistic try of excuse from my side...

'Your ballpark' isn't the same as the world's.  The ANSI/ISO Standard 
for the Programming Language C includes an extensive section defining 
the Library (which is thereby part of the language definition).  So 
localtime() has everything to do with C.  It is part of the C language.
(For better or for worse :-)
 
> C is well defined as a language, Perl is not even close.

Perhaps more clarity on this issue of partial evaluation would move Perl 
much closer.

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


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

Date: 24 May 1999 17:44:04 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: In favor of extending "my" to apply to subroutines as well as variables
Message-Id: <7ic354$4li$2@fcnews.fc.hp.com>

I'd argue that the syntax

  my sub foo {...}

should generate a lexically-scoped sub for "consistency". Would have
the same effect as what you're arguing for, but with better
justification than "privatization"). Although I think the following
syntax might work just as well (and be consistent in another way):

  my &foo;
  sub foo {...}

Of course, file-lexical-scope gives potential class subclassers
headaches (as evidenced by Tom C's recent FMTYEWTK on per-class data).
You may want to consider that subclassers might want to use your
"private" subs (I guess they'd be "protected" then) and this syntax
would prevent them :(

Andrew


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

Date: 25 May 1999 12:15:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: jerri rigged forms instead of CGI... bad?
Message-Id: <374a865b@newsread3.dircon.co.uk>

Bob Trieger <sowmaster@juicepigs.com> wrote:
> [ courtesy cc sent by mail if address not munged ]
>      
> Jerome O'Neil <jeromeo@atrieva.com> wrote:
>>Matt Baker wrote:
>>
>>> Here is the dillema:
>>> 1) Is it bad style or normal practice to have a CGI program spit out raw
>>> HTML to the web browser?
>>> I generally just do a
>>> print >>EOD;
>>>    lots of HTML goes here
>>> EOD
>>
>>It's not bad form.  In many cases, it's preferable.
> 
> May I suggest you look at his code again.
> 

Aieee ! Even if it were syntactically correct what could it do ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 25 May 1999 16:07:46 GMT
From: "Mike Thomas" <mthomas@archa9.cc.uga.edu>
Subject: Re: List of files in a directory?
Message-Id: <7iehsi$dcj$1@cronkite.cc.uga.edu>

Thanks for all the replys. I do have it working with opendir, readdir,
closedir. I was just stumped as to why it would not work with globbing. 
>From all I read it should work, but was skipping the first file even in a
directory with a small number of files, like four.

--
Mike Thomas
Virtual Services
Main Library
University of Georgia




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

Date: Tue, 25 May 1999 15:00:51 GMT
From: idubraws@deja.com
To: idubraws@deja.com
Subject: MySql DBD test failure - compiles fine
Message-Id: <7iedv2$uqi$1@nnrp1.deja.com>

Vital Info:

                OS: Slackware Linux
                Kernel: 2.2.8
                MySql Vers: 3.22.22
                Perl Vers: 5.005
                MySql/mSql module Vers: 1.20017
                DBI Vers: 1.08
                gcc vers: 2.7.2.3
                binutils: 2.8.1

Problem:

The module MySql 1.20017 compiles fine under make. However,when you run
"make test", it fails miserably.  I get the following error:

PERL_DL_NONLAZY=1 /usr/bin/perl -I../blib/arch -I../blib/lib
-I/usr/lib/perl5/5.00503/i686-linux -I/usr/lib/perl5/5.00503 -e 'use
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;'
t/*.tt/00base............install_driver(mysql) failed: Can't load
'../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: File not
found at /usr/lib/perl5/5.00503/i686-linux/DynaLoader.pm line 169.

at (eval 1) line 3

at t/00base.t line 38
dubious Test returned status 255 (wstat 65280, 0xff00)
Operator or semicolon missing before &__in at (eval 87) line 1.
Ambiguous use of & resolved as operator & at (eval 87) line 1.
Operator or semicolon missing before &__i at (eval 87) line 1.
Ambiguous use of & resolved as operator & at (eval 87) line 1.
DIED. FAILED tests 4-5 Failed 2/5 tests, 60.00% okay

and goes on and on.  When I look at the DynaLoader.pm module source,
line 169:

# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.

I presume that problem is in the DynaLoader.pm module since make did not
provide an error message.  Has anyone else seen this?  Can someone
provide me some help.  Please reply to:

idubraws@deja.com

--
Ido Dubrawsky
System Administrator
Deja.com
Austin, TX


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


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

Date: 25 May 1999 09:01:18 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: need an anti-leech script
Message-Id: <374abb3e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    sholden@cs.usyd.edu.au writes:
:But it is probably a good enough solution if the server has smallish
:bandwidth, and web pages from other unrelated sites without permission
:keep linking to images, etc on that server. 

I don't understand this whole "permission" thing.  If it's out 
there, it's out there.  Shall we forbid search engines like 
Alta Vista now?

:They are meant to be viewed,

Exactly.

:just as part of the site they are made for, not for every other site
:on the web. 

I disagree.

:might visit their site to spoof the Referer. A CGI script on the 'stealing'
:site could get around it simply, 

I don't believe in the whole "stealing" notion.

I'm sure there's a better newsgroup for this, though, one that
I don't read. :-)

--tom
-- 
    "Have the appropriate amount of fun." --Larry Wall


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

Date: 25 May 1999 15:12:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: need an anti-leech script
Message-Id: <slrn7klffn.qs5.sholden@pgrad.cs.usyd.edu.au>

On 25 May 1999 09:01:18 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
>     [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc, 
>    sholden@cs.usyd.edu.au writes:
>:But it is probably a good enough solution if the server has smallish
>:bandwidth, and web pages from other unrelated sites without permission
>:keep linking to images, etc on that server. 
>
>I don't understand this whole "permission" thing.  If it's out 
>there, it's out there.  Shall we forbid search engines like 
>Alta Vista now?

Search engines tend not to link directly to image files last time I
looked...

If someone uses large graphics in the design of their web pages and those
graphics use up a lot of bandwidth they probably don't like the idea of those
graphics being embedded into other pages.

I know that the system people in my department would get annoyed with me if
I used a largish graphic on my page that slashdot.org decided to use as
their background image by linking to the image on my site rather than just
copying the image. It would effectively kill the server I use.

I can see why people wouldn't like this.

Personally I don't use graphics that people would want to steal, and tend
to only use graphics for their annoyance value anyway...

>
>:They are meant to be viewed,
>
>Exactly.
>
>:just as part of the site they are made for, not for every other site
>:on the web. 
>
>I disagree.

That's fine. I can just see why people would be annoyed if their server
kept being overloaded because slashdot and dilbert and userfriendly
decided to use a link to an image on their site as a background image.

>:might visit their site to spoof the Referer. A CGI script on the 'stealing'
>:site could get around it simply, 
>
>I don't believe in the whole "stealing" notion.

Again that's fine. I don't much either, then again I don't directly pay for
the bandwidth used in downloading my web stuff, and I don't have anything 
worth stealing...

-- 
Sam

Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work."  --Larry Wall


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

Date: 25 May 1999 16:32:55 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: need an anti-leech script
Message-Id: <374ac2a7@newsread3.dircon.co.uk>

Henjo <henjo@deadlock.et.tudelft.nl> wrote:
> Hi all,
> 
> I'm constantly losing bandwidth because other people are linking directly
> to my files.

Probably cant be helped if your site has been indexed by such as Altavista.

> Can anyone give me a script which prevents this?

No.  But if you want to  prevent indexing by search engines you might 
look at the 'Robot Exclusion Standard'  however that is nothing to do
with Perl and you should ask elsewhere.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Tue, 25 May 1999 09:54:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Newbie  Perl --> HTML
Message-Id: <374AD5BA.F8144802@mail.cor.epa.gov>

Dave Cross wrote:
> 
> On Mon, 24 May 1999 21:33:48 -0700, "Brian A. Gleber"
> <bgleber1@rochester.rr.com> wrote:
> 
> >Today is my first day trying to pick up perl.  When I call my perl program
> >from by Web Browser, it shows my code instead of a html document.
> >
> >BTW, I am running Win98 with Personal Web Server installed.  Here is my
> >code, what am I doing wrong?
> >
> >#!C:\perl\bin\perl
> > [snip of code]
>
> Sounds like a web server configuration issue. You web server doesn't
> know that CGI scripts should be executed rather than displayed. There
> are newsgroups that deal with these issues.
> 
> Dave...

Dave Cross is right, of course.  But.. you might want to read
the HTML documentation that came with ActiveState Perl.  Right
there, under the section called "Web Server Config" (oddly enough),
there is a piece on configuring PWS.  If that doesn't help you
enough, you will want to go ask in a newsgroup that has 'server'
or 'win' or 'pws' in the name, like, say,
   microsoft.public.win98.pws_4

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 25 May 1999 16:03:07 +0100 (Eas)
From: David Saff <dsaff@tvisions.com>
Subject: RE: O'Reilly's Programming Web Graphics with Perl & GNU Software - Has  anyone gotten this script to work?
Message-Id: <14154.48043.193000.443642@gargle.gargle.HOWL>


Jeremy Fowler writes:
 > In Chapter 10: Web Graphics Cookbook, I haven't been able to get the
 > counter.pl script to work. It seems to get stuck on or about the forth
 > unless function:
 > 
 > unless ($referer =~ /http:\/\/($users)(.*)/) {
 >     exit $error->black_box('You do not have privilages to access this
 > counter.');
 > }

I'm not familiar with this book or application, but the following
pointers might help.

 > If I write it out word for word from the book it doesn't work (Perl doesn't
 > give any errors with -w and "use strict" is called, so it must be logic
 > errors). 

What do you mean by "it doesn't work"?  Does it print an error
message?  Exit without doing what you want?  Hang?

 > "Use of uninitiated value at ./counter.pl line 69, <COUNT> chunk 1."
 > "Use of uninitiated value at ./counter.pl line 73, <COUNT> chunk 1."
 > "Use of uninitiated value at ./counter.pl line 88, <COUNT> chunk 1."

Look at the lines referred to.  The error is telling you that you are
looping on the file handle <COUNT>, and that the error described
happened the first time through this loop.  On each line, a variable
is being referred to taht has not yet been given an initial value.
You'll have to look through the code to the point where you think
you've given that variable a value, and think hard about whether it's
doing what you think it should.

 > What is a Segmentation fault? I can't find any refferance to what this is
 > anywhere.

A segmentation fault is a lower-level error.  It's not from Perl.
Generally, it means that memory has been improperly manipulated or
accessed.  Perl rarely generates seg faults in my experience, so I
would look closely at any third-party products you are using.

 > If someone has an answer to any of these questions, please email me back if
 > you can help, since I am unable at this time to sort through 30,000
 > newsgroup posts to find an answer.

Please post any responses to this message back to the list.  In
general, such a statement is not a good way to get into the good
graces of people who have sorted through 30,000 newsgroup posts to
find your question.

Good luck,

     David Saff
     TVisions


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

Date: Tue, 25 May 1999 17:54:14 +0200
From: kaiservonchina@t-online.de (Hans Bolte)
Subject: Open a textfile with a cgi-programm
Message-Id: <374AC7A6.6D74@t-online.de>

Hello,

why does the following code in my cgi-programm not open the textfile
"statistik.dat"?

    open(DAT, "<statistik.dat") || print "Error: Could not open
statistik.dat\n";

The cgi-programm and "statistik.dat" are in the same directorie.

"statistik.dat" has the permissions rwxrwxrwx.
The cgi-programm has the permissions rw-r-xr-x.

Hans


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

Date: Tue, 25 May 1999 09:18:23 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Hans Bolte <kaiservonchina@t-online.de>
Subject: Re: Open a textfile with a cgi-programm
Message-Id: <374ACD4F.ECA54343@atrieva.com>

Hans Bolte wrote:
> 
> Hello,
> 
> why does the following code in my cgi-programm not open the textfile
> "statistik.dat"?
> 
>     open(DAT, "<statistik.dat") || print "Error: Could not open
> statistik.dat\n";


Because you aren't asking perl to tell you.  Check the $! variable for
the answer.

open(DAT, "<file.dat") || print "Error: Couldn't open because $!\n";

For all the exciting detail on $! and other useful variables, read the
perlvar document that came with your perl distribution.

Good Luck!

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: 25 May 1999 16:12:05 GMT
From: zenin@bawdycaste.org
Subject: Re: Perl "constructors"
Message-Id: <927648892.858242@localhost>

Eric The Read <emschwar@rmi.net> wrote:
: zenin@bawdycaste.org writes:
	>snip<
:> 	Sure there is, just don't catch them.  When you do catch them by
:> 	mistake, rethrowing them is trivial.
: Er, I'm going to have to assume that that's in Error.pm somewhere.
: Because otherwise, I don't see how a simple 
: 
: eval { die "d'OH!"; } ;
: 
: propogates that die outside the eval block.  Which seems to me (please
: correct me if I'm wrong) what you're saying.

	Ah, I see what you're looking for now.  Perl is a bit funky here, as
	eval only =~ try, not eq try. :-)

		eval { die "d'OH!"; };

	is basically the same as:

		try { throw new dOH (); }
		catch (Exception e) {}

	Perl assumes one shouldn't be silly enough to explicitly use an eval
	block and then not test for there exceptions unless they really did
	want to ignore them.  If you want your exceptions to prorogate and
	not have to catch them, don't eval them. :-)

:> : Right now, Perl can't assume that $@ has been blessed at all,
:> 	Does it matter?  Seriously.
: 
: I thought so, at the time.  Then I tried your next trick, and discovered
: it works on non-blessed references, which I didn't expect.  Why?
: 
:> 	if ($@->isa("Some::Exception")) {
: 
: perlop.pm says that if the RHS of -> is a method name (isa, in this case),
: the LHS, $@, must be either a blessed reference, (which in my eval, above,
: it isn't), or a package name. Given that "d'OH!" is not a package (not
: that *I* know of, anyway :),

	Actually, that's really "d'OH! at line 123 file Foo.pm\n".

: and it's not a blessed reference, how can this not cause at least one
: error?

	UNIVERSAL::isa() is magical, AFAIK.

: Maybe two-- the LHS is neither of the things it ought to be, and the RHS
: isn't a defined function in *any* package.

	isa() is always defined internally in UNIVERSAL::.

: Please note I'm not necessarily saying that it *should*-- though it
: certainly looks to me like it ought to-- I just don't understand why it
: doesn't.  And under the influence of strict.pm, no less!

	:-)

:> : And there's *still* no way to automatically die on an uncaught exception.
:> 
:> 	use Fatal;
: 
: $ perldoc Fatal   
: No documentation found for "Fatal".
: 
: Again, this is probably because I'm using an older version of perl.

	Yep.

: Yes, I've asked for it to be upgraded.  No, it's not likely to happen in
: the near future.  Yes, I'm annoyed.

	You might want to let "them" know that you can run a copy of 5.005xx
	along side 5.00404 transparently.

-- 
-Zenin (zenin@archive.rhps.org)         Caffeine...for the mind.
                                        Pizza......for the body.
                                        Sushi......for the soul.
                                             -- User Friendly


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

Date: Tue, 25 May 1999 16:16:29 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7ieicr$257$1@nnrp1.deja.com>

In article <xkfn1yuh2lv.fsf@valdemar.col.hp.com>,
  Eric The Read <emschwar@rmi.net> wrote:
> kaih=7HPvvhDXw-B@khms.westfalen.de (Kai Henningsen) writes:
> > Huh? I must not be getting something here. How do you not die on an
> > uncaught die()? Seems a contradiction to me.
>
> #!/usr/bin/perl -w
>
> eval { die "ack!"; };
>
> print "returning normally\n";
> exit 0;
> __END__
>
> Since eval is perl's version of try, I'd expect the uncaught die() in
> there to propogate upward, and cause a die() in the outer program-- if
it
> were really an exception.  Since it's not really an exception, it
doesn't
> require a catch (or, in the case of Perl, a "if($@) {...}".

This is the difference between *catching* an exception and
*dealing with* an exception.  eval catches everything.  dealing with
whatever eval caught is up to the programmer.
One of things you might do is re-throw (i.e. propagate), but this
does not happen automatically.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


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


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

Date: Tue, 25 May 1999 15:04:57 GMT
From: hansene3824@my-dejanews.com
Subject: Re: Perl on Win32 - How can I hide the process?
Message-Id: <7iee6n$usm$1@nnrp1.deja.com>

Try the below. It seems to work well.

($DOShwnd, $DOShinstance) = GUI::GetPerlWindow();
GUI::Hide($DOShwnd);


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


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

Date: Mon, 24 May 1999 11:07:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PERLFUNC: tr/// - transliterate a string
Message-Id: <MPG.11b33524b39846c0989ae3@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37497614@cs.colorado.edu> on 24 May 1999 09:53:56 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
> NAME
>     tr/// - transliterate a string
> 
> SYNOPSIS
>     tr///
> 
> DESCRIPTION
>     The transliteration operator. Same as `y///'. See the perlop
>     manpage.

About a month ago, I tried to defend the use of 'transliterate' for this 
operator, and was persuaded by the group that 'translate' is closer (and 
two syllables shorter :-).

'Transliteration' denotes the replacement of each character of a string 
by a corresponding representation in another character set, not by a 
character in the same character set.

So one can transliterate Greek theta-epsilon-omicron-sigma to Latin 
'theos' (not even character-for-character), but one translates Latin 
'HAL' to Latin 'IBM'. 

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


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

Date: Mon, 24 May 1999 14:14:45 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PERLFUNC: truncate - shorten a file
Message-Id: <MPG.11b3611c6d93e668989ae8@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37499237@cs.colorado.edu> on 24 May 1999 11:53:59 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
 ...
> NAME
>     truncate - shorten a file
> 
> SYNOPSIS
>     truncate FILEHANDLE,LENGTH
> 
>     truncate EXPR,LENGTH
> 
> DESCRIPTION
>     Truncates the file opened on FILEHANDLE, or named by EXPR, to the
>     specified length. Produces a fatal error if truncate isn't
>     implemented on your system. Returns TRUE if successful, the
>     undefined value otherwise.

Last week, someone asked how to create a file of length 10 Mbytes.  
Except for me, those who answered suggested writing 10 Mbytes to the 
file.  I verified that truncate() would *grow* a file to arbitrary 
length, on HP-UX and Windows NT at least.

Would it add value to include in this documentation the notion that 
'truncate' really means "set file size", even if it means growing the 
file?  For a start,

  NAME
      truncate - set the size of a file

 ...

  DESCRIPTION
      Sets the file opened on FILEHANDLE, or named by EXPR, to the
      specified length. ...

My HP-UX manual says for truncate(2):

  If it was previously shorter, ...

And it includes in the list of errors some having to do with 
overreaching file size or file system size limits.

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


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

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

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