[10943] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4543 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 4 20:17:21 1999

Date: Mon, 4 Jan 99 17:00:59 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 4 Jan 1999     Volume: 8 Number: 4543

Today's topics:
        $0 as .//programName  ? <xah@web-central.net>
    Re: $0 as .//programName  ? (Greg Andrews)
        $a = `$cmd` problem <shum@cig.mot.com>
    Re: @ARGV in CGI scripts (Randal L. Schwartz)
    Re: @ARGV in CGI scripts (Abigail)
    Re: @ARGV in CGI scripts (Abigail)
    Re: A big problem an Medium sized one and an Ickle one. <aqumsieh@matrox.com>
        a problem! (_cim_)
    Re: a problem! <staffan@ngb.se>
        Arrays from File Handles Problem <r2-d2@REMOVEbigfoot.com>
    Re: Arrays from File Handles Problem (Tad McClellan)
        background server (Eric Hammervold)
    Re: Basic Perl DOS/Win95 + WWW + CGI course for Newbies <jwarner@tivoli.com>
        Berkeley DB and Perl (Nathan Clemons)
    Re: binary conversion (Brand Hilton)
        BSDI/3.1, Perl, ncurses 4.2 (Elf Sternberg)
        CGI Redirecting Script (Nathan Clemons)
    Re: CGI Redirecting Script (Jason Costomiris)
    Re: challenge: 99 bottles of perl (was Re: The quine pa (Craig Berry)
    Re: change perl script process name <bas@yournews.nl>
        Correct password, but still returns error (Groovy94)
        Correctly Module (News)
    Re: Correctly Module <dgris@moiraine.dimensional.com>
        End of Thread: Security & Permissions: Why can't Perl r <design@raincloud-studios.com>
        End of thread: Security & Permissions: Why can't Perl r <design@raincloud-studios.com>
    Re: faking the referer in HTTP::Request::Form <webmaster@link-maker.com>
        File locking to synchronize queues, fcntl() vs.  File:: <tbc@col.hp.com>
        File Operations problem ed_c@my-dejanews.com
    Re: File Operations problem <eugene@verticalnet.com>
    Re: File Upload Script (Sam Curren)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 04 Jan 1999 10:53:07 -0800
From: "Xah Lee" <xah@web-central.net>
Subject: $0 as .//programName  ?
Message-Id: <76r28i$80v$1@remarQ.com>

Can someone explain that why $0 returns the program name with  ".//" prefixed?

For example,

#!/bin/perl -w
use strict;
print "--$0--\n";
__END__

prints
--.//xtest.pl-- 

I kinda expect one of the following

"--xtest.pl--".
"--./xtest.pl--".


Thanks.

Xah
xah@-S-P-A-M-.best.com
http://www.best.com/~xah/PageTwo_dir/more.html
GNU: helping the moronic unix community move forward.


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

Date: 4 Jan 1999 11:32:10 -0800
From: gerg@shell1.ncal.verio.com (Greg Andrews)
Subject: Re: $0 as .//programName  ?
Message-Id: <76r4vq$p6k$1@shell1.ncal.verio.com>

"Xah Lee" <xah@web-central.net> writes:
>Can someone explain that why $0 returns the program name with  ".//" prefixed?
>
>For example,
>
>#!/bin/perl -w
>use strict;
>print "--$0--\n";
>__END__
>
>prints
>--.//xtest.pl-- 
>
>I kinda expect one of the following
>
>"--xtest.pl--".
>"--./xtest.pl--".
>

It prints '--./xtest.pl--' for me.  My perl is:

gandrews% /usr/local/bin/perl -v   

This is perl, version 5.004_04 built for sun4-solaris


>GNU: helping the moronic unix community move forward.

Er...  Glass houses?

  -Greg


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

Date: Mon, 04 Jan 1999 11:15:28 -0600
From: Edmond Shum <shum@cig.mot.com>
Subject: $a = `$cmd` problem
Message-Id: <3690F730.5E3A7750@cig.mot.com>


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

I was trying to execute something like:
$a = `$cmd`;

Under usual situation, it is ok. However I have encountered the
situation
that if the system out of resources ( swap, process ), it will fail.
If it fails for *many* times, the above statement will fail again for
max open file
handle being reached, even when resource is released.

It turned out  to be that when it fails, it just close one end of the
pipe.
So I try the following:

pipe(IN,OUT);
if ( $pid = fork ) {
    close OUT;
    while (<IN>) { $a .= $_; }
    close IN;
     wait;
    }
elsif ( defined $pid ) {
    close IN; close STDIN; close STDOUT;
    open (STDOUT,">&OUT");
    exec "$cmd";
    }
else { close IN; close OUT }    # cannot fork

to make sure that both end will close properly upon failed fork.

You see how tedious and heavy is this code ? Anyone has suggestion on
any other solution ?

--
Edmond Shum                     System and Network Administration
Motorola CIG                    email: shum@cig.mot.com
Arlington Heights, IL           phone: 847-632-6702



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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
I&nbsp;was trying to execute something like:
<BR>$a = `$cmd`;
<P>Under usual situation, it is ok. However I have encountered the situation
<BR>that if the system out of resources (&nbsp;swap, process ), it will
fail.
<BR>If it fails for *many*&nbsp;times, the above statement will fail again
for max open file
<BR>handle being reached, even when resource is released.
<P>It turned out&nbsp; to be that when it fails, it just close one end
of the pipe.
<BR>So I&nbsp;try the following:
<P>pipe(IN,OUT);
<BR>if (&nbsp;$pid = fork )&nbsp;{
<BR>&nbsp;&nbsp;&nbsp; close OUT;
<BR>&nbsp;&nbsp;&nbsp; while (&lt;IN>)&nbsp;{&nbsp;$a .= $_; }
<BR>&nbsp;&nbsp;&nbsp; close IN;
<BR>&nbsp;&nbsp;&nbsp;&nbsp; wait;
<BR>&nbsp;&nbsp;&nbsp; }
<BR>elsif (&nbsp;defined $pid )&nbsp;{
<BR>&nbsp;&nbsp;&nbsp; close IN; close STDIN; close STDOUT;
<BR>&nbsp;&nbsp;&nbsp; open (STDOUT,">&amp;OUT");
<BR>&nbsp;&nbsp;&nbsp; exec "$cmd";
<BR>&nbsp;&nbsp;&nbsp; }
<BR>else {&nbsp;close IN; close OUT&nbsp;}&nbsp;&nbsp;&nbsp; # cannot fork
<P>to make sure that both end will close properly upon failed fork.
<P>You see how tedious and heavy is this code ?&nbsp;Anyone has suggestion
on
<BR>any other solution ?
<PRE>--&nbsp;
Edmond Shum&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System and Network Administration&nbsp;
Motorola CIG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email: shum@cig.mot.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Arlington Heights, IL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phone: 847-632-6702</PRE>
&nbsp;</HTML>

--------------6EAF5E45DCE7FCE3CD6CF5DE--



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

Date: 04 Jan 1999 08:09:09 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: @ARGV in CGI scripts
Message-Id: <m1zp7z81ga.fsf@halfdome.holdit.com>

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

Bart> Many servers, including that of my ISP (Apache) do actually pass some
Bart> variation on parts of the URL in @ARGV. Exactly WHAT it does, probably
Bart> depends heavily on the server's configuration.

ARGV passing is how they did it "in the old days".  Apache still does
a backward-compatible-but-highly-deprecated version for your
enjoyment.

DO NOT count on it being there in the future.

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


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

Date: 4 Jan 1999 17:15:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: @ARGV in CGI scripts
Message-Id: <76qt01$s4o$1@client3.news.psi.net>

Artoo (r2-d2@REMOVEbigfoot.com) wrote on MCMLII September MCMXCIII in
<URL:news:76q5io$74q$1@plug.news.pipex.net>:
++ Hi all
++ Happy New Year!
++ 
++ Please could somebody explain briefly how @ARGV works with CGI scripts, I've
++ seen many scripts that pass the @ARGV to the script in the following way:
++ 
++ http://www.yourcompany.com/cgi-bin/cgi_script_name.cgi?user=fred&pass=fred&c
++ at=any

No they don't. 

++ When I try passing this to a script it does not recognise any of the @ARGV.
++ if I do print "@ARGV"; it doesn't print anything.

Exactly.


Please read the CGI specification. That will explain how parameters
are passed - in a way that's not at all Perl specific, and falls
hence outside of the context of this group.


HTH. HAND.



Abigail


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

Date: 4 Jan 1999 17:17:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: @ARGV in CGI scripts
Message-Id: <76qt39$s4o$2@client3.news.psi.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MCMLII September MCMXCIII in
<URL:news:3691b380.15840919@news.skynet.be>:
++ Tony Curtis wrote:
++ 
++ >Artoo> Please could somebody explain briefly how
++ >Artoo> @ARGV works with CGI scripts, I've seen many
++ >
++ >It doesn't!
++ >
++ >Artoo> scripts that pass the @ARGV to the script in
++ >Artoo> the following way:
++ >
++ >Noooo they don't!
++ 
++ Have you actually tried it? :-)
++ 
++ Many servers, including that of my ISP (Apache) do actually pass some
++ variation on parts of the URL in @ARGV. Exactly WHAT it does, probably
++ depends heavily on the server's configuration.


That's of course possible. However, that's not following the CGI
specification.  And the question was about CGI scripts, not about scripts
following some other protocol.



Abigail


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

Date: Mon, 4 Jan 1999 17:15:11 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: A big problem an Medium sized one and an Ickle one.
Message-Id: <x3yvhimelcg.fsf@tigre.matrox.com>


mike@mjm.co.uk writes:

> $Var=~s/\[//g;
> $Var=~s/\]//g;
> 
> Will remove all occurences of "[" and "]" in the scalar $Var

yeah but,

$Var =~ tr/[]//d;

is much faster.



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

Date: Mon, 04 Jan 1999 23:01:04 GMT
From: cim@online.ee (_cim_)
Subject: a problem!
Message-Id: <3691453b.4591145@news.online.ee>

I have a form with a textarea.
This would be the typical content of that area:


ehrwieu ierhwuierhwieuhr weriweurwieu iweuhrweur
weuhfuiwehfuwehfuwefuwe f 
efnweofweoif weifjweijfwioejfwioe

oweifowefoiwejfoiwejfowe
wefjweifjowiejfowiejfowiefw
efwpeofjweijfwef
wefpwe

wepfpwefjpwoefpwoef
wefopwefjpweofwef
wefpwejfpwjepfo


well, not that typical.
Anyway this form is submitted to my perl script.

1. What I need is to get a string up to the point where the first
space (empty line) occurs.
2. I need to write this all to a html file, but these empty lines
should be replaced with <p>, or <p> should be inserted just
before/after/ the line.
3. Now string from point 1. is written to another file.

PS. When this info is copied (from another application when filling
the form) it may be possible that these empty lines contain spaces or
tabs etc.

Hope someone can help me.

cim.


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

Date: Tue, 05 Jan 1999 00:32:10 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: a problem!
Message-Id: <36914F7A.936B5DF8@ngb.se>

> 1. What I need is to get a string up to the point where the first
> space (empty line) occurs.

@paragraphs = split( /\n[\t\s]*\n/, $string );

> 2. I need to write this all to a html file, but these empty lines
> should be replaced with <p>, or <p> should be inserted just
> before/after/ the line.

$html = join( "\n<p>\n", @paragraphs );

> 3. Now string from point 1. is written to another file.

print ANOTHERFILE @paragraphs[0];


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

Date: Mon, 4 Jan 1999 17:54:46 -0000
From: "Artoo" <r2-d2@REMOVEbigfoot.com>
Subject: Arrays from File Handles Problem
Message-Id: <76qvcs$c7$1@plug.news.pipex.net>

Hi All

When I make an array from a File Handle and then print something if the
member of the array is not blank, it will still print it even if the line in
the File Handle is blank.

EG:

open(FILE,"$path/file");
@file=<FILE>;
close(FILE);

if ($file[1] ne ''){
print "exists";
}

if you do this from a normal array then it works, but if the second line of
the file is empty then it still prints it because it is reading a return in
the file I imagine.  How can I make it only print it is there is really
something on the line?

Thanks for any help
Artoo




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

Date: Mon, 4 Jan 1999 16:27:11 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Arrays from File Handles Problem
Message-Id: <v7fr67.ce.ln@magna.metronet.com>

Artoo (r2-d2@REMOVEbigfoot.com) wrote:

: When I make an array from a File Handle and then print something if the
: member of the array is not blank, it will still print it even if the line in
: the File Handle is blank.

: EG:

: open(FILE,"$path/file");

   except in your real code I'm sure that you are checking the
   return from that open() call?

      open(FILE,"$path/file") || die "could not open '$path/file'  $!";


: @file=<FILE>;


   chomp(@file);  # get rid of all the newlines


: close(FILE);


: if you do this from a normal array then it works, but if the second line of
: the file is empty then it still prints it because it is reading a return in
: the file I imagine.  


   If it has a newline in it, then it *isn't* empty...


: How can I make it only print it is there is really
: something on the line?


   chomp();


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


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

Date: 5 Jan 1999 00:34:56 GMT
From: ehammerv@tricity.wsu.edu (Eric Hammervold)
Subject: background server
Message-Id: <76rmng$nci$1@leopard.it.wsu.edu>

Hello

I need some information on generating background servers for windows NT.  Specificly
is it possible for a perl program to be running as a server program while nobody is
loged into the machine?  If so, how do you do it?  Second if you can have a perl
server running in the background without anybody logged into the machine, how can
you identify the person useing the server( how do you check there identity)?

If anyone has any information in this area it would be helpful.


Thanks,




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

Date: Mon, 04 Jan 1999 15:13:19 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: Basic Perl DOS/Win95 + WWW + CGI course for Newbies , Christmas free  offer .
Message-Id: <36912EEF.32B0A7CD@tivoli.com>

If you are willing, send me an outline of the topics you intend to cover
and I will be happy to volunteer to write a section or two.  Most of my
experience in this area is with Perl+IIS+WinNT but there is much that
carries over to Win95+Personal Web Server.

John Warner

tavi wrote:

> Expert wrote in message <36817006.E6F@friko.onet.pl>...
> >I would like to give basic Perl course for newbies.
> >Integration of CGI Perl scripts with WWW pages.
> >Setting up simple WIN95/ web server and setting up web pages + CGI
> >programs running on your PC , for testing purposes.
> >
> >Hope this course to be free, interactive, mayby on shareware basis.
> >
> >If some of you guys are interested I set up  news group to move us
> >there.
> >regards,
> >Jack
>
> Yes, how does one join the fun?
>
> Walter



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

Date: Mon, 04 Jan 1999 20:20:44 GMT
From: nathan@ici.net (Nathan Clemons)
Subject: Berkeley DB and Perl
Message-Id: <3691229a.342238358@news.ici.net>

Does Berkeley DB require the use strict under PERL?

I'm not seeing any errors from my script now but it doesnt seem to be
actually affecting the file anymore...

*goes off to define use strict and iron out the error messages with
cgi-lib.pl*

--Nathan.


_________________________________________________________________________
Nathan Clemons
Associate Systems Engineer
WinStar iCi
Broadband Services
Great Woods Office Park 800 South Main St. Mansfield, MA 02048
_________________________________________________________________________
nclemons@winstar.com   http://www.winstar.com/  (v) 800-234-0002 ext.1109
   nathan@ici.net      http://www.ici.net/      (f) 508-261-0430
</html>


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

Date: 4 Jan 1999 17:23:05 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: binary conversion
Message-Id: <76qtdp$erd1@mercury.adc.com>

In article <x7iuenev7q.fsf@home.sysarch.com>,
Uri Guttman  <uri@home.sysarch.com> wrote:
>remember, perl IS the swiss army chainsaw of languages.

Haven't we achieved "Swiss army tactical nuke" status yet?  ;-)

-- 
 _____ 
|///  |   Brand Hilton  bhilton@adc.com
|  ADC|   ADC Telecommunications, ATM Transport Division
|_____|   Richardson, Texas


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

Date: 4 Jan 1999 23:29:12 GMT
From: elf@halcyon.com (Elf Sternberg)
Subject: BSDI/3.1, Perl, ncurses 4.2
Message-Id: <76ris8$oc0$1@brokaw.wa.com>

	I am attempting to use the Curses.pm Perl module on BSDI/3.1
with the ncurses 4.2 library. I compiled everything through shlicc2,
which I assumed was the correct compiler choice (which is, by the way, 
a wrapper around egcs 1.1).  I continue to get:

Can't load 'blib/arch/auto/Curses/Curses.o' for module Curses: can't
resolve undefined symbols: Inappropriate file type or format at
/usr/local/lib/perl5/5.00502/i386-bsdos/DynaLoader.pm

	Perl gurus have assured me that the problem lies in Curses.o;
when the file gets dl'd into Perl's memory space, it tries to load
libncurses.a as a shared library.  Since it isn't a shared library and 
a shared version hasn't been defined into /etc/shlib.map (and is not
likely to be), the load dies.

	Is there a way to build Curses.o with the *entire*
libncurses.a built into it, rather than trying to load it after the
fact, dynamically?  Has anyone else ever gotten the Perl module
Curses.o to work with BSDI.  With ncurses?

	Thanks,

		Elf Sternberg

	

--
Elf M. Sternberg, rational romantic mystical cynical idealist
If you're so smart, why aren't you naked?
http://www.halcyon.com/elf/


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

Date: Mon, 04 Jan 1999 16:01:43 GMT
From: nathan@ici.net (Nathan Clemons)
Subject: CGI Redirecting Script
Message-Id: <3690d79d.323039168@news.ici.net>

Was wondering if anyone is familiar with a loading URL program that
basically :

#!/usr/local/bin/perl

$formdata=;
$formdata=~s/\s+$//;


foreach (split(/&/, $formdata))
{
($name, $value)=split(/=/, $_);
$name=~s/\+/ /g;
$name=~s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
$value=~s/\+/ /g;
$value=~s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;

$data{$name}=$value;
}
print "Location: $data{'url'}\n\n";

It rewrites the location header to redirect the browser to the page
specified in the form. Is there any way I could easily modify this so
that if it were redirecting to a CGI script, it would post the
information contained in the form data as well? Ie, were I using the
cgi-lib.pl, it would be the %input variable.

--Nathan


_________________________________________________________________________
Nathan Clemons
Associate Systems Engineer
WinStar iCi
Broadband Services
Great Woods Office Park 800 South Main St. Mansfield, MA 02048
_________________________________________________________________________
nclemons@winstar.com   http://www.winstar.com/  (v) 800-234-0002 ext.1109
   nathan@ici.net      http://www.ici.net/      (f) 508-261-0430
</html>


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

Date: 4 Jan 1999 17:25:17 GMT
From: jcostom@madcow.jasons.org (Jason Costomiris)
Subject: Re: CGI Redirecting Script
Message-Id: <slrn791ubt.4af.jcostom@madcow.jasons.org>

On Mon, 04 Jan 1999 16:01:43 GMT, Nathan Clemons <nathan@ici.net> wrote:
: Was wondering if anyone is familiar with a loading URL program that
: basically :

Instead of that icky mess, why not?

#!/usr/bin/perl -Tw
use CGI;
my $url = param("url");
print redirect("$url");

(Note the use of the procedural format to make some folks happy.)

: It rewrites the location header to redirect the browser to the page
: specified in the form. Is there any way I could easily modify this so
: that if it were redirecting to a CGI script, it would post the
: information contained in the form data as well? Ie, were I using the
: cgi-lib.pl, it would be the %input variable.

You might want to use the above, only rather than the last line,
use LWP to POST to another script.

Followups directed to comp.infosystems.www.authoring.cgi.

-- 
                 Jason Costomiris <><
            Technologist, cryptogeek, human.
jcostom {at} jasons {dot} org  |  http://www.jasons.org/ 


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

Date: 4 Jan 1999 22:23:46 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: challenge: 99 bottles of perl (was Re: The quine page)
Message-Id: <76rf1i$mi7$1@marina.cinenet.net>

Uri Guttman (uri@ibnets.com) wrote:
: i was embarrassed that our lovely language was so poorly represented,
: so i wrote a (almost) one liner. other than the arg handling it is one
: statement. so my xmas eve challenge to all you non-christians and
: get-a-lifers is to write your favorite version to generate this ditty.
: the hardest part is getting the 's' right. any other short ways of
: having 1 or 0 's' based on a boolean are welcome.

Rather than a one-liner, here's a production-ready, strict-compliant
version, featuring an abysmally lazy approach to pluralization:


#!/usr/bin/perl -w
# beer - prints out the '99 bottles of beer' song.
# Craig Berry (19990104)

use strict;

my $botCnt = shift || 99;

my $beer   = '%d bottle%s of beer';
my $wall   = "$beer on the wall";
my $take   = 'Take one down, pass it around,';
my @plural = ('s', '', ('s') x ($botCnt - 1));

for (my $newCnt = $botCnt - 1;
     $botCnt > 0;
     $botCnt = $newCnt--) {
  printf "$wall,\n$beer!\n$take\n$wall!\n\n",
         ($botCnt, $plural[$botCnt]) x 2,
         $newCnt, $plural[$newCnt];
}


-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "The hills were burning, and the wind was raging; and the
       clock struck midnight in the Garden of Allah."


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

Date: Mon, 04 Jan 1999 18:04:46 +0100
From: "Bas A. Schulte" <bas@yournews.nl>
Subject: Re: change perl script process name
Message-Id: <3690F4AE.2A716D8B@yournews.nl>

Hi,

> How can i change "/usr/local/bin/perl abc" to other process name such as
> "bcd"?

$0 = 'bcd';

Not sure how portable this is; it works on our Linux boxes, but does not
seem to work on our HP/UX 10.20's.

Ciao.


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

Date: 5 Jan 1999 00:47:01 GMT
From: groovy94@aol.com (Groovy94)
Subject: Correct password, but still returns error
Message-Id: <19990104194701.21163.00007708@ng95.aol.com>

I am creating a program which requires user login with ID # and password. It
checks the ID # just fine, and then it moves on to the password. But, when it
checks the inputed password (which is now crypted, so I can check it against
the crypted password in their user info, it returns my error message that it is
the wrong password. Here is a snip of code from my script, the problem is
somewhere in here:

$crypted_password = crypt($INPUT{'password'}, aa);

	open(RESELLERS,"<resellers.dat") || &error("Cannot read from resellers.dat");
	@resellers=<RESELLERS>;
	close(RESELLERS);

	foreach $reseller (@resellers) {
		($id,$first_name,$last_name,$address,$city,$state,$postal_code,$country,
$email,$url,$password) = split(/\|/, $reseller);	
	
		if ($INPUT{'id'} == $id) {
			if ($crypted_password eq $password) {
				&reseller_stats;
				exit;
			}
			else {
			wrong password error message
				exit;
			}
				
		}
	}


Please email as well as post, thank you.



Regards,
Gil Hildebrand, Jr.
Dynamic Scripts

Email: groovy94@aol.com
ICQ UIN: 16678754


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

Date: Mon, 4 Jan 1999 15:37:10 -0200
From: "ZAZ (News)" <bludemo@zaz.com.br>
Subject: Correctly Module
Message-Id: <76r8d3$fs0$1@srv4-poa.nutecnet.com.br>

Hi ....

    what is the module used by ...

    Data::ShowTable.

    Thanks ..

Alex





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

Date: 04 Jan 1999 16:14:34 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Correctly Module
Message-Id: <m33e5qeilh.fsf@moiraine.dimensional.com>

"ZAZ (News)" <bludemo@zaz.com.br> writes:

> Hi ....
>     what is the module used by ...
>     Data::ShowTable.

I have absolutely no idea what you are asking, but I'll try
to answer anyway.

Data::ShowTable itself is available from CPAN as
$CPAN/authors/id/AKSTE/Data-ShowTable-3.3.tar.gz.

It appears that the only modules that it uses are Carp and Exporter.

HTH.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 4 Jan 1999 19:29:24 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: End of Thread: Security & Permissions: Why can't Perl read files from the owner level?
Message-Id: <76r4qk$ge9@bgtnsc03.worldnet.att.net>

I appreciate the replies,  the patience and apoligize for asking an
'off-topic' question.

>   s/e/a/;

My apologies... had been up 24 straight hours. |( z z z

>   Is it you under your "usual" login name, or is it owned by
>   whatever your CGI scripts run as? (often 'nobody')


I'm looking into it. I have access to my 'live server' config files and
will be 'studying and comparing' today. :)

Thanks again.

CT




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

Date: 4 Jan 1999 19:52:39 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: End of thread: Security & Permissions: Why can't Perl read files from the owner level?
Message-Id: <76r667$lvg@bgtnsc03.worldnet.att.net>

>++ boxes. Yet none of them will work if called from a browser.
>A browser doesn't call scripts. A server will.

Oh geez. C'mon. Is every poster required to recite the process of a
browser sending info to the server.. blah blah blah? :)

>What you need is a basic grasp of user ids and permissions.

Obviously. I know enough to be dangerous, but am missing a vital part.

>You have _clients_ and you don't know this basic stuff?
>I feel sorry for your clients; they must have been ripped off.


My clients have very successful sites. I'm a start-up. Someone out there
gave you your break didn't they?

The more secure directories on their sites are protected with .htaccess
files and blank index pages. So I'm not exactly someone who just leaves
the door wide open. I am trying to learn how to tighten security on my
scripts (in the wrong newsgroup) and server and I don't think insulting
someone who is trying to learn something is appropriate in any
situation. It's uselessly destructive.

 So ... excuse me for not having ownership or permission to your brain
when I woke up yesterday, I'm still learning how to do that part. :)

moving my questions to a CGI newsgroup now. ...

CT




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

Date: Mon, 04 Jan 1999 13:32:33 -0700
From: jim <webmaster@link-maker.com>
Subject: Re: faking the referer in HTTP::Request::Form
Message-Id: <3691255D.F1B61DD7@link-maker.com>

here is the code in question...

it works fine, but I need to know how to place the referer...

do i need to create a new HEADERS object and call ->referer?
if so, how do I get that into the correct header?
tried ($f->press(@button),$head)

  my($url) = url $info{"url"};
  my($ua) = LWP::UserAgent->new;
  $req = HTTP::Request->new('GET',$url);
  my($res) = $ua->request($req);
  if($res->is_error)
    {$r= $res->error_as_HTML;}
   else{
    $cont=$res->content;
    my($tb) = HTML::TreeBuilder->new;
    $tb->parse($cont);
    @forms = @{$tb->extract_links(qw(FORM))};
    $f = HTTP::Request::Form->new($forms[0][1], $url);
    &substitute;    #fills in form fields
    $response = $ua->request($f->press(@button));
    $r=$response->content();}
  

brian d foy wrote:
> 
> In article <368F37DD.743529DB@link-maker.com>, webmaster@link-maker.com posted:
> 
> >   I need to set the http_referer in a script that uses HTTP::Request::Form.
> >
> >   When I dump() the script returns the base as the correct referer but
> > when I check the referer on the recieving end there is nothing...
> >
> >   I tried using HTTP::Headers, but had no luck...
> >
> >   Any help would be great!
> 
> God helps those who help themselves.  perhaps you'd like to share
> a bit of your code so we might recognize the problem?
> 
> --
> brian d foy
> CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
> HTTPeek <URL:http://www.smithrenaud.com/public/httpeek.shtml>


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

Date: Mon, 4 Jan 1999 13:56:49 -0700
From: "Tim Chambers" <tbc@col.hp.com>
Subject: File locking to synchronize queues, fcntl() vs.  File::LockDir
Message-Id: <76r9us$di8$1@nonews.col.hp.com>

I want to synchronize a queue across parallel processes. One process at a
time gets the queue. The queue data is stored in a little file. One process
at a time locks the file, reads it, dequeues, writes the new queue back out,
and then unlocks. My OS (HP-UX 10.20) doesn't implement flock(), but I found
a nifty recipe for using fcntl() instead
(ftp://ftp.informatik.uni-muenchen.de/pub/comp/programming/languages/script/
perl/oasis/exts/filehandling/hp.flock.emul.pl). I finally got locking
working the way I wanted, but today I realized that I need simultaneous
read/write access. I considered opening the file for multiple read/write
access and passing a write lock to fcntl(), but I don't trust that approach.
(Code snippets available if you want to see them.) Has anyone had experience
with this?

Anyway, I can better understand the solution with File::LockDir module (PERL
COOKBOOK, pp. 264-266). That seems to do just what I want, and I'll start
hacking from there after I post this message. I'm hoping tchrist or someone
else can answer a question about the use of return in that module, though:

# <snip>

# anything forgotten?
END {
    for my $pathname (keys %Locked_Files) {
        my $lockname = name2lock($pathname);
        my $whosegot = "$lockname/owner";
        carp "releasing forgotten $lockname";
        unlink($whosegot);
        return rmdir($lockname);
    }
}

1;

Doesn't that return statement prematurely exit from the loop? This looks
like a bug to me, but maybe I'm just a nimrod.

--
<>< Tim
http://www.geocities.com/Athens/3680/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS$/P d d+(-) d-- s:+>: a>? C$>? UH+$>++++ P+++$>+++++
L+>+++$ E++$ W++(--)$>+++ N+(-) !o@ K? w(--)$ O->+++ M? V?
PS---(-) PE(++) Y+@ PGP->+++ t+() 5++@ X-- R->* tv+@>++$
b++@>+++ DI++(++++)>- D--- G(-)>++++ e++>++++ h--- r+++>++
y++++>+
------END GEEK CODE BLOCK------

The opinions and URL recommendations stated here are my own
and do not necessarily represent those of Hewlett-Packard.





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

Date: Mon, 04 Jan 1999 18:31:36 GMT
From: ed_c@my-dejanews.com
Subject: File Operations problem
Message-Id: <76r1e9$9o6$1@nnrp1.dejanews.com>

Hello world :-)

I'm writing a simple script that needs to delete and rename a file.  However,
I keep getting a failure for both unlink and rename.  Neither seems to work. 
I'm running the Apache server on NT 4.0 using ActiveState Perl for Win32. 
Could it have something to do with file permissions?  I've set the
permissions on the directory to "ALL ACCESS" but still no luck.  I realize
this in not strictly a Perl problem, but if anyone has any suggestions or has
ran into this before, I'd appreciate some help.

Thanks,

Eddie

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 04 Jan 1999 19:13:13 -0500
From: Eugene Sotirescu <eugene@verticalnet.com>
Subject: Re: File Operations problem
Message-Id: <36915918.B9B373CB@verticalnet.com>

The error message and code that generates would help to help.

ed_c@my-dejanews.com wrote:

> Hello world :-)
>
> I'm writing a simple script that needs to delete and rename a file.  However,
> I keep getting a failure for both unlink and rename.  Neither seems to work.
> I'm running the Apache server on NT 4.0 using ActiveState Perl for Win32.
> Could it have something to do with file permissions?  I've set the
> permissions on the directory to "ALL ACCESS" but still no luck.  I realize
> this in not strictly a Perl problem, but if anyone has any suggestions or has
> ran into this before, I'd appreciate some help.
>
> Thanks,
>
> Eddie
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own



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

Date: Mon, 4 Jan 1999 10:07:29 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: File Upload Script
Message-Id: <MPG.10faa33e29530f719896c9@news.sonic.net>

Make sure that you have the latest CGI.pm installed. If not, get the 
newest from CPAN.

-Sam

In article <368c6e55.0@news1.ibm.net>, tavi367@ibm.net says...
> -
> ====================================================================
> The software required `Windows 95 or better', so I installed Mac OS.
>  -- Remember: Win 95 = Mac 84 = GS 80 = Xerox 72
> Sam Curren wrote in message ...
> >[This followup was posted to comp.lang.perl.misc and a copy was sent to
> >the cited author.]
> >
> >I have tried several, and had trouble with all the ones using cgi_lib.pl
> >
> >Using CGI.pm I have been very successful. Let me know if you need any
> >example scripts, I have several that worked for me.
> 
> 
> I could use some examples that work.
> 
> My version that uses CGI.pm gives me "malformed multipart posts" every 6 to
> 8 submits and I have no idea why.
> 
> Thanks
> 
> Walter
> 
> 
> 
> 


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

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

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