[10563] in Perl-Users-Digest
Perl-Users Digest, Issue: 4155 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 5 05:08:00 1998
Date: Thu, 5 Nov 98 02:00:21 -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 Thu, 5 Nov 1998 Volume: 8 Number: 4155
Today's topics:
Re: Decimal to Hex conversion (Eric Hagen)
encrypt filter? rbaguer@freenet.columbus.oh.us
Re: Heterogeneous Data Structures: possible? If so, how (Patrick Timmins)
Re: Heterogeneous Data Structures: possible? If so, how (Sam Holden)
IIS4, Perl, Object Moved <sysop@scbbs.com>
Re: illegitimate data types ? <merlyn@stonehenge.com>
Re: Installing large quantities of modules (Steffen Beyer)
Re: Javascript in Perl Problem? <seven7seas@ibm.net>
Re: Pattern matching alan@ciborg.demon.co.uk
perl questions PLEASE HELP :) (jcl)
perl questions PLEASE HELP ASAP! (jcl)
Re: perl&cgi question jbharvey@auspex.net
Re: perl&cgi question jbharvey@auspex.net
Re: perl&cgi question (Sam Holden)
Re: perl&cgi question jbharvey@auspex.net
pointer question <rsingh@polymail.calpoly.edu>
post from perl to html <bill@sterzenbach.com>
Socket Problem <sysop@scbbs.com>
Substitutions <desquite@hotmail.com>
Re: using die to prevent blank forms (I.J. Garlick)
Re: using die to prevent blank forms <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Using Perl to do an HTTP "GET /" <merlyn@stonehenge.com>
Re: Win32::NetAdmin lamzak8642@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Nov 1998 06:21:59 GMT
From: ehagen@Hawaii.Edu (Eric Hagen)
Subject: Re: Decimal to Hex conversion
Message-Id: <71rg67$4l2@news.Hawaii.Edu>
Actually, To be honesto I had not looked at sprintf, perhaps I should
have pre-appended "HELP I'm a clueless newbie to perl before my question".
Thank's to all who helped point me in the right direction.
Tk Soh (r28629@email.sps.mot.com) wrote:
: Eric Hagen wrote:
: > I have found hex () to convert from hex to decimal, and printf to print
: > out hex values, but for the life of me I can not find in any of my docs on
: > how to covert decimal values to hex values.
: > I'm so desperate I would be happy with a unix tool or system call to get
: > the hexed value.
: So you know about printf, huh? Then you must have heard about sprintf,
: haven't you?
--
Eric Hagen "Sometimes we get lost in the darkness,
ehagen@Hawaii.Edu the dreamers learn to steer by the stars..."
"You fight for something because it is good.
Not because it stands to succeed."
------------------------------
Date: Thu, 05 Nov 1998 06:27:30 GMT
From: rbaguer@freenet.columbus.oh.us
Subject: encrypt filter?
Message-Id: <71rggi$696$1@nnrp1.dejanews.com>
Can anyone point me in the right direction on this? If all that is visible on
a perl script is the location of perl and something that says
Filter::Encrypt, where should I look to find that? How does the script run on
the fly while most of it is encrypted? I've searched webcrawler and perl.com
but could not find any reference to this. Thanks.
--
Please cc: my email, i'm using dejanews at the moment.
open source everything
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 07:04:52 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Heterogeneous Data Structures: possible? If so, how?
Message-Id: <71rimk$85c$1@nnrp1.dejanews.com>
In article <xfkpvb3j66r.fsf@bigger.aa.net>,
Charles Roten <croten@bigger.aa.net> wrote:
> I want to do something more than a little odd ... I want to build a
> structure $DataStructure such that sometimes
>
> $DataStructure->[$index]->{$key}
>
> refers to a scalar/string, and sometimes to a named hash or array.
>
> As in (string case)
>
> $FireWall_Rule->[7]->{"install"}->"firewall_box"
>
> but (array case)
>
> $FireWall_Rule->[7]->{"services"}->[0]->"telnet"
> $FireWall_Rule->[7]->{"services"}->[1]->"login"
> $FireWall_Rule->[7]->{"services"}->[2]->"echo-request"
>
> and (hash case)
>
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"type"}->"accept"
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"color"}->"Dark green"
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"icon-name"}->"icon-accept"
>
> etc. All in the _same_ $FireWall_Rule structure.
You can* use the string case and the array case together. eg (modifying
your example):
$FireWall_Rule[7]{'install'} = "firewall_box";
and
$FireWall_Rule[7]{'install'}[0] = "first item";
or You can* use the string case and the hash case together. eg:
$FireWall_Rule[7]{'install'} = "firewall_box";
and
$FireWall_Rule[7]{'install'}{'date'} = "November 4, 1998";
but you can't have the array case and the hash case together. eg:
$FireWall_Rule[7]{'install'}[0] = "first item"
and
$FireWall_Rule[7]{'service'}{'telnet'} = "Inside Only";
*Note that you will not be able to have the first two cases either
if you use 'use strict qw(refs);' in your code (as was pointed
out to me yesterday by Sam Holden in the "illegitimate data types"
thread here in c.l.p.m.)
For me, it hasn't been a problem (yet) because I have not used it in
situations where I have a duplicate item in one of my arrays (yet), or
duplicate values in one of my hashes (yet).
I *am* going to stop doing it though ... so that I don't slip up :)
Also, it's just as easy to say:
$FireWall_Rule[7]{'install'}{'item'} = "firewall_box";
$FireWall_Rule[7]{'install'}{'date'} = "November 4, 1998";
etc. etc.
as it is to say:
$FireWall_Rule[7]{'install'} = "firewall_box";
$FireWall_Rule[7]{'install'}{'date'} = "November 4, 1998";
etc. etc.
In your case, I would say you almost certainly *should not* use
the "mixed case" scenario outlined above (string case with array case
or string case with hash case). Actually, I guess I would now say
don't use the mixed case scenario in *any* case ... use strict (refs);
instead :)
Hope that helps.
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 5 Nov 1998 08:18:23 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Heterogeneous Data Structures: possible? If so, how?
Message-Id: <slrn742nqe.er3.sholden@pgrad.cs.usyd.edu.au>
On Thu, 05 Nov 1998 07:04:52 GMT, Patrick Timmins <ptimmins@netserv.unmc.edu>
wrote:
>In article <xfkpvb3j66r.fsf@bigger.aa.net>,
> Charles Roten <croten@bigger.aa.net> wrote:
>
>> I want to do something more than a little odd ... I want to build a
>> structure $DataStructure such that sometimes
>>
>> $DataStructure->[$index]->{$key}
>>
>> refers to a scalar/string, and sometimes to a named hash or array.
>>
>> As in (string case)
>>
>> $FireWall_Rule->[7]->{"install"}->"firewall_box"
>>
>> but (array case)
>>
>> $FireWall_Rule->[7]->{"services"}->[0]->"telnet"
>> $FireWall_Rule->[7]->{"services"}->[1]->"login"
>> $FireWall_Rule->[7]->{"services"}->[2]->"echo-request"
>>
>> and (hash case)
>>
>> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"type"}->"accept"
>> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"color"}->"Dark green"
>> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"icon-name"}->"icon-accept"
>>
>> etc. All in the _same_ $FireWall_Rule structure.
>
>You can* use the string case and the array case together. eg (modifying
>your example):
>
>$FireWall_Rule[7]{'install'} = "firewall_box";
> and
>$FireWall_Rule[7]{'install'}[0] = "first item";
>
>
>or You can* use the string case and the hash case together. eg:
>
>$FireWall_Rule[7]{'install'} = "firewall_box";
> and
>$FireWall_Rule[7]{'install'}{'date'} = "November 4, 1998";
This will not do what you expect ...
This will create a variables called %firewall_box which due to symbolic
references you could access as $FireWall_Rule[7]{'install'}.
However, it _will_ break if you change the value of
$FireWall_Rule[7]{'install'}. It will break if you happen to have a variable
of the same name. So don't do it.... here is an example of how it might break:
$foo{'bar'} = 'baz';
$foo{'bar'}{'oops'} = 'this seems to work';
print $foo{'bar'}; # will print 'baz'
print $foo{'bar'}{'oops'}; # will print 'this seems to work'
%baz = ('oops' => 'did you expect that...');
print $foo{'bar'}{'oops'}; # will print 'did you expect that...'
%unrelated = ('oops' => 'oh deary me...');
$foo{'bar'} = 'unrelated';
print $foo{'bar'}{'oops'}; # will print 'oh deary me...'
I don't think there is any circumstance that you would actually want this
behaviour (I guess if you didn't have real references but this is perl5...).
However, the original request is perfectly valid. By using 'ref' you can make
it quite powerful indeed. Look at the Data::Dumper module implementation for
some examples of how this can be used.
>*Note that you will not be able to have the first two cases either
>if you use 'use strict qw(refs);' in your code (as was pointed
>out to me yesterday by Sam Holden in the "illegitimate data types"
>thread here in c.l.p.m.)
Or if you don't want to clobber unrelated variables or 'lose' some of
your variables... There is a reason strict refs is giving an error after all.
--
Sam
It has been discovered that C++ provides a remarkable facility for
concealing the trival details of a program--such as where its bugs are.
--David Keppel
------------------------------
Date: Thu, 05 Nov 1998 09:35:35 GMT
From: Ron Parker <sysop@scbbs.com>
Subject: IIS4, Perl, Object Moved
Message-Id: <3641716D.53FA3B71@scbbs.com>
Not sure which newsgroup is best, but I hope someone in one has ran
across this.
I wrote a Perl script running on a Unix server which does http socket
calls (using cgi-lib.pl, http-lib.pl, and Socket.pm) to pages running on
an IIS 4.0 server. Whether on Netscape or IE browser, the server
returns "Object Moved" error message, "This document may be found
here". And, one must click on the link to the url (the same one which
was sent in the original socket call).
I have read the workaround for asp pages, but I don't think that applies
here. The program which does the socket call is running as a cgi-bin
program under an Apache server.
Any suggestions would be appreciated. Thanks.
-ron
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
------------------------------
Date: 04 Nov 1998 08:54:00 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: illegitimate data types ?
Message-Id: <8cbtmnlahz.fsf@gadget.cscaper.com>
>>>>> "Larry" == Larry Wall <larry@kiev.wall.org> writes:
Larry> One of the interesting asymmetries of Perl is that, in the method call
Larry> Person->new();
Larry> Person is used as a package name (used as a class name), but in
Larry> Person->{fname}
Larry> it's used as the name of a hash, and in
Larry> Person->[0]
Larry> it's used as the name of an array.
(You missed one...)
And in
"Person"->("fred",2,"barney");
it's used as the name of a subroutine!
--
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: 3 Nov 1998 09:53:03 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: Installing large quantities of modules
Message-Id: <71mjpv$890$1@en1.engelschall.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> <mlehmann@prismnet.com>],
> who wrote in article <71m194$rb7$1@nnrp1.dejanews.com>:
>> h2xs -A -X -n To_Much_Jolt
>>
>> This builds a directory tree for me, some boilerplate files, and a Makefile.PL
>> file for me. I can easily install this one package with the commands:
>>
>> perl Makefile.PL
>> make install
>>
>> But I will have dozens of these packages and I need to be able to
>> conveniently tar them up into an install package, then move that code to
>> multiple remote computers, untar the files on the remote machine, and then
>> install all of the packages. How is this done. I've looked through the
> Try copying the .pm files into the directory with Makefile.PL, add them
> to MANIFEST, then type
> make dist
If you want the modules to reside in different subcategories, create a
subdirectory "lib" in the same directory as the "Makefile.PL", create
the subdirectory structure you want in there, move the modules to
their locations in this structure, run a
find . -type f -print | cut -c3- >MANIFEST
in the directory with the "Makefile.PL" and *then* call "make dist".
Yours,
--
Steffen Beyer <sb@engelschall.com>
Free Perl and C Software for Download: www.engelschall.com/u/sb/download/
------------------------------
Date: Thu, 05 Nov 1998 02:32:30 -0500
From: forking process <seven7seas@ibm.net>
To: TipTup JHA&HHA <TipTup@webtv.net>
Subject: Re: Javascript in Perl Problem?
Message-Id: <3641548E.8D65282@ibm.net>
TipTup JHA&HHA wrote:
> print FILE "<script language=\"Javascript\">\n";
> print FILE "function name(){\n";
> print FILE "alert(\"This is a test\");\n";
> print FILE "}\n";
> print FILE "</script>";
> for some reason this never works,
[snip]
this one does, don't ask me why.
print HDUMP"<SCRIPT language=\"JavaScript\"> \n";
print HDUMP"<!-- 117 \n";
print HDUMP"function CloseIt() { \n";
print HDUMP" close(); \n";
print HDUMP"} \n";
print HDUMP"// --> \n";
print HDUMP"</SCRIPT> \n";
any   gurus with a real answer?
Now I'm curious!
--
________________________
remove 7 from my address
========================
-|- Who, has loved us more? -|-
------------------------------
Date: Thu, 05 Nov 1998 08:24:08 GMT
From: alan@ciborg.demon.co.uk
Subject: Re: Pattern matching
Message-Id: <36416041.602066826@news.theplanet.net>
Thank for your answer Tom, I will check it out, I have read the FAQ,
but it does not really give a clear answer, other than a similar
example, but no explenation as many of the others do.
>Jeff Lovell <jalovel@email.msn.com> wrote:
>
>> I hate to sound stupid here, but is this how you answer all questions on
>> this newsgroup Tom? I probably shouldn't have asked, you will tell me to
>> read the FAQ or RTFM.
>
>Not all questions. Only those questions that can be answered by reading
>the FAQ or the manual.
>
>> Tom Phoenix wrote in message ...
>> >See the FAQ, section four. Also, check out the Text::CSV module on CPAN.
>
>If not for Tom Phoenix, someone else would have to do it.
>
>--
> _ / ' _ / - aka - rjk@coos.dartmouth.edu
>( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
> / http://www.ziplink.net/~rjk/
> "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 04 Nov 1998 07:47:41 GMT
From: jcl4sale@yahoo.com (jcl)
Subject: perl questions PLEASE HELP :)
Message-Id: <36400675.28415702@newsreader.jvnc.net>
Hey everyone,
I do not like to go to newsgroups for my programming problems
(because i like to figure it out on my own), but this has to be done
my tomorow afternoon, and i don't know what else to do. The program
has to simulte the part of a network layer and i have most of it done
with two main problems.
1)
I need to search in a string for five ones, and if so replace it
with a five ones and a zero i.e.
11111 would become 111110
and 111111011111101110111111 would become :
111110101111101011101111101
and so on,
i tried using : s/11111/111110/ and with the g option, but the
program just waits or freezes, it can't tell but ctrl+c stops it. It
works as s/1111/11110/ and s/111111/1111101/ but not the way i need it
to.
2)
I also would like to know away, to thorw away the current input.
What i mean is, i'm reading from stdio, and i sometime just wan't to
toss the current string and read the next one, there's probably a real
simple way to do this, but i don't know, (BTW i'm using a while to get
data from stdio).
Thanx everyone for your help in advance, and any tips you give give
would be much appreciated.
--jordan
lederman@elvis.rowan.edu
------------------------------
Date: Wed, 04 Nov 1998 07:43:12 GMT
From: jcl4sale@yahoo.com (jcl)
Subject: perl questions PLEASE HELP ASAP!
Message-Id: <363fef3b.22469145@newsreader.jvnc.net>
Hey everyone,
I do not like to go to newsgroups for my programming problems, but
this has to be done my tomorow afternoon, and i don't know what else
to do. The program has to simulte the part of a network layer and i
have most of it done with two main problems.
1)
I need to search in a string for five ones, and if so replace it
with a five ones and a zero i.e.
11111 would become 111110
and 111111011111101110111111 would become :
111110101111101011101111101
and so on,
i tried using : s/11111/111110/ and with the g option, but the
program just waits or freezes, it can't tell but ctrl+c stops it. It
works as s/1111/11110/ and s/111111/1111101/ but not the way i need it
to.
2)
I also would like to know away, to thorw away the current input.
What i mean is, i'm reading from stdio, and i sometime just wan't to
toss the current string and read the next one, there's probably a real
simple way to do this, but i don't know, (BTW i'm using a while to get
data from stdio).
Thanx everyone for your help in advance, and any tips you give give
would be much appreciated.
--jordan
lederman@elvis.rowan.edu
------------------------------
Date: Thu, 05 Nov 1998 05:49:11 GMT
From: jbharvey@auspex.net
Subject: Re: perl&cgi question
Message-Id: <71re8n$46v$1@nnrp1.dejanews.com>
I was only trying to help, I'm not disputing whether it's appropriate for this
newsgroup or not.
(and yes, it /is/ a browser thing. if it works on one browser and not in the
other.)
In article <71kvuf$bj6$1@nnrp1.dejanews.com>,
droby@copyright.com wrote:
> Wrong.
>
> This has nothing to do with Perl, and would be better discussed in a forum
> that discusses CGI and server (NOT browser) configuration.
>
> --
> Don Roby
> droby@copyright.com
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 05 Nov 1998 07:38:29 GMT
From: jbharvey@auspex.net
Subject: Re: perl&cgi question
Message-Id: <71rkll$9tm$1@nnrp1.dejanews.com>
Then how do you explain it working in Netscape and not IE?
In article <slrn74232m.rqo.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Thu, 05 Nov 1998 02:14:32 GMT, jbharvey@auspex.net <jbharvey@auspex.net>
> wrote:
> >No, it is NOT a server thing, his browser has to understand how to interpret
> >what type of document he has and what to do with it. You have to change the
> >pl associate or MIME: application/x-perl to run it within the browser and not
> >to save it as a file. One of his browsers, I can't remember which is doing
> >this fine, he needs to do it on the other one.
>
> You are completely wrong here. By definition a CGI program does not
> run in the browser, but on the server. Since the server couldn't care less
> about the browser's MIME setup changing it won't help...
>
> The server needs to know the .pl is a valid extension for CGI scripts and thus
> execute the script and pass on the ouput, instead of just outputting the
> contents of the file (as it would normally do).
>
> --
> Sam
>
> compiling kernels is what I do most, so they do tend to stick to the
> cache ;) --Linus Torvalds
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 5 Nov 1998 08:24:05 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: perl&cgi question
Message-Id: <slrn742o55.er3.sholden@pgrad.cs.usyd.edu.au>
On Thu, 05 Nov 1998 07:38:29 GMT, jbharvey@auspex.net <jbharvey@auspex.net>
wrote:
>Then how do you explain it working in Netscape and not IE?
Because IE is set up wrong...
However, IEs set up can not decide whether a server runs a script or outputs
a program. The original post implied that the server was not running the
CGI script, but returning the text. That is a server thing not a browser
thing.
--
Sam
You are bordering on ridiculous if you think you need to support your
premises. Such an argument is an infinite regression.
--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>
------------------------------
Date: Thu, 05 Nov 1998 08:40:28 GMT
From: jbharvey@auspex.net
Subject: Re: perl&cgi question
Message-Id: <71ro9s$en8$1@nnrp1.dejanews.com>
brian and Sam,
I withdraw my speculation on this problem after research, forgive my argument.
removing foot from mouth,
j
In article <slrn74232m.rqo.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Thu, 05 Nov 1998 02:14:32 GMT, jbharvey@auspex.net <jbharvey@auspex.net>
> wrote:
> >No, it is NOT a server thing, his browser has to understand how to interpret
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 5 Nov 1998 00:35:55 -0800
From: "Raj Singh" <rsingh@polymail.calpoly.edu>
Subject: pointer question
Message-Id: <71roqr$25k$1@cscnews.csc.calpoly.edu>
When I run the following code:
$a = 2;
$b = /$a;
print $b;
This is supposed to print the value of $a b/c $b is a reference to it.
However, my compiler outputs the error:
Spurious backslash ignored at ...
I would greatly appreciate any suggestions. I am new to the language.
Thanks.
Raj
------------------------------
Date: Thu, 5 Nov 1998 00:05:34 -0500
From: "Billsterz" <bill@sterzenbach.com>
Subject: post from perl to html
Message-Id: <71r8hu$hcn$1@nntp.erinet.com>
Hi,
New perl user here.
Does anyone know how to pass a variable from a cgi script to a form?
Assuming the perl script opens the form_file and wants to pass $passme to a
field in the form called "passto"
The end result would be when the user calls the cgi, it opens an already
prepared htm file,displays it to the user with one field that already has a
pre-determined value in it.
Any help?
Thanx,
Bill
bill@sterzenbach.com
------------------------------
Date: Thu, 05 Nov 1998 07:18:38 GMT
From: Ron Parker <sysop@scbbs.com>
Subject: Socket Problem
Message-Id: <36415154.DDD477E3@scbbs.com>
I am using, I believe, the classic perl socket call to basically read
and print a page from a www site. This program works on an older Linux
machine running an older NCSA web server and Perl 4.x.
However, it doesn't work under PErl 5.02 with a somewhat older Apache
web server. Essentially, the program, ran as a .cgi program, bombs out
because the web server will not print the results from the other site
without a "Content: text/html" line printed first.
Anybody ran into this particular problem, and have any resolutions?
Below is the code I am using (required "sockets.pl" and "socket.ph" are
present):
local ($current_host, $host, $service, $file, $first_line);
chop ($current_host = `/bin/hostname`);
$host = $temp_host;
$service = 80;
$file = "$root\?$query";
&open_connection (HTTP, $host, $service);
print HTTP "GET $file HTTP/1.0\n\n";
while (<HTTP>) {
$outputline = $_;
print "$outputline";
}
close (HTTP);
Thanks for any help.
--
Ron Parker
TradePoint LA / Tradewinds / SCBBS
www.intl-trade.com
www.tradepointla.org
www.scbbs.com
------------------------------
Date: Thu, 5 Nov 1998 02:00:18 -0500
From: "DesQuite" <desquite@hotmail.com>
Subject: Substitutions
Message-Id: <A3c02.960$J42.8796@newsfeed.slurp.net>
I'm reading from a file that looks like this:
data1
data2
data1
data3
data2
Then I use this command to get rid of the all data2's
@array =~ s/data2//;
The array is left with a newline at the very end. If I can delete each
newline before each data 2 then it should fix the problem. I thought that
@array =~ /s\ndata2//; would work but it didn't.
I'm able to read the array again after I remove data2 and chomp it to make
it work, but I'm reading and writing from a file and it's just too messy.
Any ideas on an easier way to do this? Thanks for you help!
------------------------------
Date: Thu, 5 Nov 1998 08:46:36 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
To: "Pap" <Pap22@erols.com>
Subject: Re: using die to prevent blank forms
Message-Id: <F1xxpp.KD1@csc.liv.ac.uk>
[Posted and mailed]
In article <71q46v$gmr$1@autumn.news.rcn.net>,
"Pap" <Pap22@erols.com> writes:
> To prevent someone from submitting a blank form, I use the die command to
> halt the rest of the script and display a message, like this:
>
> if ($FORM{'email'} eq "") {
> die "<h2>Error!</h2><p>Please fill out the field for your E-mail address.";
> }
Those helpful sounding commands don't quite do what you think they do. Just
because you see the output from die when you run on the command line doesn't
mean it print's to STDOUT. In fact it goes to STDERR (it's probably in the
docs somewhere).
Do your self a favour try forcing a command line script to die and run it
like this:-
script_name 2> /dev/null
Then when you understand what is going on comeback to your CGI and change the
die to a print. You will need to follow the print with an exit 1 call, or
better still copy the die line and add it under the print. That way your
user gets a nice error warning and you get an entry in the error log to tell
you what went wrong. Just good programming practice really, you should always
know there is something wrong before it is reported. That way you can look
good and fix it quickly then tell people it has been fixed.
>
> But when I test it out on my server, I just get this error message instead
> of the <hr>Error!</h2>... I get:
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was unable
> to complete your request....(blah blah blah)...Premature end of script
> headers ../postdata.cgi
>
> It DOES halt the rest of the script, which is good, but I would like the
> user to see what mistake he made. What am I doing wrong?
>
> Thank you.
> -Pap
>
>
--
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>
<postmaster@merseymail.com>
"If you can count your money, you don't have a billion dollars."
-- J. Paul Getty
------------------------------
Date: 05 Nov 1998 10:40:17 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: using die to prevent blank forms
Message-Id: <83iugu8ola.fsf@vcpc.univie.ac.at>
Re: using die to prevent blank forms, I
<ijg@csc.liv.ac.uk> said:
I> Then when you understand what is going on comeback to
I> your CGI and change the die to a print. You will need to
I> follow the print with an exit 1 call, or better still
Why exit `1'?
Although there was some kind of internal problem which
caused the application to `die', as far as the CGI/HTTP
layer interaction is concerned, this is a normal
termination.
So to indicate termination of the "CGI script" I think it is
better to use exit(0) to mark a correctly terminated
program.
I can imagine some HTTP servers might react to a non-zero
exit code from launched CGI and other server-side
applications.
That's just my opinion of course, anyone else?
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 04 Nov 1998 11:10:34 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Paul Fischer <paul.fischer@cwusa.com>
Subject: Re: Using Perl to do an HTTP "GET /"
Message-Id: <8c4ssfl46d.fsf@gadget.cscaper.com>
>>>>> "Paul" == Paul Fischer <paul.fischer@cwusa.com> writes:
Paul> I know I've seen scripts to open a socket and do an HTTP GET. I don't know
Paul> where to find them and I am not good enough to write one myself. I am
Paul> trying to create a tiny application that checks to see if the web server
Paul> returns a certain error on "GET /". Normally I would use "expect" to do the
Paul> GET, but expect is not on all the machines this app will run on.
If you have LWP installed,
GET http://your.host.here/
or if you really need it as a script:
perl -MLWP::Simple -e 'getprint "http://your.host.here/"'
--
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: Thu, 05 Nov 1998 07:36:06 GMT
From: lamzak8642@my-dejanews.com
Subject: Re: Win32::NetAdmin
Message-Id: <71rkh6$9ra$1@nnrp1.dejanews.com>
In article <71nuc2$d8k$1@nnrp1.dejanews.com>,
schergr@my-dejanews.com wrote:
> Please someone help me.....
>
> given the following code:
>
> use Win32::NetAdmin;
> Win32::NetAdmin::UsersExist("XXXXXXXXX", "YYYYYYYY") || die "Error1: ",
Why does your line end with a ',', not a ';'?
More important:
"XXXXXXXX" should be the server name *including* four backslashes, for
example "\\\\MYSERVER2".
The following code works great on my system:
use Win32::NetAdmin;
$server = "\\\\GET-NT1";
@accountlist = qw(jonkerss nothere administrator burenj abcdefg);
for $account (@accountlist) {
#print "Account is $account\n";
if (Win32::NetAdmin::UsersExist($server, $account) ) {
print "Account $account does exist on $server\n";
} else {
print "Account $account does NOT exist on $server\n";
}
}
The result is:
U:\perl\nt>perl -w t.pl
Account jonkerss does exist on \\GET-NT1
Account nothere does NOT exist on \\GET-NT1
Account administrator does exist on \\GET-NT1
Account burenj does exist on \\GET-NT1
Account abcdefg does NOT exist on \\GET-NT1
Lam Zak
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 4155
**************************************