[9725] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3319 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 2 13:05:02 1998

Date: Sun, 2 Aug 98 10:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 2 Aug 1998     Volume: 8 Number: 3319

Today's topics:
    Re: "use" in expressions. (Andrew M. Langmead)
    Re: 3 more questions for perl win32 officianados <jwb79@mail.idt.net>
    Re: [Q] STDOUT to screen and file on Win32 (Andrew M. Langmead)
    Re: [Q]s on non-blocking system calls ("forks") (Andrew M. Langmead)
    Re: Cab file format <rootbeer@teleport.com>
        catch a signal <matalon@jouy.inra.fr>
    Re: catch a signal <mc@whoever.com>
    Re: Change Unix NIS password though the WEB interface <rootbeer@teleport.com>
    Re: device number -> filestystem? <rootbeer@teleport.com>
    Re: flock and/or fcntl on solaris <rootbeer@teleport.com>
    Re: Good Book? <snif@xs4all.nonono.nl>
    Re: Has anyone used the POP3 module ? <snif@xs4all.nonono.nl>
    Re: Help with Perl... <philey@hotmail.com>
    Re: hiding user input (Gary L. Burnore)
    Re: How good is foreach and/or substitution? (Tad McClellan)
    Re: How good is foreach and/or substitution? <zenin@bawdycaste.org>
    Re: How good is foreach and/or substitution? fandino@usa.net
    Re: Inconsistent 'use strict;' error for undefined HASH (Tye McQueen)
    Re: Interesting Question needs Quick Answer (Sam Holden)
    Re: Interesting Question needs Quick Answer (Jack Ostroff)
        Local Perl Installation and Form Processing <john@cutnfun.com>
    Re: Local Perl Installation and Form Processing <mc@whoever.com>
    Re: Local Perl Installation and Form Processing <sneaker@sneex.fccj.org>
    Re: Mod User Reg Hives w/ Win32 Perl (Tye McQueen)
    Re: newbie split question (Abigail)
    Re: non-perl question about linux <jdporter@min.net>
    Re: number (6 -> 06) conversion question dave@mag-sol.com
    Re: Perl == Unix? (was Re: Programmer's Editor) (I R A Aggie)
    Re: Perl/Linux/Database??? <sfarrell@farrell.org>
    Re: Power (ie C's 4^7) (Larry Rosler)
    Re: Power (ie C's 4^7) (Craig Berry)
    Re: Problems building 5.005_01 on NT4, sp3 <davidc@selectst.com>
        Q: @argv with PerlW32? <uwe.segelbacher@desy.de>
    Re: seeing if a file exists. <alan@find-it.furryferret.uk.com>
        Self-referential regexps in Perl/ Representation of C++ <vernon@pobox.com>
    Re: Self-referential regexps in Perl/ Representation of (Craig Berry)
    Re: Try perl on Ms Dos <alan@find-it.furryferret.uk.com>
        WIN32::ODBC problem jckchan@hkstar.com
        Writing 'date' format with OraPerl on a Oracle DB. <afeltrin@nospam.c-m.it>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 2 Aug 1998 16:57:29 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: "use" in expressions.
Message-Id: <Ex2n3t.BDz@world.std.com>

kjetil.skotheim@usit.uio.no (Kjetil Skotheim) writes:

>Since 'use $x' is executed before other code, you must
>add a BEGIN-block before 'use $x' to initialise $x.

>BEGIN{$x="brbrbrbrbr"}
>use $x;

>....or maybe  eval{use $x};  will do what you want.


You might want to test out answers before you post them. Even one or
two line ones like these.

use _can't_ take a variable as an argument, even if the variable is
set before the use statement is parsed. If you use the eval SCALAR
instead of eval BLOCK, and interpolate the variable into the scalar,
before eval gets it, then the compiler will see a constant string as
the argument

eval " use $x";

yes, this is the slower form of eval, but this is the type of
construct that it is needed for, to create and execute code on the
fly.

Also, since the perlfunc man page explains use in terms of require()
and import(), and require() can take a variable, you might want to
perform the component steps.

require "$x.pm";
$x->import;

-- 
Andrew Langmead


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

Date: 31 Jul 1998 07:00:08 GMT
From: "Jim Babbington" <jwb79@mail.idt.net>
Subject: Re: 3 more questions for perl win32 officianados
Message-Id: <01bdbc4f$c61f9a00$6488fdc7@dixon>


: 3) what is a spammer? this probably is a somewhat humorous question that
: exposes my ignorance about the perl community, but i need to know.

Although spammers do probably use Perl to commit their sins, they are not considered part of the perl community. (Perl doesn't spam
people, @ssholes spam people).

A spammer is someone who has learned enough about something good (The Internet) to turn it around for evil purposes (junk email).
Probably caused by head injury as a child.



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

Date: Sun, 2 Aug 1998 16:58:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: [Q] STDOUT to screen and file on Win32
Message-Id: <Ex2n60.Bqy@world.std.com>

"John A. Hempe" <jhempe@crossroute.com> writes:

>Anybody have a simple, canned way of letting me get STDOUT to go to the
>screen and a file simultaneously?

How about the IO::Tee module
<URL:http://www.perl.com/cgi-bin/cpan_mod?module=IO::Tee>
-- 
Andrew Langmead


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

Date: Sun, 2 Aug 1998 16:44:57 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: [Q]s on non-blocking system calls ("forks")
Message-Id: <Ex2MIx.7oz@world.std.com>

k y n n <kj0@mailcity.com> writes:

>Oh, wow!  What a surprise.  I didn't know that the exec'd process
>retained the pid of the exec'ing script.  (BTW, is this documented
>anywhere?)

Oh in about any book that explains the Unix programming environment,
and the exec(2) man page.

But for perl's exec(), there is one thing to warn you about. If you
use the single argument form of exec(), and if that argument contains
shell metacharacters, perl invokes a shell on the argument and exec()s
the shell. In this case, the shell is overlaid over the fork()ed
process, (and has the PID of the forked process) and the called
program is a child of it.


-- 
Andrew Langmead


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

Date: Fri, 31 Jul 1998 06:09:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Cab file format
Message-Id: <Pine.GSO.4.02.9807302308360.9340-100000@user2.teleport.com>

On Mon, 27 Jul 1998, Jean-Baptiste Nivoit wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: Cab file format

>  it seems like i cant find the file format spec for Microsoft's .CAB files.

Maybe you should check the docs, FAQs, and newsgroups about such files.
Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 31 Jul 1998 10:27:28 +0200
From: Cyril Matalon <matalon@jouy.inra.fr>
Subject: catch a signal
Message-Id: <35C17FF0.572C@jouy.inra.fr>

I would like to catch a kill signal in my perl cgi program in order to
close a data base if a user press the Stop button in Netscape.
Is there a solution ?

                      Thanks.

                  Cyril Matalon.


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

Date: Fri, 31 Jul 1998 13:04:50 +0100
From: Martin C Brown <mc@whoever.com>
Subject: Re: catch a signal
Message-Id: <35C1B2E2.EA150A38@whoever.com>

Cyril Matalon wrote:

> I would like to catch a kill signal in my perl cgi program in order to
> close a data base if a user press the Stop button in Netscape.
> Is there a solution ?

$SIG{'KILL'} = \&exit_request_handler;

You can replace the 'kill' with any known signal on the system, rememebr
that there is no SIG in front of signal names.





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

Date: Fri, 31 Jul 1998 05:13:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Change Unix NIS password though the WEB interface
Message-Id: <Pine.GSO.4.02.9807302212390.9340-100000@user2.teleport.com>

On 30 Jul 1998, Mr Lo Kai Cheong wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: Change Unix NIS password though the WEB interface
> 
> Where can I find any info about changing the Unix NIS password through
> the Web Interface?

I'd recommend that you check the docs, FAQs, and newsgroups about Unix
(and your particular system), NIS, and web-related topics. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 31 Jul 1998 05:56:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: device number -> filestystem?
Message-Id: <Pine.GSO.4.02.9807302256350.9340-100000@user2.teleport.com>

On 30 Jul 1998, Vladimir Gabrielescu wrote:

> Solaris does have a ustat(2) which I could
> call, but does Perl have any native way of doing this?

syscall. :-) Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 31 Jul 1998 05:29:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: flock and/or fcntl on solaris
Message-Id: <Pine.GSO.4.02.9807302223530.9340-100000@user2.teleport.com>

On 30 Jul 1998, Jim Brewer wrote:

> (409): About to lock TP_fcntl.plx!
> Can't lock: 269241252 at TP_fcntl.plx line 28.

Yep, looks as if your perl is miscompiled. That big number seems to be
from $!, which is a sign of serious dain bramage. Solaris should be able
to lock files just fine, so try compiling again. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Fri, 31 Jul 1998 07:47:30 +0200
From: "Jonkers" <snif@xs4all.nonono.nl>
Subject: Re: Good Book?
Message-Id: <6prlnn$14p$1@news.gns.getronics.nl>

Steve Linberg wrote in message ...
>In article <35C0DC21.FB200D4E@istar.ca>, Dave Mckeown <dmckeown@istar.ca>
wrote:
>
>> I just bought "Perl 5 Complete" by Edward S. Peschko & Michele DeWolfe I
>> was told by someone to buy "programming perl" by Larry wall, Randal
>> Swartz or "Cgi programming for the www" Is the book I bought any good
>> any one read it I sat down and read it for about 30 minutes in the store
>> and it looked good any opinions??
>
>Programming Perl is the bible.

True, and maybe therefore "Learning Perl" by Randal Schwartz and Tom
Christiansen could be better choice.

Sander





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

Date: Fri, 31 Jul 1998 11:28:57 +0200
From: "Jonkers" <snif@xs4all.nonono.nl>
Subject: Re: Has anyone used the POP3 module ?
Message-Id: <6ps2mu$75m$1@news.gns.getronics.nl>


Alan Silver wrote in message ...

<snip>

>As I do not have access to a POP3 mail server, I am unable to test out
>such a script. Does anyone there know how to do it and have a POP3
>server that they could test it on for me ? Thanx very much for any help.

If you don't have access to a POP3 mail server, it is probably very
difficult to write the script because 'write' often means
'write-run-debug-write-run-debug ...'. If this is not true for you, you can
just write your script from the Perl and POP3 documentation.

Much easier way: get an account (including POP3) at an ISP or install some
POP3-server (not client) on your own system. This makes writing-testing
cycles much easier.

Sander




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

Date: Fri, 31 Jul 1998 06:55:52 +0200
From: "philey" <philey@hotmail.com>
Subject: Re: Help with Perl...
Message-Id: <6primf$csh$1@usenet51.supernews.com>

you might want to look at the guestbook - perl - script in the matt achrives
because he does the same thing... you can find them at
http://www.worldwidemart.com/scripts/ and the script is called guestbook...

instead of using NEWS STARTS HERE he uses <!-- begin -->

check it out...

Diesel schrieb in Nachricht <6pqqgn$2f$1@winter.news.erols.com>...
>I have been studying perl for a short while and I can't seem to find out
how
>to perform this action.
>
>Ok.  I have a web site and I update news on the web site every half hour or
>so.  I do it through html (notepad).  I would like to do it through cgi so
I
>don't have to download the index.htm, edit it, and upload it.  I have each
>section marked with a header like "NEWS STARTS HERE" and the line below it
>is where the actual html is.
>
>What I want to know is how I can get a perl script to search for this line
>in the index.htm and add stuff (in html format) below it.
>
>Thanks.
>
>--
>Thomas
>thomasbd at erols dot com
>or remove the ! to reply
>
>




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

Date: Fri, 31 Jul 1998 03:10:03 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: hiding user input
Message-Id: <35c134cf.1310295@nntpd.databasix.com>

On 30 Jul 1998 21:03:36 GMT, in article <6pqn38$5h$2@client3.news.psi.net>,
abigail@fnx.com (Abigail) wrote:

>John Call (johnc@interactive.ibm.com) wrote on MDCCXCIV September
>MCMXCIII in <URL: news:35C0855E.82D3256E@interactive.ibm.com>:
>++ 
>++ 
>++     I thought once the "Perl Studs" got their .moderated group that any advic
>++ gave here would be a little less venomous. I guess not. You got the new group
>++ be rude in there. If you give advice here then take the Tom P.'s approach ple
>
>
>Lines of 80 characters, 

Oh yeah, that's sure a crime. Right.

>and repeatedly posting the same posting.

What the hell do you think YOU'RE doing with your constant insults of people
posting questions?  Talk about a broken record. 

>That must make you luser first class, doesn't?

Nothing like you. 

You seem to get off on harassing people and not answering questions.  How many
people have to tell you to stop being a jerk before you begin to realise you
just might be a jerk?   WTF can't you either answer the question or let it go?
Why must you demean new people posting questions?  Is it how you get off?   If
you want, I'll mail you some batteries.
-- 
        for i in databasix primenet ; do ; gburnore@$i ; done
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
spamgard(tm):  zamboni                |     Official Proof of Purchase
===========================================================================


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

Date: Thu, 30 Jul 1998 22:49:43 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How good is foreach and/or substitution?
Message-Id: <nserp6.g0b.ln@localhost>

Jay Taylor (sysop97@nospam.callisto.si.usherb.ca) wrote:

: I am able to search for a word IN A TEXT FILE and display the word's
: full line, highlighting the word.

: foreach $line (@inputData)
: 	{
: 		if ($line =~ /$in{'word'}/i)
: 		{
: 		$line =~ s/$in{'word'}/<<b>$in{'word'}<\/b>/oix;
: 		print "$line<BR>\n";
: 		}
: 	}

: HERE'S WHAT I WANT TO DO NOW:

  You don't have to shout at us...


: Each line in a text file is a complete sentence.
: If the third sentence contains the word I am searching for, I want to
: print the third sentence (I CAN DO THIS) BUT I ALSO WANT TO print the

   More shouting? That's getting annoying...


: second and fourth lines too!

: How can I do it?

-------------------------
#!/usr/bin/perl -w

@inputData = (
   "Mary had a little lamb\n",
   "Whose fleece was really crusty\n",
   "Everywhere that stupid lamb went\n",
   "it smelled up the town\n",
   "Poor Mary\n"
);

$in{word} = 'stupid';

foreach $i (0..$#inputData) {
   if ($inputData[$i] =~ s#$in{word}#<b>$in{word}</b>#oi) {
      print $inputData[$i-1], $inputData[$i], $inputData[$i+1];
   }
}
-------------------------


: Please reply to:

[snip]

: Please delete "nospam." I am on holidays, will check my e-mail, but
: don't have news installed on my laptop to save space. I may miss the
: post. Sorry to be a pain.


   Sorry that you cannot get the answer until you return to news.


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


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

Date: 31 Jul 1998 04:35:30 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: How good is foreach and/or substitution?
Message-Id: <901860332.292870@thrush.omix.com>

[posted & mailed]

Jay Taylor <sysop97@nospam.callisto.si.usherb.ca> wrote:
: HERE'S WHAT I WANT TO DO NOW:
: Each line in a text file is a complete sentence.
: If the third sentence contains the word I am searching for, I want to
: print the third sentence (I CAN DO THIS) BUT I ALSO WANT TO print the
: second and fourth lines too!
        >snip<
: How can I do it?

        A few ways.  Use a buffer, or walk the lines by index.  I'd
        recommend the index, it's faster then a copy buffer, and can be
        more flexible.  Something like (untested) this maybe:

	my $extraLines = 1;

        for (my $line=0; $line <= $#inputData $line++) {
	    if ($inputData[$line] =~ s/$in{'word'}/<<b>$in{'word'}<\/b>/oix) {
	        my $start = $line - $extraLines;
	        $start = 0 if $start < 0;
	        my $stop  = $line + $extraLines;
	        print join ("<BR>\n", @inputData[$start .. $stop], '');
	    }
	}
-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Fri, 31 Jul 1998 08:20:59 GMT
From: fandino@usa.net
Subject: Re: How good is foreach and/or substitution?
Message-Id: <6prupa$mnv$1@nnrp1.dejanews.com>

In article <35C130F5.33E0@nospam.callisto.si.usherb.ca>,
  sysop97@nospam.callisto.si.usherb.ca wrote:

> HERE'S WHAT I WANT TO DO NOW:
>
> Each line in a text file is a complete sentence.
> If the third sentence contains the word I am searching for, I want to
> print the third sentence (I CAN DO THIS) BUT I ALSO WANT TO print the
> second and fourth lines too!

try this:

for $i (0..$#inputData)
{
	$line=$inputData[$i];
	if ($line =~ /$in{'word'}/i)
	{
		$line =~ s/$in{'word'}/<<b>$in{'word'}<\/b>/oix;
		print $inputData[$i-1],
			"<br>\n$line<BR>\n",$inputData[$i+1],"<br>\n";
	}
}

- Salva.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 23 Jul 1998 19:46:58 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: Inconsistent 'use strict;' error for undefined HASH reference
Message-Id: <6p8li2$pve@fumnix.metronet.com>

lr@hpl.hp.com (Larry Rosler) writes:
) #!/usr/local/bin/perl -w
) use strict;
) my $href;
) print scalar %$href, "\n";
[...]
) Can't use an undefined value as a HASH reference at ...
) 
) But if that print statement is replaced by
) 
) print scalar keys %$href, "\n";
) 
) the program prints 0 (there is no error from 'use strict;').
) 
) Is this inconsistent behavior reasonable?

I think it is a bug.  It doesn't even print a warning under
-w like it should:

    $ perl -w
    my $hash;
    print scalar keys %$hash;
    ^D
    0
    $ perl -w
    my $hash;
    print %$hash;
    ^D
    Use of uninitialized value at - line 2.
    $ 

) This is perl, version 5.004_03

Same in perl5.004_75.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 31 Jul 1998 04:06:38 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <slrn6s2gmi.hhe.sholden@pgrad.cs.usyd.edu.au>

On Thu, 30 Jul 1998 13:16:37 GMT, P.L. Hegarty <sm8plh@csc.liv.ac.uk> wrote:
>Ok if anyone else has any suggestions for a solution to this problem and you
>can ignore Ian, then please send me them as so far everyone has misread the
>question.
>
>The problem is I need a script that will output to the screen an exact copy
>of itself. The output should look the same as if you used 'cat or 'type' on
>the script. The only restrictions are you CAN NOT read ANYTHING into the
>script and you can not use any system calls, that is call more or anything
>like that.
>
>Again any help will be greatfully received.
>--

A simple quine problem I assume, probably an assignment or challenge...

Do a web search I'm sure you'll find heaps.. here's my solution that I'm
sure won't be any use to you...

---start quine.pl---
--- end  quine.pl---

Now run 'perl quine.pl' and guess what it prints out nothing... and guess what
the file contains nothing...

A simple way to create and test said script:

touch quine.pl
perl quine.pl

Now that was simple wasn't it...

Sam



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

Date: 30 Jul 1998 18:14:04 GMT
From: jack_h_ostroff@groton.pfizer.com (Jack Ostroff)
Subject: Re: Interesting Question needs Quick Answer
Message-Id: <6pqd5c$c3l5@mascagni.pfizer.com>

It took a while, but I have a solution in 26 lines, including
-w and use strict.  My biggest problem was quoting quotes.

I'll be glad to post it - but not until someone can assure me that
it is too late for someone to use it as a homework solution.

For those who didn't quite understand the wording of the problem:
'cat self.pl' and 'perl self.pl' should produce identical output
or 'perl self.pl | diff self.pl -' should produce no output.


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

Date: Thu, 30 Jul 1998 21:49:23 -0700
From: John Hanson <john@cutnfun.com>
Subject: Local Perl Installation and Form Processing
Message-Id: <35C14CD3.C9864DA3@cutnfun.com>

I'm busily trying to learn Perl on my own and just recently installed a
local version of the PERL interpretor.
I am trying to use an HTML form and send the info to a script for
processing.  My scripts run fine on my ISP, but I can't get them to work
locally.  When I press the <Submit> button on the form in local mode
nothing happens.  The form just sits there in Netscape.  It's finding
the script (because if I misname it, Netscape DOES give an file not
found error)... it's just not using it.  Any ideas?

Here's the HTML change I made:

Original->

<FORM METHOD=POST
ACTION="http://web6342d.ntx.net/cgi-bin/order-power.cgi">

Local->

<FORM METHOD=POST ACTION="file:///F|/perl/bin/order-power.cgi">

The script does work from the command line, but obviously I can't send
data to the script from the command line.

Please email me directly.  Thank you!

John Hanson
john@cutnfun.com



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

Date: Fri, 31 Jul 1998 08:51:16 +0100
From: Martin C Brown <mc@whoever.com>
Subject: Re: Local Perl Installation and Form Processing
Message-Id: <35C17774.E03C8D6B@whoever.com>

John Hanson wrote:

> Local->
>
> <FORM METHOD=POST ACTION="file:///F|/perl/bin/order-power.cgi">
>
> The script does work from the command line, but obviously I can't send
> data to the script from the command line.

You can't call a script locally - your browser is only capable of accessing
a file locally, not executing a program.

The easiest solution is to run a web server on your machine, then connect
to it just as would when working on the live site.

Un untidier method is to run the script locally, either faking the input or
using variables to set the values you want and checking the output of the
script.

MC



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

Date: Fri, 31 Jul 1998 06:27:11 -0400
From: Bill 'Sneex' Jones <sneaker@sneex.fccj.org>
Subject: Re: Local Perl Installation and Form Processing
Message-Id: <35C19BFF.E0C8751C@sneex.fccj.org>

Martin C Brown wrote:
> 
> John Hanson wrote:
> 
> > Local->
> >
> > <FORM METHOD=POST ACTION="file:///F|/perl/bin/order-power.cgi">
> >
> > The script does work from the command line, but obviously I can't send
> > data to the script from the command line.
> 
> You can't call a script locally - your browser is only capable of accessing
> a file locally, not executing a program.

If the Perl Script is 'perl scripting' from ActiveState, you can :)

You can tell Winders to associate the perl script with an action,
like execute the ActiveState interpreter, and bam!  Instant
security hole :)

HTH,
-Sneex- :) 
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Life is a 'Do it yourself' thing...
             http://webmaster.fccj.org/cgi/mail?webmaster


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

Date: 23 Jul 1998 17:04:28 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: Mod User Reg Hives w/ Win32 Perl
Message-Id: <6p8c1c$cbj@fumnix.metronet.com>

Kevin Jones <kcjones@umich.edu> writes:
) 
) My code is almost exactly like yours.  My problem now is unloading the hive
) Here is my test code:
[...]
) $HKEY_USERS->UnLoad($user) || die "Could not unload $user because $! \n";
                                                                    !!
                                                                    ^^
UnLoad() is _not_ going to set $! to anything useful.  In
Perl5.005, UnLoad() will set $^E to the reason for the failure. 
Prior to that, your best bet is Win32::FormatMessage(
Win32::GetLastError()), but that will only work if you have a
version of Win32::Registry that actually stores the failure
reason rather than throwing it away [like much of the Win32::
modules still do].

You might know this if Win32::Registry came with any
documentation, which it doesn't.  You might check out
Win32API::Registry which does have documentation.  If you
have Perl5.005, you might check out Win32::TieRegistry
which provides a much nicer interface.

Back to your problem...  You need to close any keys opened in the
loaded hive before you can unload it.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


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

Date: 31 Jul 1998 06:22:56 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: newbie split question
Message-Id: <6prns0$61r$2@client3.news.psi.net>

Matthew O. Persico (mpersico@erols.com) wrote on MDCCXCV September
MCMXCIII in <URL: news:35C12A07.667229FB@erols.com>:
++ Yes, you are doing something stupid here. :-) But that's ok; you should
++ see some of the stupid things I write!

Yes, like in this post :)

++ Next, the ^ is a SPECIAL CHAR in the regular expression you have
++ specified. It means "the beginning of the string". It is NOT the SHIFT-6
++ character on your keyboard. Either 
++ 1) split on a character expression, not a regexp 
++ 2) use the correct regexp
++ 
++ split("^") - char expr

Char expression? What's that? Which man page documents this?

++ split(/\^/) - regexp expr
++ 
++ If you didn't realize you were using a regexp, well, you need to do some
++ more studying:
++ 
++ open(MINN,"klaisjul2.txt") || die "no $!\n";
++  
++  while (<MINN>)
++  {
++   chomp;            	    # take the carriage return off
++   @list=split("^");         # split up the fields
++   print $list[0],"\n";      # print out first field
++  }

Where do people get the idea that "" or '' protects regex special characters
from being regex special characters?

$ perl -wle '$_ = "aap^noot^mies"; @list = split "^"; print $list [0]'
aap^noot^mies
$



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Fri, 31 Jul 1998 13:46:43 GMT
From: John Porter <jdporter@min.net>
Subject: Re: non-perl question about linux
Message-Id: <35C1CB5E.5A0B@min.net>

Draco Paladin wrote:
> 
> I use Slackware 3.4 and haven't had any problems yet.  
> It's almost as easy as RedHat to set up too. (I've done both.)

Thanks!  I have heard that RedHat 5.0 had some problems with
the "latest" (at that time) release of Perl.  Can you comment
on that?

-- 
John Porter


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

Date: Fri, 31 Jul 1998 08:25:49 GMT
From: dave@mag-sol.com
Subject: Re: number (6 -> 06) conversion question
Message-Id: <6prv2c$mrp$1@nnrp1.dejanews.com>

In article <35c196ab.1590537@thunder>,
  NukeEmUp@ThePentagon.com (David Cantrell) wrote:
>
> Extending this question a bit, is there an elegant way of zero-padding
> a number to an arbitrary length.  For instance, padding to make all
> numbers 4 figures ... 6 -> 0006, 37 -> 0037, and so on ...
>
> I thought that sprintf was the way to go, but having gone through the
> docs and K&R I can't figure out what the format should be.

David,

[s]printf is the way to go. For example:

perl -e 'printf "%06d", 666;'

hth,

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 31 Jul 1998 09:40:24 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl == Unix? (was Re: Programmer's Editor)
Message-Id: <fl_aggie-3107980940240001@aggie.coaps.fsu.edu>

In article <EZalpTA94aw1EwN2@find-it.uk.com>, Alan Silver
<alan@find-it.furryferret.uk.com> wrote:

+ Oh don't tease !! If only it were true and I could ditch this poxy
+ Windows machine for a *real* (ie UNIX) computer.

Its called 'linux'...

James


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

Date: Sun, 2 Aug 1998 16:05:04 GMT
From: stephen farrell <sfarrell@farrell.org>
Subject: Re: Perl/Linux/Database???
Message-Id: <87r9yzl68f.fsf@couatl.uchicago.edu>

R Frank Louden <flouden@netusa1.net> writes:

> 1. Is Perl a good language to use?

of course ;-)

> 2. Is it easy to port to MS Windows?

extremely... in fact in many cases no porting is required.

> 3. Is there a good reference book I can get to help with this
> database?

i assume you're talking about using perl to write an application that
talks to a database... the suggestions for postgres are good--mysql
and newly informix are other choices to consider... on the windows
side you can use ODBC from perl very nicely.  you probably want to
look at the database DBI documentation at

	http://www.hermetica.com/technologia/DBI/

hope this helps -- sf


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

Date: Sun, 2 Aug 1998 07:09:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Power (ie C's 4^7)
Message-Id: <MPG.102e12e9102aa49b9897aa@nntp.hpl.hp.com>

In article <35C467E7.E710B814@daimi.aau.dk> on Sun, 02 Aug 1998 15:21:43 
+0200, Thomas Jespersen <thomas@daimi.aau.dk> says...
 ...
> In perl you can write a^b as:
> 
> a**b

Which is borrowed from Fortran.  One possible interpretation of the 'e' 
in Perl is 'eclectic', remember.

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


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

Date: 2 Aug 1998 16:18:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Power (ie C's 4^7)
Message-Id: <6q23hi$9vm$1@marina.cinenet.net>

Thomas Jespersen (thomas@daimi.aau.dk) wrote:
: Thomas van Gulick wrote:
: > I couldn't find it in the perlop pages so I'll try here, is there some sort
: > of power function in perl ala the ^ operator in C, or do I have to do it all
: > myself?
: 
: In perl you can write a^b as:
: 
: a**b

No, in perl you write a^b as a^b ("a xor b").  You write C's pow(a,b) as
a**b.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 31 Jul 1998 15:40:01 +1000
From: David Coldrick <davidc@selectst.com>
Subject: Re: Problems building 5.005_01 on NT4, sp3
Message-Id: <35C158B1.FA1E9A43@selectst.com>

Well, I ended up hacking the Makefile, and removing all references to
Internet, and libwin32 built and tested OK. Successfully rebuilt tk8 and
installed that too, so I'm operational on 5.005_01, with only a few
scars :-)

Thanks and regards,
David

Troy Denkinger wrote:
> 
> In article <35C06878.DF13F71@selectst.com>, David Coldrick <davidc@selectst.com> wrote:
> >Hey Troy, good guess :-)
> 
> Well, I ought to get one right this decade.  <g>
> 
> I'm stumped on the new problem though.
> 
> Regards,
> 
> Troy Denkinger


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

Date: Fri, 31 Jul 1998 11:02:25 +0200
From: Uwe Segelbacher <uwe.segelbacher@desy.de>
Subject: Q: @argv with PerlW32?
Message-Id: <35C18821.68CCB2D3@desy.de>

Hi all

propably this question has been answered a lot of times, but
unfortunately I didn't find any real documentation or faqs on PerlW32.

PerlW32 seams not to read command line arguments in @argv. How do I get
these arguments?

Thanks a lot!

Uwe 

Dr. Uwe Segelbacher                   
Deutsches Elektronen-Synchrotron DESY


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

Date: Fri, 31 Jul 1998 10:09:25 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: seeing if a file exists.
Message-Id: <bbkCJQAFnYw1EwP9@find-it.uk.com>

In article <6pljhi$5uu$1@nswpull.telstra.net>, Martien Verbruggen
<mgjv@comdyn.com.au> writes
>In article <35bd76d3.304650@news.ukonline.co.uk>,
>       oliver.cook@bigfoot.com (Ollie Cook) writes:
>
>> I thought that wouldn't be necessary since the script is always called
>> from a browser and that will convey $ENV{'REMOTE_ADDR'} automatically.
>
>I'd still test it, just to make sure. It cannot hurt to be overly
>cautious, and to never trust the web server you're running this on.
>I've seen some pretty broken behaviour.

More importantly, REMOTE_ADDR is set by the *browser*, not the server.
So even if you know that your server is behaving, you have no idea what
is happening at the browser end. This is where the problem with client-
side features comes in. You should never assume anything about the type,
capabilities or configuration of the browser. At least you have some
control over the server.

Hope this helps,

Alan

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: Fri, 31 Jul 1998 05:18:52 GMT
From: "Vernon Mendanha" <vernon@pobox.com>
Subject: Self-referential regexps in Perl/ Representation of C++ templates as a regexp
Message-Id: <0tcw1.745$sl6.143821@news.mci2000.com>

Hi,
I was wondering if it is possible to represent self-referential
regexps in Perl.
In particular, I'd like to be able to match a C++ template.
The template could look like T1 < T2 < T3 < int > > >
The regexp [a-zA-Z_]+\s*\<.+\>  matches the above template.
However, it also matches the string T1 < T2 < T3 < int >
which is an incorrect declaration.
I'd like to be able to write a regexp like
[a-zA-Z_]+\s*\<$SelfReferentialRegexp\>|[a-zA-Z_]+\s*\<[a-zA-Z_]+\>
where a string would match $SelfReferentialRegexp if it matched the
whole pattern.

Is this possible in Perl or is there any other way this can be achieved
using a single regexp?

Thanx,
Vernon





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

Date: 31 Jul 1998 06:21:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Self-referential regexps in Perl/ Representation of C++ templates as a regexp
Message-Id: <6prnp3$9gp$1@marina.cinenet.net>

Vernon Mendanha (vernon@pobox.com) wrote:
: I was wondering if it is possible to represent self-referential
: regexps in Perl.
: In particular, I'd like to be able to match a C++ template.
: The template could look like T1 < T2 < T3 < int > > >
: The regexp [a-zA-Z_]+\s*\<.+\>  matches the above template.
: However, it also matches the string T1 < T2 < T3 < int >
: which is an incorrect declaration.

You can't match arbitrary-depth nested pairs with (just) a regex.  You
need a full-up lexer/parser to do that. 

: I'd like to be able to write a regexp like
: [a-zA-Z_]+\s*\<$SelfReferentialRegexp\>|[a-zA-Z_]+\s*\<[a-zA-Z_]+\>
: where a string would match $SelfReferentialRegexp if it matched the
: whole pattern.
: 
: Is this possible in Perl or is there any other way this can be achieved
: using a single regexp?

There's been some talk of regex extensions that would make *some* stuff
like this possible, but I don't think it's in 5.005.  And you really do
want a parser in any case.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Fri, 31 Jul 1998 10:00:06 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: Try perl on Ms Dos
Message-Id: <krQNFJAWeYw1EwqG@find-it.uk.com>

In article <35BCB24D.78E8@emirates.net.ae>, Suruchi
<sursood@mail.emirates.net.ae> writes
>Hi Everyone
>i would like to try executing some perl scripts on my stand alone pc. I
>know that perl compiel is available for Ms Dos. i've downloaded it but i
>can't save my file with the extention .pl . can some one help me.
>i'm using notepad to make the program.

Notepad saves all files with a .txt extension by default. you can either
enclose the whole filename in quotes to force it not to add this (so
save it as "ferret.pl" rather than ferret.pl) or you can select Save As
*.* from the drop-down and this will not add the .txt extension.

If you are going to do anything on a Windoze machine, please do yourself
a favour and don't use notepad. It's rubbish. There are loads of
excellent (free) text editors, many with special modes for Perl. Using
one of these will help you enormously. If you need more details, reply
here and I'll dig out some URLs for you.

Hope this helps,

Alan

-- 
Alan Silver
Please remove the furryferret when replying by e-mail


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

Date: Fri, 31 Jul 1998 07:11:33 GMT
From: jckchan@hkstar.com
Subject: WIN32::ODBC problem
Message-Id: <6prqn5$hhr$1@nnrp1.dejanews.com>

Dear all

Is http://www.roth.net down or closed???

I've a problem to pass a variable in a Sql call such as:

$db->Sql("select FirstName, LastName from Addresses where FirstName='$name'");

It cannot get the value of $name, but it works in "insert". What is wrong???

Please help!!!!
Thanks

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 31 Jul 1998 09:33:26 +0200
From: Alessandro Feltrin <afeltrin@nospam.c-m.it>
Subject: Writing 'date' format with OraPerl on a Oracle DB.
Message-Id: <35C17346.7AA7@nospam.c-m.it>

Hi, all.
I am a 'Perl beginner, and i've tried to do different thinghs with Perl
using various examples found in Internet.
I have solved my problem that was read write and update a table in an
Oracle database, but i've encountered serious problem trying to give a
'date' formatted birth field to a 'select', 'update' or 'insert' SQL
command using OraPerl.
I don't know where the problem lies, i've tried in many ways, using the
'to_date(FIELD,'ddmmyyyy')' function in SQLPlus, i've tried to format
the input received by an HTML form using the 

'$dd=sprintf("%02d",$inpud{'dd});'

and so on for the mm and yyyy fields. Nothing changes. I reveive even an
Oracle error like: 'Invalid month' or something like this. It seems
that  the birth 'date' go to the:

=====================================================================
if ($input{'mode'} EQ 'dati') {
   $nome = $input{'Nome'};
   $cognome = $input{'Cognome'};
   $dd = sprintf("%02d", $input{'dd'});
   $mm = sprintf("%02d", $input{'mm'});
   $yyyy = $input{'yyyy'};
   if ($ora) {
     $lda=&ora_login($database, $userid, $passwd) || die("Errore accesso
database: $ora_errstr");
     $userid_query = "Select COGNOME, NOME, USERID ";
     $userid_query.= "from user_anag where rtrim(COGNOME,' ') = :1 and
rtrim(NOME,' ') = :2 and DATA_NASCITA = to_date(:3,'ddmmyyyy')";
     $csr=&ora_open($lda, $userid_query) || die("Errore open database:
$ora_errstr");
     &ora_bind($csr, $cognome, $nome, "$dd$mm$yyyy") || die("Errore bind
database: $ora_errstr");
     if (!($query=&ora_fetch($csr))) {
       die("Errore fetch database: $ora_errstr") if ($ora_errstr) ;
       print <<"EndOfText";
    	<font face="Comic Sans MS">Utente non esistente!</FONT><BR>
EndOfText
       &footer;
======================================================================

part of program.

I've tried to debug the problem, tring to verify what the input variable
contains, and i've printed it with a

print "\n\"$variable\"\n";

ant it look like:

"DDMMYYYY"

Does anybody may help me???????

Any help will be very appreciated.

Happy week-end and best regards.

Alessandro.

-- 
PLEASE - REMOVE 'nospam' from the mail address!!!
                          \|/
                         (@ @)
---------------------oOO--(_)--OOo----------------
Alessandro Feltrin - C&M S.p.a. Tel. 011-7767877
		     Torino - C.so Svizzera, 185
		     E-Mail afeltrin@c-m.it


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

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


Administrivia:

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

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


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 3319
**************************************

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