[13266] in Perl-Users-Digest
Perl-Users Digest, Issue: 676 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 30 02:07:14 1999
Date: Sun, 29 Aug 1999 23:05:10 -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 Sun, 29 Aug 1999 Volume: 9 Number: 676
Today's topics:
ANNOUNCE: XML::RSS 0.4 (Jonathan Eisenzopf)
Beginner's Question: testing array membership (Gregory Firth)
Re: Beginner's Question: testing array membership <mike@crusaders.no>
Binary to Text <hamish@spin.net.au>
Re: Binary to Text (Martien Verbruggen)
Re: Binary to Text <bwalton@rochester.rr.com>
Re: Binary to Text (Larry Rosler)
Re: Books , Reccomend? <makarand_kulkarni@my-deja.com>
calling another perl script <bchung@ci.south-el-monte.ca.us>
Re: help on debug: Odd number of elements in hash list (Martien Verbruggen)
Re: identifying an empty line <makkulka@cisco.com>
Re: identifying an empty line <makkulka@cisco.com>
Re: identifying an empty line (Larry Rosler)
Re: Obtaining Values from Mulitple Selects <makkulka@cisco.com>
Re: Parsing 'Content-Disposition' Header on the fly wit <bwalton@rochester.rr.com>
Perl CGI and server speed <jmaas@execpc.com>
Re: Perl CGI and server speed <meowing@banet.net>
Question about sendmail (OWF President)
Re: Question about sendmail ()
Re: Question about sendmail (OWF President)
Re: Question about sendmail (Abigail)
Re: Ready to get to work but... <revjack@radix.net>
Re: Ready to get to work but... <jeff@vpservices.com>
Re: Ready to get to work but... (Abigail)
Sockets and Threads <musicmaker@armt.yi.org>
Re: Use perl to find next UID... ("Bill Jones")
While Loop Problem <wyzelli@yahoo.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Aug 99 05:51:13 GMT
From: eisen@pobox.com (Jonathan Eisenzopf)
Subject: ANNOUNCE: XML::RSS 0.4
Message-Id: <37CA1BD1.4C4B1DE3@pobox.com>
DLSI=adpO
This release fixes an extraneous print statement that
I neglected to remove before I released 0.3. Please
upgrade to this version if you're using XML::RSS 0.3.
I also updated examples/rss2html.pl to use a few of
the optional elements added to RSS 0.91.
This is an alpha release because the API has not been
finalized. The module will be available at your local
CPAN archive. Alternatively, try this URL:
http://www.perlxml.com/modules/XML-RSS-0.4.tar.gz
This Perl module provides a basic framework for creating and
maintaining Rich Site Summary (RSS) files. RSS is primarily
used for distributing news headlines, commonly called
channels, and is used primarily on Netscape's Netcenter,
http://my.netscape.com, and Userland Software's
http://my.userland.com.
More information on RSS can be found at:
http://my.netscape.com/publish/help/mnn20/quickstart.html
Please send comments, problems, etc. to eisen@pobox.com.
Jonathan.
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
------------------------------
Date: 30 Aug 1999 00:07:13 -0500
From: gfirth@worldnet.att.net (Gregory Firth)
Subject: Beginner's Question: testing array membership
Message-Id: <37ca0f8a.45856888@news3.newscene.com>
Suppose I have an array: @array = qw(word1 word2 word3 word4 word5);
What is the simplest (or the most elegant) method for testing if a
variable is a member of @array? I could use a foreach and interate
though the list, but I suspect there is a simpler method such as
if ($array{"word1"}) { # this doesn't work of course
TIA.
------------------------------
Date: Mon, 30 Aug 1999 07:33:41 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Beginner's Question: testing array membership
Message-Id: <BHoy3.8$3%6.180@news1.online.no>
Gregory Firth <gfirth@worldnet.att.net> wrote in message
news:37ca0f8a.45856888@news3.newscene.com...
> Suppose I have an array: @array = qw(word1 word2 word3 word4 word5);
>
> What is the simplest (or the most elegant) method for testing if a
> variable is a member of @array? I could use a foreach and interate
> though the list, but I suspect there is a simpler method such as
>
> if ($array{"word1"}) { # this doesn't work of course
This would have worked if you had used a hash, but if you want to use an
array you should take a look at the grep function:
if (grep {$_ eq 'word1'} @array) {
do_your_stuff();
}
--
Trond Michelsen
------------------------------
Date: Mon, 30 Aug 1999 09:15:00 +1000
From: "hamish" <hamish@spin.net.au>
Subject: Binary to Text
Message-Id: <37c9bea1@nexus.comcen.com.au>
I am new to Perl and am trying to read a binary file and convert it to text.
The following code reads and writes OK but there is no conversion.
Can anyone help?
Here is my code so far.
unless (open( INFILE, "<HC0001~1" ))
{
if(-e "<$HC0001~1") {
die ("File exists but cannot open HC input file.\n");
} else
die ("File HC does not exist.\n")
}
}
open( OUTFILE, ">outfile" );
binmode( INFILE ); # crucial for binary files!
# By default the ( OUTFILE ) should be text - am I right?
while ( read( INFILE, $buffer, 1024 ) )
{
print OUTFILE $buffer;
}
close( INFILE );
close( OUTFILE );
Any comments would be appreciated.
Plus are there any good forums for a perl beginners (am experienced developer in other languages) so dont want an ABC introduction.
Thanks
Hamish
------------------------------
Date: Mon, 30 Aug 1999 02:18:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Binary to Text
Message-Id: <URly3.72$Zn5.7044@nsw.nnrp.telstra.net>
In article <37c9bea1@nexus.comcen.com.au>,
"hamish" <hamish@spin.net.au> writes:
> I am new to Perl and am trying to read a binary file and convert it to text.
> The following code reads and writes OK but there is no conversion.
I fail to see how the following code would do any concersion...
> unless (open( INFILE, "<HC0001~1" ))
^^^
> {
> if(-e "<$HC0001~1") {
^^^
Does your file really start with <? and is that $ correct? Is this
your actual code, or did you retype something?
> die ("File exists but cannot open HC input file.\n");
> } else
>
> die ("File HC does not exist.\n")
> }
> }
This whole thing would better be done with:
open(INFILE, 'HC0001~1') || die "Cannot open HC0001~1 for read:$!";
> open( OUTFILE, ">outfile" );
check for errors!
> binmode( INFILE ); # crucial for binary files!
also crucial for binary output.
> # By default the ( OUTFILE ) should be text - am I right?
Not at all.. How would it do that? What is the textual representation
of any binary file? Maybe you should first specify that. Often pack
and unpack can be used to make sense of binary data.
How do you think perl writes binary files? All binmode does is prevent
the EOF (on lame operating systems) from ending your input/output.
> while ( read( INFILE, $buffer, 1024 ) )
> {
> print OUTFILE $buffer;
Since the buffer contains your binary data, that's what gets written
out. except of course on bad OS's, where binmode is necessary.
> Plus are there any good forums for a perl beginners (am experienced
> developer in other languages) so dont want an ABC introduction.
www.perl.com is a good starting point. There are some links to books
there as well.
The documentation that comes with perl is good as well. Try using
perldoc
# perldoc perl
# perldoc perldoc
# perldoc perltoc
# perldoc -f binmode
# perldoc -q binmode
Martien
--
Martien Verbruggen |
Interactive Media Division | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Sun, 29 Aug 1999 22:53:23 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Binary to Text
Message-Id: <37C9F222.8F5E12BD@rochester.rr.com>
hamish wrote:
> I am new to Perl and am trying to read a binary file and convert it to text.
> The following code reads and writes OK but there is no conversion.
>
> Can anyone help?
>
> Here is my code so far.
>
> unless (open( INFILE, "<HC0001~1" ))
> {
> if(-e "<$HC0001~1") {
Note: on the line above, you are asking if the file with the name consisting of the character "<" followed by the contents of Perl
variable $HC0001 followed by "~1" exists. Assuming that variable $HC00001 has not been defined, that would be file "<~1". That is
probably not what you want.
>
> die ("File exists but cannot open HC input file.\n");
> } else
>
> die ("File HC does not exist.\n")
> }
> }
>
> open( OUTFILE, ">outfile" );
>
> binmode( INFILE ); # crucial for binary files!
The distinction between text and binary files only exists for braindead operating systems. You only need binmode if you are using one
of those (but it's OK on good OS's too -- it just doesn't do anything). And yes, Perl's default mode on braindead operating systems is
text.
>
> # By default the ( OUTFILE ) should be text - am I right?
>
> while ( read( INFILE, $buffer, 1024 ) )
> {
> print OUTFILE $buffer;
> }
> close( INFILE );
> close( OUTFILE );
>
...
Hamish, your task of "converting from binary to text" leaves a lot of room for interpretation. If the interpretation you want is
hexadecimal, try:
map {printf OUTFILE "%02x",ord($_)} split(//,$buffer);
in place of your
print OUTFILE $buffer;
statement. Add a
print OUTFILE "\n";
statement if you want each bufferful to come out on its own line.
--
Bob Walton
------------------------------
Date: Sun, 29 Aug 1999 19:52:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Binary to Text
Message-Id: <MPG.123391b68f0bd737989ecf@nntp.hpl.hp.com>
In article <URly3.72$Zn5.7044@nsw.nnrp.telstra.net> on Mon, 30 Aug 1999
02:18:28 GMT, Martien Verbruggen <mgjv@comdyn.com.au> says...
...
> ... All binmode does is prevent
> the EOF (on lame operating systems) from ending your input/output.
Well, it does an important bit more than that on lame operating systems.
On input, it prevents conversion of the two-character sequence "\r\n"
("\15\12") to the one-character string "\n"; on output, it prevents
conversion of "\n" to "\15\12".
And it should be used for binary files on all operating systems, lame or
not. That way lies source-code portability.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 30 Aug 1999 03:08:45 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Books , Reccomend?
Message-Id: <7qcsjn$t8m$1@nnrp1.deja.com>
[In article <37ca49f5.8347082@news.demon.co.uk>,
dave@dave.org.uk (Dave Cross) wrote:
> According to O'Reilly
> <http://www.oreilly.com/catalog/cgi2/noframes.html>, this has been put
> back to June 2000.
]
Thanks for pointing this out to me as I myself
was waiting for this book to hit the shelves.
I have read his earlier book and I would
definitely recommend getting hold of an earlier copy.
His lastest edition would have used CGI.pm in
the example code.
--
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 29 Aug 1999 20:13:59 -0700
From: b chung <bchung@ci.south-el-monte.ca.us>
Subject: calling another perl script
Message-Id: <37C9F6F6.47D781C9@ci.south-el-monte.ca.us>
Hi,
How do I call another perl script with parameter inside a perl script
and return the result or send the return to stdeout.
Not using require or use command.
Any ideas.
Thanks
Betty Chung
------------------------------
Date: Mon, 30 Aug 1999 04:08:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: help on debug: Odd number of elements in hash list at ././rt.pl line 56, <STDIN> chunk 1
Message-Id: <dtny3.112$Zn5.9576@nsw.nnrp.telstra.net>
{please put your response _after_ the text you quote. This is Usenet,
not Jeopardy}
In article <uC4y3.1226$p11.56399@news1.rdc2.on.home.com>,
"Winter" <tungyat@yahoo.com> writes:
[FIXED QUOTING]
> Joe Kline <jkline@one.net> wrote in message
> news:37C8C7BD.B2F72D05@one.net...
>> Consulting the ever bountiful 'perldoc perldiag' we find:
>>
>> "...You specified an odd number of elements to initialize a hash,
>> which is odd, because hashes come in key/value pairs."
>
> $sth = $dbh->query($qu);
> die "SQL Error: $Mysql::db_errstr" if (! defined $sth);
> for(;;) {
> my %fh2;
> last if ! ( %fh2 = $sth->FetchHash() );
And consulting the documentation for the module you use there? Is that
MySQL or so? Ok, for this time I will read it for you.
# perl -MCPAN -e shell
cpan> look Mysql
# pod2text mSQL/lib/Msql.pm | less
[snip]
%hash = $sth->fetchhash;
[snip]
Hmmm. You must be using another module. This one doesn't seem to have
a FetchHash method.
Maybe it's DBI?
# perldoc DBI
nope..
Well, I am stumped about which module you are using. Maybe you should
tell us? Does the FetchHash method of that module actually return a
hash? or does it return a reference?
Or did you misspell fetchhash?
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Sun, 29 Aug 1999 18:30:48 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: identifying an empty line
Message-Id: <37C9DEC8.97B050C8@cisco.com>
[ Jimtaylor5 wrote:
> Can anyone tell me how I could write code to identify an empty line (a line
> with no text on it).
The regexp that matches an empty line is // or /^$/
--
------------------------------
Date: Sun, 29 Aug 1999 19:08:30 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: identifying an empty line
Message-Id: <37C9E79E.1AB2BD3E@cisco.com>
[ Jimtaylor5 wrote:
> Can anyone tell me how I could write code to identify an empty line (a line
> with no text on it).
Use the regexp /^$/
if ( $line =~/^$/ ) {
# line is empty ..
}
--
------------------------------
Date: Sun, 29 Aug 1999 19:45:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: identifying an empty line
Message-Id: <MPG.1233902873f8dc2f989ece@nntp.hpl.hp.com>
In article <37C9E79E.1AB2BD3E@cisco.com> on Sun, 29 Aug 1999 19:08:30 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ Jimtaylor5 wrote:
>
> > Can anyone tell me how I could write code to identify an empty line (a line
> > with no text on it).
>
> Use the regexp /^$/
> if ( $line =~/^$/ ) {
> # line is empty ..
> }
Or don't use the regex.
unless (length $line) {
# line is empty
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 29 Aug 1999 18:57:34 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Obtaining Values from Mulitple Selects
Message-Id: <37C9E50E.7CBC5E8B@cisco.com>
[ pete@pcrev.com wrote:
> Hi, I have a form with a multiple select which is used to put data into
> a perl script. How do i get the values (I need both the text, and the
> value of each selected entry) and use them in my CGI script?
Assuming that you are using CGI.pm and a multiselect scrolling list..
you can get the list of values selected in your multiple select by calling
the param() function like this --
@selected_values = $query->param('list_name');
The text labels are not passed as values of CGI parameters. If you want
both the text (labels ) and the values you have to have values
such that they contain both the text labels and the actual values.
--
------------------------------
Date: Sun, 29 Aug 1999 23:15:35 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Parsing 'Content-Disposition' Header on the fly with LWP
Message-Id: <37C9F757.B1B9A4D5@rochester.rr.com>
Brian Reilly wrote:
> I'm looking for some suggestions on the best way to use LWP to grab the
> 'filename=whatever' value in an HTTP Response 'Content-Disposition' header
> and save the content as that filename.
>
> Basically I want to mimic the 'Save As' feature in Netscape, but save as
> the default filename and not prompt the user for one.
>
> Code snippet:
> -----
> $request2v2 = new HTTP::Request('POST', "$MY_URL/download.pl");
> $request2v2->header('Connection' => 'Keep-Alive');
> $request2v2->header('accept' => '*/*');
> $request2v2->content('action=Download+All');
>
> $ua2v2 = new LWP::UserAgent;
> $response2 = $ua2v2->request($request2v2,'/tmp/filename');
UNTESTED: How about omitting the second argument in the request method above,
which will return the content in $response2? Then later, after you have
retrieved the content-disposition and figured out your file name, print the
$response2->content out to the file you want.
>
> $response2->header('content-disposition');
> -------------
>
> i.e. for
> Content-Disposition: filename="foo.tar"
>
> I'd like to have my program save the content as /tmp/foo.tar instead of
> /tmp/filename.
>
> Is it possible to get the value of 'Content-Disposition', pause my HTTP
> requset while I get the filename value, and then save the content as that
> filename?
>
> Any help would be much appreciated.
>
> Thanks,
>
> Brian
> --
> Georgetown University
> <reillyb@gusun.georgetown.edu>
Bob Walton
------------------------------
Date: Sun, 29 Aug 1999 23:57:11 -0500
From: John Maas <jmaas@execpc.com>
Subject: Perl CGI and server speed
Message-Id: <7qd2vs$4g0@newsops.execpc.com>
Howdy Youall,
Something I am wondering about. If a web site is produced with a CGI
Perl program or programs, does it use up more server resources than
straight HTML. Is there, say, a speed issue for how long it takes a
server to output the code? And if there is, is it enough to be
important?
John
------------------------------
Date: 30 Aug 1999 01:58:55 -0400
From: meow <meowing@banet.net>
Subject: Re: Perl CGI and server speed
Message-Id: <87hflhn71c.fsf@banet.net>
John Maas <jmaas@execpc.com> wrote:
> Something I am wondering about. If a web site is produced with a CGI
> Perl program or programs, does it use up more server resources than
> straight HTML.
Yeah, way more. Unless you're using something like Apache with
mod_perl, you're starting up a new Perl interpreter every time someone
loads a new page. See http://perl.apache.org/ for the mod_perl stuff.
> Is there, say, a speed issue for how long it takes a
> server to output the code? And if there is, is it enough to be
> important?
That's impossible to answer well without knowing what application
you're running. For typical apps on typical servers, it's not a real
problem. Most substantal WWW sites use at least some CGI and they're
still running =)
------------------------------
Date: 30 Aug 1999 01:29:10 GMT
From: owf7@aol.comnospam (OWF President)
Subject: Question about sendmail
Message-Id: <19990829212910.08102.00001338@ng-ci1.aol.com>
Hello.
When you open up your mail program like...
open (mail, "$mailprog -t") or &error("blah");
what exactly does "-t" stand for? What does
it do?
Thanks.
Dan.
------------------------------
Date: 30 Aug 1999 02:00:45 GMT
From: sobrien@id.jefferson.co.us ()
Subject: Re: Question about sendmail
Message-Id: <7qcokd$ine$1@news-2.csn.net>
Dan: You are a brave soul posting a question like this to
the comp.lang.perl.misc newsgroup. If anyone bothers to
reply at all, you will be told that this is not a Perl issue,
it's in the manual, to read the Sendmail newsgroup, or some
other smart-ass answer that won't help you at all.
Anyway, at the risk of offending the amazingly unhelpful
folk that owns this newsgroup, I offer the following:
I use the sendmail program in my Perl scripts on RedHat
Linux 6, and when I entered: "man sendmail" from the command
line, it tells me that the -t option means to take the TO
parameter from the body of the following message rather than
from the sendmail command line.
I'm sure that in the same way that they reply to you with
unhelpful responses, the others on this group will send me
seventeen replies telling me just what they think about me,
and just why my response is stupid.
Burned Before,
Steve
OWF President (owf7@aol.comnospam) wrote:
: When you open up your mail program like...
: open (mail, "$mailprog -t") or &error("blah");
: what exactly does "-t" stand for? What does
: it do?
: Dan.
------------------------------
Date: 30 Aug 1999 02:20:57 GMT
From: owf7@aol.comnospam (OWF President)
Subject: Re: Question about sendmail
Message-Id: <19990829222057.08106.00001212@ng-ci1.aol.com>
>I'm sure that in the same way that they reply to you with
>unhelpful responses, the others on this group will send me
>seventeen replies telling me just what they think about me,
>and just why my response is stupid.
:)
I've been "flamed" before. In the end, life goes on.
But thanks for the answer. I appreciate it.
Dan.
------------------------------
Date: 30 Aug 1999 00:59:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Question about sendmail
Message-Id: <slrn7sk7jj.23d.abigail@alexandra.delanet.com>
OWF President (owf7@aol.comnospam) wrote on MMCXC September MCMXCIII in
<URL:news:19990829212910.08102.00001338@ng-ci1.aol.com>:
%%
%% When you open up your mail program like...
%%
%% open (mail, "$mailprog -t") or &error("blah");
%%
%% what exactly does "-t" stand for? What does
%% it do?
Well, that would depend on the value of `$mailprog', now, wouldn't it?
Of course, what ever value `$mailprog' has, it's not a Perl question.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 30 Aug 1999 01:23:46 GMT
From: revjack <revjack@radix.net>
Subject: Re: Ready to get to work but...
Message-Id: <7qcmf2$6aq$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Richard Conaway explains it all:
:In order to practice my coding I need to be able to test it over
:and over. does this need to be done on a web server (cgi enabled,
:of course) or can it be done on my machine off line?
You have the right idea. Turn your machine into a web server. You'll be
glad you did.
See http://www.binary.net/dturley/cgi_testing.html for help.
------------------------------
Date: 30 Aug 1999 01:13:30 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Ready to get to work but...
Message-Id: <37C9D9BF.ED602534@vpservices.com>
Richard Conaway wrote:
>
> In order to practice my coding I need to be able to test it over
> and over... does this need to be done on a web server (cgi enabled,
> of course) or can it be done on my machine off line?
That is like asking "does my bike need to have a soft seat, or can I
ride it in the road?" Soft seats are nice but not neccessary and you
can ride your bike in the road regardless of whether the seat is soft or
not.
You can test whether your script works just by having perl on your local
machine (I am assuming you are using perl to write your cgi since you
did ask in a perl newsgroup) and running it from the command prompt. If
you want to also see how the script looks in a browser, you will need a
cgi-enabled web server installed on your local machine. In neither of
these cases do you need to be online while testing. You can easily
install everything you need on almost any OS for free. See for example
www.perl.com and www.apache.org.
--
Jeff
------------------------------
Date: 30 Aug 1999 01:01:18 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Ready to get to work but...
Message-Id: <slrn7sk7mv.23d.abigail@alexandra.delanet.com>
Richard Conaway (endlyss@email.msn.com) wrote on MMCXC September MCMXCIII
in <URL:news:Oz31JBo8#GA.320@cpmsnbbsa03>:
^^ In order to practice my coding I need to be able to test it over
^^ and over. does this need to be done on a web server (cgi enabled,
^^ of course) or can it be done on my machine off line?
That of course depends on what you want to test.
^^ Where do I point my browser to get the end result?
Uhm, point towards the brightest star in the sky? I dunno.
What have browsers to do with testing Perl programs?
^^ I can write simple code itself but don't know how to view and
^^ test it in action.
man perlrun
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Mon, 30 Aug 1999 00:23:53 -0400
From: "Alex R.M. Turner" <musicmaker@armt.yi.org>
Subject: Sockets and Threads
Message-Id: <Pine.LNX.4.10.9908300015280.13050-100000@fantasy.armt.yi.org>
Hi,
I am trying to build a TCP based server in Perl. I have finaly got the
thing to use non-blocking sockets, but I need a way to control many
sockets simultaneously. I seem to have two solutions before me: use
threads, or find a way to make read() or recv() non-blocking (which they
are seemingly at the moment). I had no luck at the second, and the first
_seemed_ easy enough. So.. I put 'use Thread;' in my programme, and it
tells me I don't have the threads library. I went to perl.com and had a
look at the doccies for threads on there, and it suggests that the threads
package is part of the standard distro now. Well.. I am using RedHat 6.0,
and the perl.com website acutaly directs you to redhat.com for a download
RPM. So I'm not really sure whats wrong at this point. Do I have to
download a threaded version perl and compile it? or do I just need the
Threads package? Should it have been included with my distro?
Hope someone can help.
Alex Turner
_____________________________________________________________________________
.. "The impossible we can do, miracles however, will take a little longer" ..
............... musicmaker@aspects.net, musicmaker@psynet.net ...............
.... Alex Turner - Programmer/Analyst/Miracle Worker/Musician/Smart ass .....
------------------------------
Date: Sun, 29 Aug 1999 21:27:05 -0400
From: bill@fccj.org ("Bill Jones")
Subject: Re: Use perl to find next UID...
Message-Id: <199908300121.VAA15840@astro.fccj.cc.fl.us>
> Date: Sun, 29 Aug 1999 15:53:37 -0700
> From: mopoka <matthewNOwuSPAM@magnolia.net>
> Subject: Use perl to find next UID...
> Message-Id: <2750ac20.2ed82d11@usw-ex0108-059.remarq.com>
>
> I need a perl script that can search a UNIX passwd file and
> find the next uid above a set min uid.
>
I just posted code which does this about the 24th of August.
Look in www.dejanews.com for "Adding a User"...
In that post you'll find:
setpwent();
print "Looking for highest good UID in /etc/passwd;\n\nReading File ";
while (($account, $passwd, $uid, $gid, $quota, $comment,
$gcos, $home, $shell) = getpwent())
{
($uid < 30000 && $uid > $cUID) ? $cUID = $uid : print ".";
# <snipped some non-relevant code...>
# Increment the count...
$count++;
}
# So, then next valid UserID would be -
$cUID += 1;
(Unless your /etc/passwd file is screwed up... ;)
HTH,
-FCCJ Data Security Group-
___________________________________________________________________
FCCJ 501 W. State St. Jacksonville, FL 32202 1 (904) 632-3089
------------------------------
Date: Mon, 30 Aug 1999 13:48:32 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: While Loop Problem
Message-Id: <sCny3.3$v45.4705@vic.nntp.telstra.net>
Some short time ago I had a problem with 'skipping entire while loops'
whilst running certain scripts. I had several people give me some useful
suggestions, unfortunately none of which proved to be the cause of the
problem.
I have now however isolated the problem a little more...
The proble only occurs when I comment out the flock (lock and unlock) from
the file's open and close before and after the loop so I can test the script
on my local workstation (win98) rather than on the NT server where the
script normally resides.
As soon as I uncomment the flocks, the script again runs correctly...(except
not locally as flock is unsupported on win95/98).
Odd behaviour.. but I can at least get around it. :^)
And thanks to all those who provided helpful suggestions!
Wyzelli
------------------------------
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 676
*************************************