[13200] in Perl-Users-Digest
Perl-Users Digest, Issue: 610 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 21 19:07:23 1999
Date: Sat, 21 Aug 1999 16:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 21 Aug 1999 Volume: 9 Number: 610
Today's topics:
Artistic License <hanenkamp@networksplus.net>
Backtracking up through parent directories <preble@ipass.net>
Re: Backtracking up through parent directories <dhill@sunbeach.net>
Re: determining a leap year (Sami Rosenblad)
finding a running process on NT <davehaasdeja@my-deja.com>
Help on local Perl and guestbook algorithm <by newbie> <hurley@hurl.com>
Re: Help on local Perl and guestbook algorithm <by newb (Bill Moseley)
Help reading comma-separated values from file <church@NOSPAMspinn.net>
Re: Help reading comma-separated values from file (Eric Bohlman)
Re: Help reading comma-separated values from file <makkulka@cisco.com>
Re: Help reading comma-separated values from file <makkulka@cisco.com>
Re: How to distinguish strings 'A|\\|B|' from 'A|\|B|' holmberg@NoSpam.net
Looking for able Perl Programmer in Fargo, ND <kc@avsupport.com>
Newbie again <jyoyoliu@hotmail.com>
Re: Newbie again <hanenkamp@networksplus.net>
Newsgroup archive (Irwin Feuerstein)
Re: Newsgroup archive (Matthew Bafford)
Re: Newsgroup archive (Irwin Feuerstein)
Re: Newsgroup archive (J. Moreno)
Re: Packages and parent packages <elflord@panix.com>
Perl and SSLeay <jkhertog@worldnet.att.net>
Re: PERL EDITOR davehaasdeja@my-deja.com
Re: Perl Threads: Discussion area?; Comment on www.perl <dan@tuatha.sidhe.org>
Re: processing html on the fly part 2 <flavell@mail.cern.ch>
qx(), WinNT, and another Perl script (SCLunapark)
Suggestion on the best cgi method based on Apache serve (Dan)
Re: UDP help Nuthinbutnews web interface user
User session ID? <PinnTech@Worldnet.att.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 21 Aug 1999 14:30:26 -0500
From: Andrew Sterling Hanenkamp <hanenkamp@networksplus.net>
Subject: Artistic License
Message-Id: <37BEFE51.7B63F730@networksplus.net>
Can someone answer this for me?
I wish to use the code in toke.c and a couple other Perl headers from
the source to implement a syntax highlighter for Code Crusader--a
programming IDE. Is this legal? If so, what credit do I need to give
to Larry Wall and anyone else who's worked on these files? Where should
the credit be given? Just in the source files? Or should I instruct
the author of Code Crusader to put something in the release notes or
elsewhere?
I just want to make sure I have legal priveleges to use the code before
I do and give credit where it's due. I couldn't find anything in the
Artistic License that implicitly or explicitly granted me such a
privelege so I just wanted to find out from somebody who really knows
and this seemed the place to start.
God bless,
Sterling
------------------------------
Date: Sat, 21 Aug 1999 15:14:15 -0400
From: "E. Preble" <preble@ipass.net>
Subject: Backtracking up through parent directories
Message-Id: <QQCv3.1104$tp2.936@news.ipass.net>
I have a security issue that I'd like to hear feedback on.
A form submits a filename to a script for sending via email.
If the form were to submit this:
file.doc
the script goes to a directory, grabs the file, attaches it
and end of story.
If the form reads:
../../otherfile.doc
The script will go up 2 directory levels and then grab the
otherfile.doc. This is what I want to avoid, for obvious
reasons. It's easy to add a substitution call to the script
to remove any '..' occurances.
$file = s/..//g;
Are there other things I should be worried about? Are there
other ways to backtrack up through directories like this and
grab un-authorized files?
Thanks ahead.
Edward preble
--
Datatrend Software
http://www.datatrendsoftware.com
mailto:info@datatrendsoftware.com
Grab It! digitizer for MS Excel
Double Check It Products
Automail scripts for website automation
----------------------------------------------------
------------------------------
Date: Sat, 21 Aug 1999 18:44:03 -0400
From: Duncan Hill <dhill@sunbeach.net>
Subject: Re: Backtracking up through parent directories
Message-Id: <Pine.LNX.4.10.9908211841250.27546-100000@bajan.pct.edu>
On Sat, 21 Aug 1999, E. Preble wrote:
> reasons. It's easy to add a substitution call to the script
> to remove any '..' occurances.
> $file = s/..//g;
>
> Are there other things I should be worried about? Are there
> other ways to backtrack up through directories like this and
> grab un-authorized files?
Use a regex to specify what can and cannot be in the file name. If a
/ is ever present, trunc it, or return an error message, and possibly
even log it. In fact, the only place a . should ever exist is
between two alphanumeric characters (assuming you use "standard" file
names). Therefore, a . at the beginning of the file should be
illegal.
HTH
--
Duncan Hill Sapere aude
One net to rule them all, One net to find them,
One net to bring them all, and using Unix bind them.
------------------------------
Date: Sun, 22 Aug 1999 01:31:32 +0300
From: blade@leela.janton.fi (Sami Rosenblad)
Subject: Re: determining a leap year
Message-Id: <blade-2208990131320001@durandal.janton.fi>
In article <37beb0db@news.cadvision.com>, "K C Owens"
<owensk@cadvision.com> wrote:
> A year divisible by 4 is a leap year unless it is divisible by 400. 2000 is
> a leap year but 2100 is not.
Uhh, wrong. A year is a leap year if...
- it is divisible by 4
- and not divisible by 100
- or it is divisible by 400
Therefore, year 2000 is a leap year and 2100 is not, but for different
reasons than stated above.
--
Sami Rosenblad -- blade@leela.janton.fi -- running linux since 1999
------------------------------
Date: Sat, 21 Aug 1999 19:13:32 GMT
From: PerlMongerWannaBe <davehaasdeja@my-deja.com>
Subject: finding a running process on NT
Message-Id: <7pmton$86$1@nnrp1.deja.com>
Hi all.
I want to find out if a process is running under NT. If it is, then I
won't start the next portion of the script. If it isn't, I will.
I can get to it using the win32::perflib module (dereferencing several
hashes), but it's a bit convoluted. I'm also writing it for a company
who will need to understand it after I'm done, so simplicity would be
much preferred. I'm going to document it very well, but I'm not sure
it'll help.
Is there an easier way ??
Cheers,
Dave
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 21 Aug 1999 11:05:44 -0400
From: "Domino Hurley" <hurley@hurl.com>
Subject: Help on local Perl and guestbook algorithm <by newbie>
Message-Id: <bhzv3.125$Z02.9967@quark.idirect.com>
Hi.
I installed ActivePerl on my computer and I want to integrate it with my =
web browser. Do I have to make emulate a web-residing folder by making =
something like a local "public_html" folder and within that a "cgi-bin" =
folder containing the executables from my c:\perl\bin"?
Also, does anyone have an algorithm (or flowchart) for a simple =
guestbook CGI script (variables are just $name and $comment, very =
simple) ?
Thanks.
------------------------------
Date: Sat, 21 Aug 1999 08:20:17 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Help on local Perl and guestbook algorithm <by newbie>
Message-Id: <MPG.122863849b950fca9896cc@nntp1.ba.best.com>
Domino Hurley (hurley@hurl.com) seems to say...
> I installed ActivePerl on my computer and I want to integrate it with my =
> web browser. Do I have to make emulate a web-residing folder by making =
> something like a local "public_html" folder and within that a "cgi-bin" =
> folder containing the executables from my c:\perl\bin"?
You need a web server. I'd recommend Apache (www.apache.org), but there
are many others available.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Sat, 21 Aug 1999 13:55:27 -0600
From: "DC" <church@NOSPAMspinn.net>
Subject: Help reading comma-separated values from file
Message-Id: <NyDv3.16$151.23510@news.gstis.net>
Please don't direct me to Text::CSV. I'd like to use my own routine unless
it's not possible.
I have a data file called "testpost" which contains many values, each
separated by a comma. The end of each line of values contains a newline
"\n" character. I am attempting to read in a line of values, store them in
an array, and then pop them off and do something with them.
How can I read in only one line at a time and do something with the array of
values, and then have it read in another line of values and do something
with that line of comma-separated values, until all lines have been read in
and processed?
Here's what I have worked on so far.
#!/usr/bin/perl -w
open (INFILE, "testpost");
while ( $line = <INFILE> ) {
chomp $line;
@fields = split (/,/), $line;
# do something in here with the values stored in @fields
# then loop back up and grab another line of values and stick it in @array
}
close (INFILE);
The testpost file looks something like this:
Name,dan,Address,123 center Street,City,Tulsa,state,,zip,,
The line length is not known, so there may be two values on the line, or
there may be 50.
thanks in advance..
dan :)
------------------------------
Date: 21 Aug 1999 20:21:26 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Help reading comma-separated values from file
Message-Id: <7pn1o6$9tm@dfw-ixnews15.ix.netcom.com>
DC (church@NOSPAMspinn.net) wrote:
: Please don't direct me to Text::CSV. I'd like to use my own routine unless
: it's not possible.
See below
: How can I read in only one line at a time and do something with the array of
: values, and then have it read in another line of values and do something
: with that line of comma-separated values, until all lines have been read in
: and processed?
:
: Here's what I have worked on so far.
:
: #!/usr/bin/perl -w
:
: open (INFILE, "testpost");
*Always* test to see if an open was successful, even in example code!
: while ( $line = <INFILE> ) {
: chomp $line;
: @fields = split (/,/), $line;
: # do something in here with the values stored in @fields
: # then loop back up and grab another line of values and stick it in @array
: }
: close (INFILE);
:
: The testpost file looks something like this:
:
: Name,dan,Address,123 center Street,City,Tulsa,state,,zip,,
:
: The line length is not known, so there may be two values on the line, or
: there may be 50.
What you have will work *if and only if* none of your data fields contain
commas as literal characters. The whole reason we have modules like
Text::CSV is that real-life CSV files usually *do* allow commas as
literal characters in data fields, and accommodating them requires a fair
amount of easy-to-get-wrong code. *If* you have complete control of what
goes into your files, then by all means go with what you have. But if
you have to accept files generated by other people, you have everything
to lose and nothing to gain by trying to re-invent the wheel.
------------------------------
Date: Sat, 21 Aug 1999 15:15:49 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Help reading comma-separated values from file
Message-Id: <37BF2515.6A3939AB@cisco.com>
[ DC wrote:
> # do something in here with the values stored in @fields
> # then loop back up and grab another line of values and stick it in @array
I am guessing that you do not want to lose the split fields from the line you
read in earlier and processed, i.e you want that all lines be tucked in @array
after the file is read completely.
If I have guessed right then you need to use array or arrays. Below is
a general idea...
use Data::Dumper;
@array = () ;
open (INFILE, "testpost") || die ;
while ( $line = <INFILE> )
{
print $line;
chomp $line;
@fields = split (/,/, $line ) ;
# do something in here with the values stored in @fields
# then loop back up and grab another line of values and stick it in
@array
push ( @array, [ @fields ] ) ;
}
close (INFILE);
print Dumper \@array ; # to display the array or arrays..
------------------------------
Date: Sat, 21 Aug 1999 15:19:31 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Help reading comma-separated values from file
Message-Id: <37BF25F3.22DD4A5F@cisco.com>
[ DC wrote:
> @fields = split (/,/), $line;
Does this split work. Looks suspicious to me.
Should it not be @fields = split ( /,/, $line );
--
------------------------------
Date: Sat, 21 Aug 1999 16:53:31 GMT
From: holmberg@NoSpam.net
Subject: Re: How to distinguish strings 'A|\\|B|' from 'A|\|B|' ? - solved
Message-Id: <37bed73c.18709895@news.tiac.net>
Hi,
Contrary to what I thought, was happening, escape processing doesn't seem to
happen automatically when a line is read - so with some clever initial
substitutions (to translate backslash pairs, then the character pair '\|' to
strings that are not elsewhere in the dumps, I can do my parsing.
What had me fooled was that I had reduced stuff down to some test cases
based on some string definitions inside of Perl. But these definitions ended
up being treated differently than identical looking strings read from input.
Thanks,
Carl
Antispam address: In order to reply, change NoSpam to tiac.
------------------------------
Date: Sat, 21 Aug 1999 13:42:29 -0500
From: "k.c. hemelstrand" <kc@avsupport.com>
Subject: Looking for able Perl Programmer in Fargo, ND
Message-Id: <YpCv3.14529$ef.37410@news.corpcomm.net>
We are looking for perl programmer with system admin abilities.
We operate www.avsupport.com and www.fargocity.com.
If interested. please reply or call K.C. Hemelstrand at 701-271-9111
More info available at http://www.partslogistics.com/Employment.shtml
------------------------------
Date: Sat, 21 Aug 1999 13:25:26 -0500
From: "James Liu" <jyoyoliu@hotmail.com>
Subject: Newbie again
Message-Id: <Q7Cv3.153$e05.25798@news.corecomm.net>
Hash: SHA1
How do I get Perl to rid everything in a line before a certain
character? I need to take an HTML file and remove the header, and
dynamically generate a new one. I have about 100 HTML files (how do
I have to manage 100 HTML files w/o CGI & Perl? I don't know, but now
i'm in a bind).
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
iQA/AwUBN77vFBlrzTx6g1omEQKjygCg/Pyyyy0e0xmNtGaYJDtqHyEUdmQAoM6M
stsKoL6kqWfCM8ylUbdR1rqo
=Qlom
-----END PGP SIGNATURE-----
------------------------------
Date: Sat, 21 Aug 1999 14:10:51 -0500
From: Andrew Sterling Hanenkamp <hanenkamp@networksplus.net>
Subject: Re: Newbie again
Message-Id: <37BEF9BA.8FEE862A@networksplus.net>
Assuming your lineis in $_ this will take every character before the
character "c" and get rid of it.
s/^[^c]*//;
As for managing 100 HTML files without CGI and/or Perl, I'm not sure what
you mean by "manage," but you could use a Java Servlet too if you have a
web server that supports it or a plug-in is available to make your web
server support it.
James Liu wrote:
>
> Hash: SHA1
>
> How do I get Perl to rid everything in a line before a certain
> character? I need to take an HTML file and remove the header, and
> dynamically generate a new one. I have about 100 HTML files (how do
> I have to manage 100 HTML files w/o CGI & Perl? I don't know, but now
> i'm in a bind).
>
>
> Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
>
> iQA/AwUBN77vFBlrzTx6g1omEQKjygCg/Pyyyy0e0xmNtGaYJDtqHyEUdmQAoM6M
> stsKoL6kqWfCM8ylUbdR1rqo
> =Qlom
> -----END PGP SIGNATURE-----
------------------------------
Date: Sat, 21 Aug 1999 19:16:44 GMT
From: websites@erols.com (Irwin Feuerstein)
Subject: Newsgroup archive
Message-Id: <37befae9.66847325@news.erols.com>
In the spirit of helping oneself, is there an archive of messages for
this newsgroup somewhere?
------------------------------
Date: Sat, 21 Aug 1999 20:40:07 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Newsgroup archive
Message-Id: <slrn7ru2jv.7tu.*@dragons.duesouth.net>
Once upon a time (Sat, 21 Aug 1999 19:16:44 GMT), Irwin Feuerstein) was
attempting to figure out Ilya's new Perl regex features, and accidently
sent the following to comp.lang.perl.misc:
: In the spirit of helping oneself, is there an archive of messages for
: this newsgroup somewhere?
http://www.deja.com/=dnc/
--Matthew
------------------------------
Date: Sat, 21 Aug 1999 22:25:59 GMT
From: websites@erols.com (Irwin Feuerstein)
Subject: Re: Newsgroup archive
Message-Id: <37bf2718.78160438@news.erols.com>
I have no idea what this message means, but I am aware of deja.com and
that is not what I want. Many mailing lists, for instance, have a way
to get a whole month of posts in one file, or a year's worth. Can I
get comp.lang.perl.misc by the month-ful, or the year-ful?
Thanks.
On Sat, 21 Aug 1999 20:40:07 GMT, *@dragons.duesouth.net (Matthew
Bafford) wrote:
>Once upon a time (Sat, 21 Aug 1999 19:16:44 GMT), Irwin Feuerstein) was
>attempting to figure out Ilya's new Perl regex features, and accidently
>sent the following to comp.lang.perl.misc:
>: In the spirit of helping oneself, is there an archive of messages for
>: this newsgroup somewhere?
>
>http://www.deja.com/=dnc/
>
>--Matthew
------------------------------
Date: Sat, 21 Aug 1999 18:14:55 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Newsgroup archive
Message-Id: <1dwwfmp.sqir2l1m4q09sN@roxboro0-0056.dyn.interpath.net>
Irwin Feuerstein <websites@erols.com> wrote:
> In the spirit of helping oneself, is there an archive of messages for
> this newsgroup somewhere?
Excellent.
In the spirt of helping those who try to help themselves.
Deja.com is considered THE archive for usenet. It keeps most groups for
several years. But it's current interface frankly sucks.
Try <http://www.deja.com/=dnc/home_ps.shtml>
<http://www.exit109.com/~jeremy/news/deja.html> instead of their more
normal <http://www.deja.com>
You could also go to <http://www.newsreaders.com/groups/search_groups.html>
and search for a group -- it brings up a page which shows the matches,
clicking on a group name takes you to a page with both a link to deja.com
for that group and if one is available a link to the faq.
--
John Moreno
------------------------------
Date: Sat, 21 Aug 1999 17:24:08 -0400
From: Donovan Rebbechi <elflord@panix.com>
To: David Alan Black <dblack@email.njin.net>
Subject: Re: Packages and parent packages
Message-Id: <Pine.NEB.4.10.9908211720230.16039-100000@panix7.panix.com>
> In comp.lang.perl.misc you write:
>
> You seem to be redefining the idea of a parent class.
> Why can't you just use normal inheritance? Or are you
> really trying to work with sibling classes?
I don't want to inherit all the methods from the parent
class. Is there a way I can just inherit a select few ( ie make certain
methods in the parent class non inheritable ) ? Maybe I should make a
different class that's parent to both which includes the shared methods (
I guess this is what you call a sibling class ) ?
[ snipped: nice example of class inheritence ]
--
Donovan
------------------------------
Date: Sat, 21 Aug 1999 17:35:00 -0400
From: "Justin K. Hertog" <jkhertog@worldnet.att.net>
Subject: Perl and SSLeay
Message-Id: <7pn61c$8au$1@bgtnsc01.worldnet.att.net>
Hi all,
Does anyone have a script I can use to test SSLeay?
Also, I'm looking for some good documentation.
Thank You,
Justin.
------------------------------
Date: Sat, 21 Aug 1999 19:07:36 GMT
From: davehaasdeja@my-deja.com
Subject: Re: PERL EDITOR
Message-Id: <7pmtdj$vse$1@nnrp1.deja.com>
Visual SlickEdit is the only way to go.
It's a wee bit pricey, but EXTREMELY cool.
> Does anyone of you know an good and nice editor for writting perl
code?
>
> I´m getting tired of notepad
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 21 Aug 1999 19:04:16 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: Perl Threads: Discussion area?; Comment on www.perl.com
Message-Id: <QKCv3.8649$y03.1208@news.rdc1.ct.home.com>
Rob Cunningham <rkc@ll.mit.edu> wrote:
> I want to learn more about the upcoming 5.6 perl threads model.
The threading model's not likely to change for 5.6, and I think you'll
find that it'll survive for the next few releases at the very least. (I,
for one, would really like to move it out of experimental and into
beta/release, but it's going to take some more beating on before it's
ready for that)
> I have built a large, production-quality system on the current model (I
> know, that's not recommended, but I had my reasons) and what to
> understand what's coming so I can plan for it (and comment on it).
In that case, join the p5p list.
Dan
------------------------------
Date: Sat, 21 Aug 1999 21:22:51 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: processing html on the fly part 2
Message-Id: <Pine.HPP.3.95a.990821205935.933G-100000@hpplus03.cern.ch>
On Fri, 20 Aug 1999, Jeff wrote:
> Thank you for your response. You did enlighten my eyes to one fact in
> particular, once the perl script spits out the new HTML path the server is
> the vehicle that tells the browser where the base path of this page is.
I'm sorry, that was not what I said.
The base URL (in the absence of a <BASE...> tag in the HTML) to which
relative URLs in the HTML are resolved, is the URL of the page itself.
The fact that this is a CGI is, as far as the browser is concerned,
totally irrelevant.
Anyhow, Larry R has rightly rebuked me for the fact that there is
nothing specific to Perl in this discussion, so I'll try to keep this
brief and invite you to f'up on an appropriate group.
> However, is there a way to tell the server to pretend as though this
> document were served from "usr/www/" when in reality it might have been
> served from "usr/cgi".
I think if you actually tackled the issues in my reply, which you have
so comprehensively quoted in Jeopardy style, you would know that this is
the wrong question[1]. I repeat, the _browser_ resolves relative
references in the HTML document, and it does it by means of the base
URL, i.e normally the URL that the browser used for retrieving that
document.
> In this manner the browser will look at another
> directory, not the actual directory the page was served.
Then you must arrange for the script to write the references into the
HTML document as absolute URL paths, i.e beginning with "/", so that the
base URL has no consequence when the browser performs the resolution.
I must stress that for a confident and accurate understanding of this
issue you will benefit by keeping a clear distinction in your mind
between URL paths (the components of URLs, which you can consider to
form a sort of conceptual WWW hierarchy), and the internal directory
structure that a particular server uses.
Browsers work with URL paths, and when presented with a relative URL,
they must resolve it with reference to a base URL. They do not know,
and do not need to know, anything about the internal directory structure
of your server, which (via symlinks, ScriptAlias configuration, internal
redirects etc. etc.) might be very different from the external URL path
hierarchy.
If you insist on pretending that the browser is traversing the server's
file system hierarchy, then it may very well be that for much of the
time, it will appear to work. How much more surprising when it suddenly
doesn't, because this procedure is fundamentally unsound. _First_
resolve the reference in the URL hierarchy, _then_ map the resulting
absolute URL into the server's configuration to find out what resource
it represents. That works, by definition.
[1]The only way that the _server_ can change the URL of the page is to
issue a redirection. But then the browser will respond by making a
further retrieval, this time presenting the URL that it was given for
the redirected page, and the whole game starts again.
------------------------------
Date: 21 Aug 1999 19:21:00 GMT
From: sclunapark@aol.com (SCLunapark)
Subject: qx(), WinNT, and another Perl script
Message-Id: <19990821152100.26744.00001788@ng-cg1.aol.com>
I'm a bit puzzled by the use of qx() on Windows NT (and, unfortunately, I'm
stuck with NT in this instance) with ActiveState Perl, Build 518. To
troubleshoot a more complicated program, I distilled what I'd like to do to a
pair of Perl scripts. Pipe.pl is meant to launch display.pl (the arbitrarily
named, stripped-down test scripts I wrote), collect it's output, and send it to
the screen. Here's the code for the two programs (stored, of course, in
separate files):
pipe.pl:
print "Here we go...\n";
$output = qx(display.pl);
print "$output\n";
display.pl:
print "This is the output of display.pl\n";
What I get for output from the NT command line is:
C:\pipe.pl
Here we go...
C:\
No error, but no output either. When I run display.pl by itself, I do, as
expected, get the appropriate output line. Likewise, when I take display.pl out
of the qx() operator and replace it with something like ping 127.0.0.1, I do
get the expected output from the ping command. I've tried modifying the line to
read
$output = qx`display.pl`;
and
$output = `display.pl`;
and I get the same blank output each time. Now it's been my understanding that
the program being launched takes the argyuments on the qx() line (if any) and
uses them as if they were in its @ARGV, and then the first program pulls any of
the standard output of the second program into whatever variable has been set
on the qx() line (in this case, $output). This theory seems to be correct in
the case of ping, but not disply.pl. Am I missing something in the way I wrote
this, or are NT or ActiveState Perl simply broken in their ability to produce a
second instance of the perl interpreter, or what the heck is going on here?
thanks in advance,
Shaun
------------------------------
Date: Sat, 21 Aug 1999 08:26:25 -0700
From: "Kyung Suk (Dan) Oh" <ksoh@netzero.net>
Subject: Suggestion on the best cgi method based on Apache server?
Message-Id: <37bec52a$0$206@nntp1.ba.best.com>
Seems like there are many ways to do cgi based the
Apache server.
Can anyone recommend the best approach?
1. perl + Apache:asp
2. perl + Apache:mod_perl
3. perl + Fastcgi
4. c_or_c++ + Fastcgi
5. php3 + Apache
Welcome to include any new methods.
------------------------------
Date: 21 Aug 1999 16:09:46 -0600
From: Nuthinbutnews web interface user
Subject: Re: UDP help
Message-Id: <37bf159a@news.nuthinbutnews.com>
I'm not a perl developer just C++, but I believe you do need the bind(), but
before you can send() or recv() you need to connect() first.
Vic Pavlick
VP Custom Software
http://vpcs.hypermart.net
vicp@warwick.net
> Alright, I've been struggling with this all day and I just can't get it
> to work. What I'm trying to do is this: connect to a 'master server' that
> houses a list of IP addresses and ports of servers that are running games
> (in this case, Drakan). Split those apart, and then connect to each
> server and request information using UDP.
> I got the first part down. It's not perfect, but it works well enough
> for me to see that the second part doesn't. :)
> I'm not sure what it is I'm doing wrong, but any pointers would be much
> appreciated. Many thanks in advance...
> - Kyle Davis
> #!/usr/bin/perl -w
> use IO::Socket; # used for the fetching of the master list
> use Socket; # used for UDP -- don't know how using IO::Socket
> #######################################################################
> # download master list
> $cserver = -1;
> $remote = IO::Socket::INET->new( Proto => "tcp",
> PeerAddr => "master.mplayer.com",
> PeerPort => "http(80)", );
> print $remote "GET /drakan/servers.txt HTTP/1.0\015\012\015\012";
> while ($line = <$remote>)
> {
> if ($line =~ /text\/plain/i) # the server IPs start
> {
> $cserver = 0; # start recording IPs
> }
> elsif ($cserver != -1) # IP incoming
> {
> $allinfo[$cserver] = $line;
> $cserver++;
> }
> }
> close $remote;
> #######################################################################
> # set globals and print header information
> $numservs = (@allinfo - 2); # account for lame lines I'm
> # too lazy to filter out
> print "Content-type: text/html\n\n";
> print "Total number of servers: $numservs\n";
> print "<br>\n";
> print "Server information:\n<pre>@allinfo</pre>";
> #########################################################################
> ####
> # cycle through each server and get information
> $cserver = 0; # current server number
> $scal = ""; # theoretically, server's response
> while ($cserver < $numservs)
> {
> ($serverip, $portx, $porty) = split(/ /, $allinfo[$cserver+1], 3);
> print "<hr noshade width=\"100%\" size=3>\n";
> print "<strong>$serverip</strong> ($portx):<p>\n";
> $port = $portx; # port number
> $iaddr = inet_aton($serverip); # convert from ASCII
> # dotted to numeric
> $paddr = sockaddr_in(27046, $iaddr); # open local side
> #$proto = getprotobyname('udp'); # = needed?
> socket(SOCK, PF_INET, SOCK_DGRAM, IPPROTO_UDP);
> #bind(SOCK, $paddr); # = needed?
> #######################################################################
> # Allright, all this is what I'm fairly unsure of. The packet with
> # "\status\" might or might not actually be getting off, but I'm 99%
> # sure that there is something wrong with the recv() call (or something
> # wrong with opening the port above). At the moment, the script claims
> # to send the request and then just pauses for an indefinate amount of
> # time. Ideally, the server should respond with information about the
> # players, level, server configuration, etc.
> #
> # This is where I really need the help. I have the feeling it's some-
> # thing stupid I'm overlooking...
> send(SOCK, "\\status\\\r\n", 0, $paddr) || die "send: $!\n";
> print "Sent request <tt>\\status\\</tt>...<br>\n";
> print "Waiting for response...\n";
> ($senderip = recv(SOCK, $scal, 2, 0)) || die "recv: $!\n";
> print "\nReceived response: <tt>$scal</tt>...<br>\n";
> #######################################################################
> # And back to sensical code...
> closesocket(SOCK); # = close socket
> $cserver++; # and onward...
> }
>
Posted via the NuthinButNews Web Interface
http://www.nuthinbutnews.com
------------------------------
Date: Sat, 21 Aug 1999 14:36:42 -0400
From: "Overstreet" <PinnTech@Worldnet.att.net>
Subject: User session ID?
Message-Id: <7pmrls$9hn$1@bgtnsc01.worldnet.att.net>
I am in the process of porting a program written in VBScript (active server
page) to Perl5 (cgi). This program requires that a user "login" to view the
information from their database. VBScript has a variable named "Session"
which you can use to store information such as user name, password, or any
other variables that you wish. This tightens security because you do not
have to "pass" these values to the next web page in a way that the user
could view/modify them. Is there a Perl5 equiv of the VBScript "Session"
variable? I have tried to use the ENV variable, but it seems to lose the
entries I set when the next page tries to read it. Any ideas?
Ross Overstreet
vbdailytip@aol.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 610
*************************************