[8485] in Perl-Users-Digest
Perl-Users Digest, Issue: 2102 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 15 13:07:12 1998
Date: Sun, 15 Mar 98 10:00:27 -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 Sun, 15 Mar 1998 Volume: 8 Number: 2102
Today's topics:
Re: "Learning Perl" questions and frustrations (Mike Heins)
Re: "Learning Perl" questions and frustrations (David Oswald)
Re: "Learning Perl" questions and frustrations (Lanning)
Re: cookies? (steve spinboll)
Re: Deleting Current Line of File Read <ebohlman@netcom.com>
File::Copy <shankeyp@charlestoncounty.org>
Re: File::Find and -w (Kent E. Holsinger)
Re: File::Find and -w <jdf@pobox.com>
Re: Getting Remote File Size <c..bojswbo@89.usenet.us.com>
Re: How to use Perl for Win95? <ebohlman@netcom.com>
Re: Is there a "Newsgroup" for Newbies to Perl? <ebohlman@netcom.com>
Re: Is there a "Newsgroup" for Newbies to Perl? <gwynne@utkux.utk.edu>
Re: Is there a "Newsgroup" for Newbies to Perl? <chasecreek.systemhouse@usa.net>
Re: Is there a "Newsgroup" for Newbies to Perl? (I R A Aggie)
Re: Listing subdirectories... <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Listing subdirectories... <jdf@pobox.com>
Re: Open to a device (Win32) <stackhou@execpc.com>
Perl Win95 Sockets <ctrotto@trotto.com>
Re: Redirect to another url culrich@i2000.net
Re: Running perl scripts in the background (steve spinboll)
Shell.pm - Examples of Use? <chasecreek.systemhouse@usa.net>
Re: Why doesn't "tr/\x0D//d" work? (Bart Lateur)
Re: Writing Scripts (Craig Berry)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Mar 98 09:44:10 GMT
From: mikeh@minivend.com (Mike Heins)
Subject: Re: "Learning Perl" questions and frustrations
Message-Id: <350ba2ea.0@news.one.net>
Lanning <slanning@buphy.bu.edu> wrote:
> [some snippage and piggybacking on Les' message--hope you don't mind]
> : David Pinkerton wrote in message <34ee3454.50494916@news.csrlink.net>
> : >$name = <STDIN>;
> : >chomp ($name);
> : >
> : >and here is the error I receive:
> : >
> : >syntax error in file hello.sh at line 5, next 2 tokens "chomp ("
> : >Execution of hello.sh aborted due to compilation errors.
> : >
> : >*Luckily* I happened to read (somewhere else) that "chop" can be
> : >substitued for "chomp." So far this has worked but can anyone
> : >tell me why "chomp" will not work?
> A few people responded to this saying that he should get Perl5,
> but I have Perl 5.004 and encountered the same problem (used
> chomp and got a very similar error message). And, you know what?
> The same solution worked; i.e., I substituted chop for chomp
> and everything was hunky-dorey.
> Then, instead of running my script using the scriptname (say
> script.pl) and the shebang line--typing "script.pl" at the
> prompt--I tried typing "perl script.pl", and it magically
> worked even with chomp. I concluded that I'm just not familiar
> enough with Unix (I had the same problem with my shell scripts),
> and postulated that it has something to do with a difference
> in where Perl thinks the standard input has been directed (but
> why does chop handle it?) and where I think it's been directed
> (and I know it's something to do with that damned shebang line).
> I was just too intimidated about asking before, lest some
> guru (say, Tom) should tell me to RTFM when I've already RTFM.
> Any help would be appreciated as I have this problem in all
> my Unix scripts.
The problem has to do with multiple Perl copies out there. Try running
each of these commands:
which perl
type perl
whereis perl
I think you will find that the Perl that is called when you type "perl"
is different than the one you are calling on the #! line.
Go through each of the copies returned by 'whereis perl' and try
a 'perl -v' command. On my machine that is:
-----
bill:~/man% whereis perl
perl: /usr/bin/perl /usr/bin/perl5.00404 /usr/bin/perl5.003 /usr/bin/perl5.004 /usr/bin/perl5.00403 /usr/local/bin/perl /usr/man/man1/perl.1
This is perl, version 5.004_04 built for i586-linux
This is perl, version 5.004_04 built for i586-linux
This is perl, version 5.003 with EMBED
built under linux at Jun 29 1997 22:43:55
+ suidperl security patch
This is perl, version 5.004_04 built for i586-linux
This is perl, version 5.004_03 built for i586-linux
-----
Obviously I no longer have a Perl 4 on my system. Most are the same binary
under different names.
I am guessing you have a V4 Perl on your system, and it will not like chomp.
You can see which version you are running in a script by putting near the
top:
warn "Perl version running is $]\n";
Good luck.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
Just because something is 131 Willow Lane, Floor 2 | || _ \
obviously happening doesn't Oxford, OH 45056 | || |_) |
mean something obvious is <mikeh@minivend.com> |___| _ <
happening. --Larry Wall 513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: Sun, 15 Mar 1998 09:46:28 GMT
From: doswald@xmission.com (David Oswald)
Subject: Re: "Learning Perl" questions and frustrations
Message-Id: <350ba2a2.94115315@news.xmission.com>
On 15 Mar 1998 03:55:19 GMT, slanning@buphy.bu.edu (Lanning) wrote:
>[some snippage and piggybacking on Les' message--hope you don't mind]
>
<snip>
> Then, instead of running my script using the scriptname (say
>script.pl) and the shebang line--typing "script.pl" at the
>prompt--I tried typing "perl script.pl", and it magically
>worked.....
<snip>
If it is running differently with the command, "perl <scriptname>"
than it does when you simply invoke <scriptname> with a shebang line,
I would be willing to bet that the shebang line is directing your
script to execute with an older version of Perl. In other words,
"perl <scriptname>" may be executing /usr/bin/perl5/perl, while the
shebang line may be invoking /usr/bin/perl which may be an older
version on your particular server. ...just a thought.
Dave
------------------------------
Date: 15 Mar 1998 17:42:24 GMT
From: slanning@buphy.bu.edu (Lanning)
Subject: Re: "Learning Perl" questions and frustrations
Message-Id: <6eh3u0$nmh$1@news1.bu.edu>
Mike Heins (mikeh@minivend.com) wrote:
: I think you will find that the Perl that is called when you
: type "perl" is different than the one you are calling on
: the #! line.
You're right. Thanks to you and the couple of people who
replied by email. I learned some things. -- Lanning
------------------------------
Date: Sun, 15 Mar 1998 17:24:18 GMT
From: spinboll@hotmail.com (steve spinboll)
Subject: Re: cookies?
Message-Id: <350f0e8d.5883138@news.cent.com>
Using perl (so it can be calssed as a perl question) deliver your form
through a perl script substituting the cookie values for the form
values.
On Thu, 12 Mar 1998 11:00:42 -0700, "Keith L. Miller"
<miller@bigsky.net> wrote:
>Can anyone tell me how to use cookie's to bring information into my
>forms? I have seen some things on this, but really would like more
>details.
>
>Thanks,
>
>Miller
>
------------------------------
Date: Sun, 15 Mar 1998 12:35:58 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Deleting Current Line of File Read
Message-Id: <ebohlmanEpv1ny.Hzx@netcom.com>
Eric Phillips <e.phillips@mindspring.com> wrote:
: Hello. I am pretty new to Perl, and have a problem that I need some
: explaining. I have a script that is working great so far until I have to
: write a new line to the file that I just read the old line from. I need to
: delete the current line of text that I just read from, and replace it with
: the new one. How do I do that? Please let me know. Thanks!
perldoc perlfaq5
------------------------------
Date: Sun, 15 Mar 1998 10:50:00 -0500
From: Peter Shankey <shankeyp@charlestoncounty.org>
Subject: File::Copy
Message-Id: <350BF8A8.5AF3@charlestoncounty.org>
Is there a bug with the File::Copy module?? I am using 5.003 with EMBED
built under solaris + suidperl security patch. The module copys the
text files I need copied, but returns a error saying: "Use of
uninitialized value at /opt/GNUperl5/lib/File/Copy.pm line 106"
Where can I find good bug report info I have looked through the system's
bug reports and some web stuff, but what a nightmare.
--
thanks
Pete ;)
shankeyp@charlestoncounty.org
(803) 723-6785
------------------------------
Date: 15 Mar 1998 10:32:53 -0500
From: kent@darwin.eeb.uconn.edu (Kent E. Holsinger)
Subject: Re: File::Find and -w
Message-Id: <87wwdw55qy.fsf@darwin.eeb.uconn.edu>
>>>>> "Martin" == Martin Vorlaender <martin@RADIOGAGA.HARZ.DE> writes:
Martin> Doc not read error:
Martin> File::Find assumes that you don't alter the $_ variable.
Martin> If you do then make sure you return it to its original
Martin> value before exiting your function.
Martin> Re-write the while(<FILE>) loop in mygrep().
Sorry for being dense, but I'm not sure if I understand this comment
correctly. (I did read the docs, but it appears that I did not fully
understand them. That's why I asked the question.) Here's mygrep()
again for reference:
sub mygrep {
my ($pattern, $name) = @_;
open (FILE, "<$name") or die "Could not open $name for input: $!";
while ( <FILE> ) {
print "$name:$_" if /$pattern/oi;
}
close (FILE);
}
Am I correct in inferring that the problem is that the while (<FILE>)
loop resets $_? Rewriting mygrep() as follows eliminates the warning,
but I want to make sure that I understand why.
sub mygrep {
my $store = $_;
my ($pattern, $name) = @_;
open (FILE, "<$name") or die "Could not open $name for input: $!";
while ( <FILE> ) {
print "$name:$_" if /$pattern/oi;
}
close (FILE);
$_ = $store;
}
I'd also appreciate comments on whether there's a way to avoid
resetting $_ completely. Thanks.
Kent
--
Kent E. Holsinger Kent@Darwin.EEB.UConn.Edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-43
-- Storrs, CT 06269-3043
------------------------------
Date: 15 Mar 1998 12:26:23 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: File::Find and -w
Message-Id: <7m5vdfwg.fsf@news.concentric.net>
kent@darwin.eeb.uconn.edu (Kent E. Holsinger) writes:
> Am I correct in inferring that the problem is that the while (<FILE>)
> loop resets $_?
Yes. The construction
while (<FOO>)
is exactly equivalent to
while (defined ($_ = <FOO>))
so you are indeed scribbling on $_.
> sub mygrep {
> my $store = $_;
[snip]
> $_ = $store;
> }
Too much typing! Not good!
sub mygrep {
local $_; #save $_
# do stuff to $_
} #when you exit this block, $_ is restored
Please see "local" in perlfunc, and read perlsub all the way through.
Perlsub goes into detail about the uses of local() and my().
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 15 Mar 1998 11:10:34 GMT
From: Anirvan Chatterjee <c..bojswbo@89.usenet.us.com>
Subject: Re: Getting Remote File Size
Message-Id: <6egcva$kl5$1@samba.rahul.net>
Jesse Rosenberger <jesse@savalas.com> wrote:
> Well, I have spent the last couple hours searching around perl.com...but
> have failed to figure out how to get perl to open a REMOTE url, and find
> the size it in bytes, then I want to have the size printed out to the
> users browser? does anyone have any ideas besides perl.com...or if
> that's all they have...exactly what section of perl.com should I be
> looking in, although I have looked through most of it already.
Make sure LWP (libwww-perl) is installed (if not, grab it from
CPAN). Then you can do stuff like this:
use LWP::Simple;
@results = head('http://www.yahoo.com/');
if (scalar @results) {
print "Content length is $results[1] bytes\n";
} else {
print "Retrieval failed\n";
}
which should yield
Content length is 2568 bytes
Scan the documentation that comes with LWP for more info. HTH.
_____________________________________________________________________
Anirvan Chatterjee . anirvan @ chatterjee.net . PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/
------------------------------
Date: Sun, 15 Mar 1998 12:05:06 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How to use Perl for Win95?
Message-Id: <ebohlmanEpv08I.9y0@netcom.com>
Duncan Cameron <dcameron@nospam.bcs.org.uk> wrote:
: Open an MS-DOS prompt (Start button|Programs|MS_DOS) then
: cd (whatever directory you created your script in)
: perl -w myscript.pl
Depending on the way Win95 was installed, the "MS-DOS" item in the start
menu may actually put the machine in MS-DOS compatibility mode, in which
case you'll get a "program requires Windows" error message when you try to
run perl. If that's the case, you need to go back into Windows, use
Explorer or something similar to go into the "Start menu" directory, make
a copy of the "MS-DOS" shortcut, rename the copy to "DOS prompt" or
something else recognizable, and then go into its properties and uncheck
the "MS-DOS mode" item.
------------------------------
Date: Sun, 15 Mar 1998 11:57:19 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <ebohlmanEpuzvJ.6BM@netcom.com>
mchunziker@us.fortis.com wrote:
: I have to disagree, I'm quite new to perl but am picking it up at a pretty
: good pace. Once I have a better understanding I won't mind sharing my
: knowledge with people who are new and struggling. I've never seen such an
: elitist bunch as the folks who populate this newsgroup. I'm not trying to be
: insulting but I've run into things that I could not find in the FAQ or the
: books and perhaps they really were there, but if I can't find the answer,
: what good do these resources do for me? Many times these resources answer the
: questions but not always. Newsgroups are for everybody, this isn't an
: exclusive country club, I'd rather see the experts guide new users with some
: advice and examples than say "read the docs jackass". If you don't have
: something constructive to offer, why even reply?
Are we reading the same newsgroup? Whenever I've seen someone state that
they've tried to find something in the FAQ and can't, the responses have
always been quite courteous. In fact, they frequently contain statements
along the lines of "thank you for doing your research first." Now it's
true that in many cases the response will not be a direct answer to the
question, but rather a pointer to the appropriate section of the FAQ or
documentation. But that's hardly rude or elitist. It's helping the
asker do what he was trying to do, namely look up the information. In
many cases the information in the documentation is of better quality than
what the responder could come up with off the top of his head.
Most of the posts that I've seen get flamed have at least one of the
following characteristics:
1) They ask a question that's almost word-for-word identical with one
that's in the FAQ (meaning that if they'd done a simple text search on
the FAQ, it would have popped right out at them).
2) They ask a general CGI or HTML question that has nothing specifically
to do with Perl.
3) The author confesses that he knows nothing about the language, but has
this script that he inherited from someone else, and wants to know "what
do I type to make it do what I want?"
4) The author asks for a personal e-mail response because "I don't read
this group" and has a spamblocked address in his From: line.
5) The author has posted several copies of the question in rapid
succession, often phrased slightly differently, suggesting that he thinks
he's in a chat room and is expecting an immediate response.
Finally, there's one type of post that gets flamed where it's clear that
the author *has* read the documentation:
6) The author quotes the description of localtime() and asks why it isn't
Y2K compliant.
------------------------------
Date: Sun, 15 Mar 1998 10:11:59 -0500
From: "Bob Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6egr59$6t2$1@gaia.ns.utk.edu>
There are obvious and important problems to solve here; however, the wizards
are not addressing them. Instead they have turned to complaining. The
principal problem is that Perl newbies questions often irritate the
wizards. Solving the problem by establishing a newsgroup for newbies has
been rejected. The only other solution, asking newbies to read the OReilly
books and the Perl FAQ, has not worked and will not work. One problem is
that Perl wizards ARE NOT information or communications scientists. They
might be wiz-bang programmers, but they dont know much about how people
process information. Lets look at the obvious.
1. As Perl becomes more popular there will be more and more people who are
new to the language and need help.
2. Because they arent familiar with the language, chances are they will
logon to the newsgroup and venture to ask a question that has been asked
many a time and oft. But they wont know that because they havent kept up
with the postings.
3. They will get no answer at all, will get an arrogant answer, orif they
ve posed the question to the satisfaction of the wizards, get an appropriate
answer. However, its probable that they wont know how to pose the question
because they dont know the rules, e.g., Newbie needs help matching words.
The obvious answer to their questions is to take the time to read the books
and the FAQ and then ask the questions after all other avenues have been
exhausted. In some ways thats the best answer; however, it wont work. As
a result, I propose that the wizards create a FAQ that is not as difficult
to navigate as the current FAQ and that is much more comprehensive. It would
be a trivial task for the wizards to create a searchable FAQ along the lines
of the MS Office 97 Help Wizard. It doesnt have to have the cutesy
animated graphic, but it should be as easy or easier to use. One should be
able to ask questions such as How do I fetch data from Excel? and get an
answer from the FAQ database. Frequently Asked Questions or FAQ is the
wrong term here. Instead, it should be Possibly Asked Questions. A group
of wizards should monitor the questions, and questions that cannot be
answered should be addressed and placed in a database and answered. If the
answers are in the books, the questioner should be referred to the exact
book and the exact page. The PAQ should be available on the Web for
everyone to use. In addition, each new poster to the newsgroup should
automatically be sent a message explaining the rules of the newsgroup.
Certainly, all of the wizards would consider these trivial tasks.
Lets think about solving communications problems and stop all of the
bitching.
Bob Gwynne
School of Communications
University of Tennessee
Gwynne@utkux.utk..edu
http://funnelweb.utcc.utk.edu/~gwynne
------------------------------
Date: Sun, 15 Mar 1998 16:05:34 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <350BFAFF.E8351C08@usa.net>
OK :) I believe we are back to the cookbook venue (I could
have sworn this was suggested before.)
I agree with what you are saying and would like to help -
When would you like to get started?
/^Seriously$/;
Sneex :)
Bob Gwynne wrote:
> There are obvious and important problems to solve here; however, the wizards
> are not addressing them. ...
> Instead, it should be Possibly Asked Questions. A group of wizards should
> monitor the questions, and questions that cannot be answered should be
> addressed and placed in a database and answered. Certainly, all of the
> wizards would consider these trivial tasks.
> Lets think about solving communications problems and stop all of the
> bitching.
>
> Bob Gwynne
> School of Communications
> University of Tennessee
> Gwynne@utkux.utk..edu
> http://funnelweb.utcc.utk.edu/~gwynne
------------------------------
Date: Sun, 15 Mar 1998 12:30:19 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <fl_aggie-1503981230190001@aggie.coaps.fsu.edu>
In article <350BFAFF.E8351C08@usa.net>, sneaker@earthling.net wrote:
+ OK :) I believe we are back to the cookbook venue (I could
+ have sworn this was suggested before.)
And if the newbies won't read the damn FAQ, what makes you think they'll
read this cookbook of yours?
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>
------------------------------
Date: 15 Mar 1998 17:54:15 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
To: tjbtech@rtweb.net
Subject: Re: Listing subdirectories...
Message-Id: <7xbtv76gjs.fsf@haze.vcpc.univie.ac.at>
Re: Listing subdirectories..., Randall <tjbtech@rtweb.net>
said:
Randall> I am trying to create an array that contains all of
Randall> the subdirectories of a given directory. Here is
Randall> how I have tried so far:
Randall> opendir (DIR, "$basedir/$dir."); @dirlist =
Randall> grep(/./,readdir(DIR)); close(DIR);
/./ == match all directory entries with (at least) one
character in them, i.e. all of them.
Randall> foreach $item (sort(@dirlist)) { if ($item =~ /\./)
Randall> { } else { push (@dirs, $item); } }
This will also list all the other files within the directory
too, which isn't what you want.
Your foreach needs to do a stat call on each directory entry
and only push if "-d".
Alternatively you might want to look at the File::Find module.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"
------------------------------
Date: 15 Mar 1998 12:13:43 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Listing subdirectories...
Message-Id: <90qbdghk.fsf@news.concentric.net>
Randall Stephenson <tjbtech@rtweb.net> writes:
Randall with two Ls? That's going to cause some confusion 'round
here. Mind if we call you Randal?
> opendir (DIR, "$basedir/$dir.");
^
What's that dot doing there? You should also check the success of the
opendir operator.
> @dirlist = grep(/./,readdir(DIR));
You are filtering out those filenames which don't have any characters
at all. That would be none, on most filesystems. Remember that the
dot in a regex does not match a literal dot.
> close(DIR);
You should check the success of the closedir operator.
> if ($item =~ /\./)
> {
> }
> else
> {
> push (@dirs, $item);
> }
A more perlish way to write this particular chunk of code is
push @dirs, $item unless $item =~ /\./;
However, if you don't want files with a dot in the name, the place to
say so would be in your grep, above.
The following code fills an array with the names of all of the
directories in the current directory. It also filters out the current
and parent directory listings. Have you read _Learning Perl_ yet? I
think that one reading of that vaunted book would give you a much
better idea of how Perl looks and feels.
#!/usr/bin/perl -w
opendir HERE, '.' or die "$!";
my @dirs = grep {-d and not /^\.\.?$/} readdir HERE;
closedir HERE or die "$!";
print join("\n", @dirs), "\n";
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Sun, 15 Mar 1998 10:06:32 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Open to a device (Win32)
Message-Id: <6egui3$rdq@newsops.execpc.com>
<HTML>
John,
<P>I found this in the FAQ's this a.m. while I was looking for some other
stuff but did copy it into my Perl notes for future reference:
<P> open( PORT, "+>COM1" ) or die "Can't open COM1: $!";
<P>--
<BR>Mark Stackhouse
<P>***********************************************************************
<P>homepage: <A HREF="http://www.execpc.com/~stackhou">http://www.execpc.com/~stackhou</A>
<P>"The best things in life aren't things."
<BR>--Art Buchwald
<P>***********************************************************************
<P>John Adamson wrote:
<BLOCKQUOTE TYPE=CITE>In running scripts on either an NT or 95 box, all
my experience in using
<BR>the open() function has been in connection with files, not devices.
I'm
<BR>now interested in output to a com port, but can't find anything in
any
<BR>of my perl reference books explaining the appropriate syntax.
(Or at
<BR>least I don't recognize it as such! :-))
<P>Can anyone tell me what the correct syntax would be for, say,
<BR>open(OUTPUT,">COM2:") (which, obviously, doesn't work).
<P>Your indulgence with this trifling question will be appreciated!
TIA
<BR>--
<BR>John Adamson
<BR>TX Ag. Extension Svc/Texas A&M Univ System
<BR>j-adamson@tamu.edu</BLOCKQUOTE>
<BR>
<BR> </HTML>
------------------------------
Date: Sun, 15 Mar 1998 10:51:35 -0600
From: "carl m. trotto jr." <ctrotto@trotto.com>
Subject: Perl Win95 Sockets
Message-Id: <350C0716.939BB1D7@trotto.com>
use Socket;
select(S); $| = 1; select(STDOUT);
$port = 27910;
($name,$aliases,$proto) = getprotobyname('udp');
$thisaddr = pack("C4", split(/\./, "207.229.151.54"));
$thataddr = pack("C4", split(/\./, "208.155.203.2"));
if (socket(S, AF_INET, SOCK_DGRAM, $proto)) {
print "socket ok\n";
}
else {
die $!;
}
socket(Socket_Handle, PF_INET, SOCK_DGRAM, $proto);
$that = sockaddr_in($port, $thataddr);
send(S, "\x7F\x7F\x7F\x7Fstatus\n\x0\x0\x0\x0\x0\x0\x0\x0\x0", 0,
$that);
while(1){
print S;
}
read(S, $buf, 1024, 0);
The above is the code I'm attempting to run put I never read anything.
I know I'm sending something out but I don't if the sent data is
correct. I assume the data is correct. The "while" loop is a
desperation attempt. I use the flush so the "print" would work. I know
the site is alive because I use another program to query it. Any
thoughts.
Win 95
Perl version 5.004_02 [Gurusamy Sarathy]
Regards,
Carl
------------------------------
Date: Sun, 15 Mar 1998 05:51:00 -0600
From: culrich@i2000.net
Subject: Re: Redirect to another url
Message-Id: <6egf7r$jl$1@nnrp1.dejanews.com>
What is the redirect() method?
In article <7xafatqtqh.fsf@beavis.vcpc.univie.ac.at>,
Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
>
> Re: Redirect to another url, wongkl <wongkl@singnet.com.sg>
> said:
>
> wongkl> To:comp.lang.perl.misc I learning how to use Perl
> wongkl> redirect cgi can anyone help me , how to use Perl
> wongkl> redirect script that can redir you to another url
> wongkl> like
> wongkl> http://www.Domain.com/cgi-bin/redir.cgi?Link=Page_html
>
> use CGI;
>
> and then the redirect() method.
>
> --
> Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax -
13
> Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
>
> "Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the
Hedge"
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Sun, 15 Mar 1998 17:26:03 GMT
From: spinboll@hotmail.com (steve spinboll)
Subject: Re: Running perl scripts in the background
Message-Id: <35100eff.5996846@news.cent.com>
use a cron a timer activated script of sorts
On Thu, 12 Mar 1998 18:13:33 GMT, prw@god.I.hate.spam.vanitydomain.net
(Paul Wilson) wrote:
>This may sound like a stupid question, but how do I get a perl script
>to run itself in the background on a UNIX (BSD) system? I've tried all
>kinds of fork stuff but the script just hangs on and never dumps me
>back to the UNIX prompt unless I hit ^Z bg.
>
>Paul.
>prw at vanitydomain dot net
>(yes, this is my real address)
------------------------------
Date: Sun, 15 Mar 1998 14:32:31 GMT
From: Sneex <chasecreek.systemhouse@usa.net>
Subject: Shell.pm - Examples of Use?
Message-Id: <350BE530.3D3720EE@usa.net>
I know this has been covered before but I can't find it.
(Yes, I searched the man pages, the Perl Modules area
on my filesys, and DejaNews; but unfortunately,
as a recent a poster has painfully pointed out to me -
DejaNews SUX!) But I was able to find reference to
replacing the 'ls' command; I would like to replace
the 'find /dir/path -name somefile -exec ls -l {} \;';
command :)
I would like info &/ reference, et al, on how to use or
guess the usage of Shell.pm (and assoc Unix cmds.) :)
Here is some code to get the brain juices flowing:
#!/usr/local/bin/perl -w
use CGI qw(:all);
use Shell; # /drv2/usr/local/lib/perl5/Shell.pm
use strict;
my $basedir = '/drv2/usr/ns-home/docs';
$_ = query_string() if query_string();
my $wFile =~ /=/;
my $wFile = $';
print header;
print "<P>What you are looking for ";
print $wFile;
print "<P> <P>What I found: ";
find ($basedir, ' -name ', $wFile, ' -print');
exit;
# Yes, it's a CGI...
It was a program I was looking at to help another
poster (regarding image size) here, but I misunderstood
his original question - nonetheless, I ran into this
problem and was wondering what I
mis[sed|understood]?
/^Thx in advanced$/;
Sneex :)
------------------------------
Date: Sun, 15 Mar 1998 15:51:23 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Why doesn't "tr/\x0D//d" work?
Message-Id: <350bf3e7.101501@news.tornado.be>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>: A text file is a file you can create using a text editor by simply
>:typing.
>
>You can make up any definition you want. That doesn't make it reasonable.
>Using a "text editor", I can trivially create a file with nothing but four
>^A characters in it by simply editing. That's not a text file.
Either your text editor needs some serious revision, or you have to
accept this as a text file, if a user willingly and knowingly uses a
text editor to create/edit such a file.
>Please don't resort to sophistry.
OK, so let's drop the editor argument.
>Text files consist of variable-length, newline-terminated records
>containing printable text. Those are the rules, and they're entirely
>intuitive.
I strongly suspect that you're imposing arbitrary limitations to what a
user can or cannot put in a text file, because it would make life easier
for you as a programmer. You prefer chop() over chomp(), huh? You might
just as well claim that lines in a text file may not be longer than,
say, 255 bytes, just because that happens to be the buffer length for a
program processing the files.
Here are my rules, just as intuitive: A text file is a file that
contains only text, i.e. text characters and control characters.
This means that a text file can contain about any byte. But it is not
what bytes a file contains that matters, but the MEANING of the bytes. A
file generated by a script like
print "Hello, world!";
is a text file, because the contents are purely and solely text. In
contrast, a file generated by
print pack("C",length),$_;
is a binary file, even if the string length is in the range 32-126,
because the first byte is a count byte, and not a character.
Note that I claim that a text files must contain text, not text LINES.
If a user is willing to type in a bunch of words into a text file
without EVER hitting return, it would still be a text file.
After all, what are newlines for? It is an indication that what follows,
starts on a new line. Nothing more, nothing less. If NOTHING follows, it
doesn't matter whether the final newline was there or not.
Bart.
------------------------------
Date: 15 Mar 1998 06:31:04 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Writing Scripts
Message-Id: <6efsj8$792$1@marina.cinenet.net>
Steve Peters (michboy@caspers.net) wrote:
: Okay, I got Perl 5 installed, and I installed cgi.pm on my computer.
If you installed the latest version of Perl, part one above implies part
two.
: Now what?
Why, transcendent bliss, of course!
: I have a script all written out, but I don't know how to save it as
: a .cgi or .pl file....
If you've saved it, you've saved it as (potentially) a CGI app. The only
remaining issue is putting it where the web server can find/run it.
: If anyone could give me any information whatsoever,
: tips, hints, clues, or just plain out telling me how to do it, I would be
: grateful.
How to do it in detail depends on your server setup. See the CGI
and web server newsgroups for more on this.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 2102
**************************************