[9413] in Perl-Users-Digest
Perl-Users Digest, Issue: 3006 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 13:57:24 1998
Date: Tue, 30 Jun 98 10:38:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 30 Jun 1998 Volume: 8 Number: 3006
Today's topics:
! Free For All Links Page --HELP! <josh@wolrich.com>
Re: ! Free For All Links Page --HELP! <quednauf@nortel.co.uk>
Re: ! Free For All Links Page --HELP! <jdf@pobox.com>
Re: ! Free For All Links Page --HELP! <colin@wolrich.com>
"Invalid Switch" Message - Win32/DOS/Win95 <fvbrock@mycitypages.com>
Re: "Invalid Switch" Message - Win32/DOS/Win95 <fvbrock@mycitypages.com>
$CHILD_ERROR problems when called by cron ktyle@my-dejanews.com
Re: $CHILD_ERROR problems when called by cron <martin98@mail.SPAMlig.BANEbellsouth.net>
3 new modules (Ken Williams)
Re: [NT]: Getting Perl CGI to work (williams)
Re: [NT]: Getting Perl CGI to work (Bob Trieger)
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: [Q] split ///, $variable <ryan@steelplan.com.au>
Re: [Q] split ///, $variable (M.J.T. Guy)
Re: `fork' in Perl debugger under emacs <rra@stanford.edu>
Re: `fork' in Perl debugger under emacs (Ilya Zakharevich)
Re: A funny problem with "use integer" (Josh Kortbein)
Re: A new Perl keyword: MSPH [Was: What a Crappy World (brian moore)
Re: A new Perl keyword: MSPH [Was: What a Crappy World <ljz@asfast.com>
Re: About usage of recursive algoritm in Perl. abraham@mpi.com
Advice on loading modules as needed. <shawnf@exabyte.com>
Alternative solution ? <a.g.macinnes@rl.ac.uk>
Re: Alternative solution ? (Matt Knecht)
Re: Alternative solution ? (Larry Rosler)
Re: Alternative solution ? (Tad McClellan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 29 Jun 1998 09:21:21 GMT
From: Joshua Wolrich <josh@wolrich.com>
Subject: ! Free For All Links Page --HELP!
Message-Id: <35975C6A.3F5E9380@wolrich.com>
Hey guys, anyone out there able to help a newbie with what I thought
would be a very simple tweak?
I'm using a Free For All Links Page from Matt's Script Archive, and I
wanted to add a description entry box for visitors to add info about the
link they are adding ... how on earth do I tweak the .pl file to
incorporate this detail??
Someone please help me, it's driving me nuts.
Thanks a lot,
Colin.
http://wolrich.com/links/links.htm
------------------------------
Date: Mon, 29 Jun 1998 10:49:59 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: ! Free For All Links Page --HELP!
Message-Id: <35976347.B3D84BF6@nortel.co.uk>
Joshua Wolrich wrote:
> ... and I
> wanted to add a description entry box for visitors to add info about the
> link they are adding ... how on earth do I tweak the .pl file to
> incorporate this detail??
Look for the form. Add a description textfield. Give it a name. In the script
look for the line where the link is written to the file. If the textfield is
called description in the form, its value will be in $FORM{'description'} (in
theory). Incorporate it somehow into your writeback to the file.
Alternatively (much better), use CGI.pm and write your own link manager in app.
a quarter of the size of the one from Matt's script archive. And then you can
make one that doesn't look as messy in its layout :)
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 29 Jun 1998 07:56:32 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Joshua Wolrich <josh@wolrich.com>
Subject: Re: ! Free For All Links Page --HELP!
Message-Id: <sokotlhb.fsf@mailhost.panix.com>
Joshua Wolrich <josh@wolrich.com> writes:
> Hey guys, anyone out there able to help a newbie with what I thought
> would be a very simple tweak?
What have you tried so far? Is there a particular piece of code
that's giving you trouble? Can you post a brief example, one that's
less than 15 lines long, but shows the trouble you're having?
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Mon, 29 Jun 1998 23:15:14 GMT
From: Colin Wolrich <colin@wolrich.com>
Subject: Re: ! Free For All Links Page --HELP!
Message-Id: <35981FDD.97123B2B@wolrich.com>
F.Quednau wrote:
> Colin Wolrich wrote:
> > ... and I
> > wanted to add a description entry box for visitors to add info about the
> > link they are adding ... how on earth do I tweak the .pl file to
> > incorporate this detail??
>
> Look for the form. Add a description textfield.
I've done that already, please see http://wolrich.com/links/links.htm
> Give it a name. In the script
> look for the line where the link is written to the file. If the textfield is
> called description in the form, its value will be in $FORM{'description'} (in
> theory). Incorporate it somehow into your writeback to the file.
I've (tried) to do that also. I must still be doing something wrong -- here is
what I think is the relevant chunk from links.pl
foreach $tag ( keys %sections) { # For every tag
if ( ($FORM{'section'} eq $sections{$tag}) &&
($line =~ /<!--$tag-->/) ) {
print FILE "<li><a
href=\"$FORM{'url'}\">$FORM{'title'}\">$FORM{'desc'}</a>\n";
}
}
}
close (FILE);
# Return Link File
print "Location: $linksurl\n\n";
if ($database ne '') {
open (DATABASE,">>$database");
print DATABASE "$FORM{'url'}\n";
close(DATABASE);
> Alternatively (much better), use CGI.pm and write your own link manager in app.
> a quarter of the size of the one from Matt's script archive. And then you can
> make one that doesn't look as messy in its layout :)
Sounds good but as I said I am a complete newbie, thanks for your help. If you'd
be willing to look at the whole links.pl file I can upload it (very small).
Bless you guys, as I said I'm going nuts here, I can't see why it's so difficult to
write in another field.
Colin.
Thanks also to Jonathan
------------------------------
Date: Mon, 29 Jun 1998 20:50:36 -0500
From: "Fredrick V. Brock" <fvbrock@mycitypages.com>
Subject: "Invalid Switch" Message - Win32/DOS/Win95
Message-Id: <3598446C.D866F090@mycitypages.com>
Greetings Perlers:
I have read in the FAQs that the use of "system()" under Win32's is not
recommended.
Using Perl, Win32 v. 5.004_02, on Win95b platform, with ANY of the
following:
system("cls");
system('cls');
system "cls";
system 'cls';
results in a "Invalid Switch" message being generated on every second
loading and/or execution of the script/program. In other words, one time
it compiles or is interpreted without flaw, the next time the "Invalid
Switch" message flashes momentarily. The script/program then continues
and functions without fault. It appears that this is a DOS based error
message.
MyQ: On a Win/DOS based system, is there a preferred method to use for
clearing the screen so that a new screen can be displayed, cleanly?
Please advise, or point me in the right direction. All constructive
suggestions that may aid in the resolution of this issue will be
appreciated.
Thanks in advance.
--
Fredrick V. Brock
President http://www.mycitypages.com
My City Enterprises, Inc.
----------------------------------------------------------------------
------------------------------
Date: Mon, 29 Jun 1998 21:29:27 -0500
From: "Fredrick V. Brock" <fvbrock@mycitypages.com>
Subject: Re: "Invalid Switch" Message - Win32/DOS/Win95
Message-Id: <35984D87.531533AE@mycitypages.com>
BTW, so all of you don't think of me as a total idiot; I should have
mentioned that I have solved this issue temporarily via the use of a while
loop and calling it as needed. However, as diverse and robust as Perl is, I
know there must be a better way.
Thanks again,
Fredrick V. Brock
------------------------------
Date: Mon, 29 Jun 1998 15:06:59 GMT
From: ktyle@my-dejanews.com
Subject: $CHILD_ERROR problems when called by cron
Message-Id: <6n8aij$7u4$1@nnrp1.dejanews.com>
Hi all,
Consider the following short script:
#!/usr/bin/perl
print "About to test ps command\n";
`/bin/ps p 26155`;
print "Status of ps command is $?\n";
`/bin/ps p 8888`;
print "Status of ps command is $?\n";
`/bin/echo "Hello"`;
print "Status of echo command is $?\n";
In this case, process 26155 actually exists, while 8888 does not.
If I run this interactively, I get return status values of
0, 256, and 0. But, if I run this from cron, I get -1 for all
return values. This is perl, version 5.004_04 built for i386-linux,
running on Red Hat Linux 5.1 (kernel 2.0.34).
Curiously, if I use a c shell script in cron that calls the perl
script, I get the "0,256,0" return values; using a bash shell
script yields the "-1,-1,-1" results.
Additionally, on another machine (This is perl, version 5.003 with EMBED
built under linux at Dec 4 1996 20:40:11
+ suidperl security patch), running RH Linux 4.1 (2.0.27),
I get the "correct" values of 0,256,0.
Can anyone help me understand why I am getting the -1 values
in the above situations? By the way, my $PATH variable is slightly
different depending on what shell I'm running in cron, but /bin and
/usr/bin are always present.
Thanks,
Kevin Tyle
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 29 Jun 1998 23:08:51 GMT
From: Robert Martin <martin98@mail.SPAMlig.BANEbellsouth.net>
Subject: Re: $CHILD_ERROR problems when called by cron
Message-Id: <35981E75.45E5@mail.SPAMlig.BANEbellsouth.net>
ktyle@my-dejanews.com wrote:
>
> Hi all,
>
> Consider the following short script:
>
> #!/usr/bin/perl
> print "About to test ps command\n";
> `/bin/ps p 26155`;
> print "Status of ps command is $?\n";
> `/bin/ps p 8888`;
> print "Status of ps command is $?\n";
> `/bin/echo "Hello"`;
> print "Status of echo command is $?\n";
>
> In this case, process 26155 actually exists, while 8888 does not.
> If I run this interactively, I get return status values of
> 0, 256, and 0. But, if I run this from cron, I get -1 for all
> return values. This is perl, version 5.004_04 built for i386-linux,
> running on Red Hat Linux 5.1 (kernel 2.0.34).
>
> Curiously, if I use a c shell script in cron that calls the perl
> script, I get the "0,256,0" return values; using a bash shell
> script yields the "-1,-1,-1" results.
>
> Additionally, on another machine (This is perl, version 5.003 with EMBED
> built under linux at Dec 4 1996 20:40:11
> + suidperl security patch), running RH Linux 4.1 (2.0.27),
> I get the "correct" values of 0,256,0.
>
> Can anyone help me understand why I am getting the -1 values
> in the above situations? By the way, my $PATH variable is slightly
> different depending on what shell I'm running in cron, but /bin and
> /usr/bin are always present.
>
> Thanks,
>
> Kevin Tyle
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Hmmm, interesting.
Just curious, did you get exception mail from cron?
Looking forward to hearing how this one turns out. Wish I could help.
--Rob
Remove SPAM and BANE from my email address before use.
------------------------------
Date: 30 Jun 1998 16:03:09 GMT
From: ken@forum.swarthmore.edu (Ken Williams)
Subject: 3 new modules
Message-Id: <6nb27t$7dn$1@news.neta.com>
Hi,
I've just uploaded a few new modules to CPAN. The first is Tie::TextDir,
a simple TIEHASH interface to a UNIX directory. The second is
HTML::SimpleParse, a general-purpose HTML parser which is useful for
filtering HTML. And the third is Apache::SSI, a module that does HTML
server-side includes under Apache's mod_perl. It uses HTML::SimpleParse.
All of these modules have README files that will give you more
information, and documentation that gives even more. They'll become
available within the next few days on CPAN
(http://www.perl.com/CPAN-local/authors/id/KWILLIAMS/) .
------------------------------
Date: Mon, 29 Jun 1998 18:07:04 GMT
From: williams@email.uncc.edu (williams)
Subject: Re: [NT]: Getting Perl CGI to work
Message-Id: <3597d6e7.364947720@news.uncc.edu>
On Thu, 04 Jun 1998 21:56:15 GMT, sowmaster@juicepigs.com (Bob
Trieger) wrote:
>[ posted and mailed ]
>followups set.
>
>"David Sanders" <dsanders@netxchange.com> wrote:
>-> I recently installed Perl for Win32, and can run scripts from the
>-> command prompt.
>
>That means you don't have a problem with perl.
>
>-> However, when I first started trying to run sample
>-> ("Hello, world!") scripts on my IIS 4.0, it would give me, "%1 is not
>-> a valid WinNT application".
>
>That means you do have a problem with IIS.
>
>-> What is wrong???
>
>What is wrong is that you are asking a perl newsgroup an IIS question.
>
SmartA?? answers like this don't help people.
Most likely, David, you have not properly idnetified .pl files as the
proper MIME type. For Perl .pl files the MIME type is
application/x-perl.
Very often the Perl installer does not work correctly to associate
it's file types to the MIME type. You must do it manually.
>You'll have much better luck getting a solution in
>news:comp.infosystems.www.servers.ms-windows or
>new:microsoft.public.inetserver.iis
>
>HTH
>
>Bob Trieger
>sowmaster@juicepigs.com
>" Cost a spammer some cash: Call 1-800-239-0341
> and hang up when the recording starts. "
------------------------------
Date: Mon, 29 Jun 1998 20:10:17 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: [NT]: Getting Perl CGI to work
Message-Id: <6n8sf3$hsc$1@strato.ultra.net>
[ posted and mailed ]
williams@email.uncc.edu wrote:
-> On Thu, 04 Jun 1998 21:56:15 GMT, sowmaster@juicepigs.com (Bob
-> Trieger) wrote:
->
-> >[ posted and mailed ]
-> >followups set.
Your newsreader is broken. Follow-ups were set to the correct group and your
broken newsreader missed that.
-> >"David Sanders" <dsanders@netxchange.com> wrote:
-> >-> I recently installed Perl for Win32, and can run scripts from the
-> >-> command prompt.
-> >
-> >That means you don't have a problem with perl.
-> >
-> >-> However, when I first started trying to run sample
-> >-> ("Hello, world!") scripts on my IIS 4.0, it would give me, "%1 is not
-> >-> a valid WinNT application".
-> >
-> >That means you do have a problem with IIS.
-> >
->
->
-> >-> What is wrong???
-> >
-> >What is wrong is that you are asking a perl newsgroup an IIS question.
-> >
-> SmartA?? answers like this don't help people.
They most certainly do shit-for-brains. Ok, got the juvenile name calling out
of the way. Show me why my answer didn't help Mr. Sanders.
-> Most likely, David, you have not properly idnetified .pl files as the
-> proper MIME type. For Perl .pl files the MIME type is
-> application/x-perl.
That makes it a server problem. It has nothing to do with perl and this isn't
the newsgroup to find help with server problems.
-> Very often the Perl installer does not work correctly to associate
-> it's file types to the MIME type. You must do it manually.
Exactly, you must manually configure the server. It has nothing to do with
perl and this isn't the newsgroup to find help with server problems.
-> >You'll have much better luck getting a solution in
-> >news:comp.infosystems.www.servers.ms-windows or
-> >new:microsoft.public.inetserver.iis
Hey looky here, I told him exactly where to go and find the kind of help he
needed with his server problem. And I did it 4 weeks ago. I bet he went there
and got his questions answered that day.
Now what was your point?
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
and let the jerk that answers know that his
toll free number was sent as spam. "
------------------------------
Date: Tue, 30 Jun 1998 10:24:01 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage899202241.12671@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 18 May 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Spring of
1997; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/perlfaq.html
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq.html
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 29 Jun 1998 10:03:03 +0800
From: Ryan Snowden <ryan@steelplan.com.au>
Subject: Re: [Q] split ///, $variable
Message-Id: <3596F5D7.D597EFE3@steelplan.com.au>
Thanks for many DIFFERENT ways of handling this.. got a couple through
mail, cheers. It's good to see the multiple ways which commands can be
used, and ideally the different ways people think to get around a problem.
Ry.
------------------------------
Date: 29 Jun 1998 09:35:37 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: [Q] split ///, $variable
Message-Id: <6n7n59$i1u$1@pegasus.csx.cam.ac.uk>
Ryan Snowden <ryan@steelplan.com.au> wrote:
>
>I have a nice filename fully pathed like:
>
> /u1/s/blah/path/tothe/wonderful/pathname//filename.zip
>
>So, in order to strip everything down and get the filename
>(filename.zip), I figured I'd split it up, save it into an array, and
>then get value number [9].. i think... anyway, /// won't do it
>obviously. How do I make the / in the middle of the / / be the split
>character.
Use the module File::Basename in the standard distribution. Unlike
the other suggestions, it's portable to non-Unix platforms.
Mike Guy
------------------------------
Date: 28 Jun 1998 19:57:06 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: `fork' in Perl debugger under emacs
Message-Id: <m3ogvcvrst.fsf@windlord.Stanford.EDU>
Mark-Jason Dominus <mjd@op.net> writes:
> Today I noticed that if you're running the Perl debugger in an xterm,
> and your program does `fork', the debugger forks itself instead, with
> the child running in a new xterm window, so that you can debug the two
> processes independently. That's very nice.
> I never noticed it before because I always debug under emacs, and that
> feature doesn't work under emacs.
> It seems (form looking at perl5db.pl) that if I can define a subroutine
> called DB::get_fork_TTY, which will allocate a new emacs buffer and set
> the variable $DB::fork_TTY to the device name of the TTY associated with
> the buffer, then I'll get the nice fork behavior under emacs also.
> Unfortunately, I'm an emacs ignoramus.
> Has anyone else ever done this? Is there an emacs expert who can offer
> hints?
Hm.
The first thing that occurs to me here is that it's easy to do this if
you're running the debugger in an xterm because if you just fork the
xterm, you get another xterm. This doesn't work nearly as nicely inside
emacs, because you don't want to just fork your emacs. *wry grin*
Looking at the code, it looks like it opens up a new xterm and has it open
a particular tty. I'm honestly not sure that even works on all platforms;
some systems may get rather irate about the debugger taking over a tty
that had been allocated to an xterm. Is xterm setuid root on your system?
(If not, then it can't actually lock a tty, making it more likely that you
can get away with this sort of thing.)
I tried to figure out how emacs allocates ttys for things like shell mode
and am unfortunately not finding it. That detail you may want to check in
an emacs newsgroup for.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 29 Jun 1998 04:22:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: `fork' in Perl debugger under emacs
Message-Id: <6n74pe$9sh$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Russ Allbery
<rra@stanford.edu>],
who wrote in article <m3ogvcvrst.fsf@windlord.Stanford.EDU>:
> > It seems (form looking at perl5db.pl) that if I can define a subroutine
> > called DB::get_fork_TTY, which will allocate a new emacs buffer and set
> > the variable $DB::fork_TTY to the device name of the TTY associated with
> > the buffer, then I'll get the nice fork behavior under emacs also.
No. But if DB::get_fork_TTY() communicates with Emacs (one-way may be
via \*LINEINFO, I do not know how it would get the TTY name back),
it may *ask* Emacs to allocated a new tty to a new buffer. As I said,
getting the tty id back into Perl may be tricky.
> Looking at the code, it looks like it opens up a new xterm and has it open
> a particular tty.
Nope. It opens an xterm and solicits the tty name from it.
Hope this helps,
Ilya
------------------------------
Date: 30 Jun 1998 15:35:47 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: A funny problem with "use integer"
Message-Id: <6nb0kj$kp7$2@news.iastate.edu>
Randal Schwartz (merlyn@stonehenge.com) wrote:
: >>>>> "Vivek" == Vivek Khera <khera@kciLink.com> writes:
: Vivek> [kci]% cat |perl
: As I've said before, it's a good thing I don't give out Useless Use
: of Cat Awards anywhere other than comp.unix.{shell,questions}.
: <sigh>
Excuse this one, but what's so useless about the above usage?
Josh
--
_________________________________________________________
I do not trust your bitch.
- Frederich Nietzche, in _Also Sprach Zarathustra_
------------------------------
Date: 28 Jun 1998 05:36:41 GMT
From: bem@news.cmc.net (brian moore)
Subject: Re: A new Perl keyword: MSPH [Was: What a Crappy World (oh, yes!)]
Message-Id: <slrn6pbljd.1vd.bem@thorin.cmc.net>
On Fri, 26 Jun 1998 00:23:04 -0400,
Matthew O. Persico <mpersico@erols.com> wrote:
> 2) I'd like to see how far any of the MSPHs would get if Usenet were
> conducted in person. It's kind of like road-rage, protection by
> separation. How brave are you in person? Wanna try that attitude in a
> NYC subway car?
Turn it around: how many goofy posts would never be posted if people
had to face their peers when asking questions?
Few would walk up to strangers on the street and say "I need a
guestbook! Write me one!"
The people being flamed are being flamed not because of Usenet:
they are flamed because the attitude of "I'm too busy to actually
read the docs or even read the newsgroup, so do my work and mail
me the answer" is as rude on Usenet as it is offline.
That attitude would not last 10 minutes in a small farm town, let
alone The Big Apple.
If they instead turn the question to "look, I know this may be in the
FAQ, at least it seems like it should be easy to do, but I can't find it
for the life of me..." they'd get much more friendly responses.
--
Brian Moore Kill A Spammer For Jesus
Sysadmin, C/Perl Hacker, Usenet Vandal
------------------------------
Date: 28 Jun 1998 02:05:54 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: A new Perl keyword: MSPH [Was: What a Crappy World (oh, yes!)]
Message-Id: <lthg1612nx.fsf@asfast.com>
bem@news.cmc.net (brian moore) writes:
> On Fri, 26 Jun 1998 00:23:04 -0400,
> Matthew O. Persico <mpersico@erols.com> wrote:
> > 2) I'd like to see how far any of the MSPHs would get if Usenet were
> > conducted in person. It's kind of like road-rage, protection by
> > separation. How brave are you in person? Wanna try that attitude in a
> > NYC subway car?
>
> Turn it around: how many goofy posts would never be posted if people
> had to face their peers when asking questions?
>
> Few would walk up to strangers on the street and say "I need a
> guestbook! Write me one!"
Thank God that the number of people who come to c.l.p.misc demanding
"Write me one!" is so miniscule, and that such people show up so
infrequently.
However, some people do ask, in effect, "Has someone already written
one?" which is a completely different question.
> The people being flamed are being flamed not because of Usenet:
> they are flamed because the attitude of "I'm too busy to actually
> read the docs or even read the newsgroup, so do my work and mail
> me the answer" is as rude on Usenet as it is offline.
Yes, the people who take such a high-handed attitude are indeed
setting themselves up for flames. What I find sad is that there are
people who *don't* have this attitude, but who are mistakenly seen
(and therefore treated) as if they did. It's almost as if some
c.l.p.misc regulars are saying "I don't know for sure if you really
are a lazy freeloader or not, but just in case, I'm going to treat you
as one."
I trust that you wouldn't do this, but there are others who have done
so.
> That attitude would not last 10 minutes in a small farm town, let
> alone The Big Apple.
Agreed.
And there are people who, when they encounter a stranger,
automatically assume, with little or no evidence, that this stranger's
intent is to take advantage of them, and then treat this stranger
accordingly. These people don't do well in farm towns or big cities,
either.
> If they instead turn the question to "look, I know this may be in the
> FAQ, at least it seems like it should be easy to do, but I can't find it
> for the life of me..." they'd get much more friendly responses.
Agreed ... although I have even seen this approach greeted with
insults. I'm gratified that this seems to be happening a lot less
lately.
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Sun, 28 Jun 1998 17:51:29 GMT
From: abraham@mpi.com
Subject: Re: About usage of recursive algoritm in Perl.
Message-Id: <6n5vr1$il7$1@nnrp1.dejanews.com>
sub cryForHelp {
cryForHelp() until $answered;
}
In article <01bda0c4$924dfa60$e16c54c2@serverg1>,
"Administrator" <w3master@infosys.ru> wrote:
>
> Hi!
> How can I create a perl-program with recursive function in RedHut Linux
> Perl 5.00.003?
> Or it's not passible? Answer me please!!!! You are may send your answer at
> w3master@infosys.ru
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 30 Jun 1998 11:02:59 -0600
From: "Shawn M Ferris" <shawnf@exabyte.com>
Subject: Advice on loading modules as needed.
Message-Id: <6nb5nn$kqc$1@news.exabyte.com>
First of all I apologize if this is in a faq, I've looked for it to no
avail. I'm probably not looking in the right places.
Depending on how a script is configured (via command line, config file, etc)
it will require additional modules to be loaded.
Is there a better way of doing this?A basic sample of what I done..
$mod='MOD::Test';
eval "require $mod" or die;
$mh=$mod->new;
This seems to work fine, my question is: Is this correct? Is there a
better/safer more efficient way? Is testing the eval going to always give
predictable results, etc. 8)
Any advice would be greatly appreciated. Please redirect any responses via
this group as this email address won't be valid after this week. 8)
Thanks in advance!
Shawn M Ferris
------------------------------
Date: Tue, 30 Jun 1998 16:20:39 +0100
From: Andrew MacInnes <a.g.macinnes@rl.ac.uk>
Subject: Alternative solution ?
Message-Id: <35990245.E99CF377@rl.ac.uk>
I am trying to get information from a file and have written the
following script using perl FAQ's and tutorials. This works fine,
however I would like a more efficient way to get the data into the
array. Could someone please give me an idea for a better solution which
does not mean me having to create a temp file each time.
#!usr/local/bin/perl/
# run command to get data from log and write to a new file
exec "grep 130.246.12.22 log.dat | grep 130.246.180.31 > temp";
# open new file and read data into array
$file = 'temp'; # Name the file
open(INFO, $file); # Open the file
@data_array = <INFO>; # Read it into an array
close(INFO); # Close the file
Any help is much appreciated
Andrew MacInnes
------------------------------------------
Rutherford Appleton Laboratory
Department for Computation and Information
Atlas Building, R27 - F31
Chilton, Didcot, Oxon, OX11 0QX
Telephone (direct): (01235)446104
E-mail:A.G.MacInnes@rl.ac.uk
-----------------------------------------
------------------------------
Date: Tue, 30 Jun 1998 15:51:21 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Alternative solution ?
Message-Id: <ZP7m1.62$zY.574792@news3.voicenet.com>
Andrew MacInnes <a.g.macinnes@rl.ac.uk> wrote:
># run command to get data from log and write to a new file
>exec "grep 130.246.12.22 log.dat | grep 130.246.180.31 > temp";
Do you mean two Perl programs? exec never returns! Maybe you want to
use 'system' or backticks here.
How about:
open(DATA, '/path/to/log.dat') or die "open /path/to/log.dat: $!\n";
while (<DATA>) {
next unless /130\.246\.12\.22/;
next unless /130\.246\.180\.31/;
push @data_array, $_;
}
You could simplfy this further by specifying 'log.dat' on the command
line. That way you wouldn't have to explicitly open the file, and could
use 'while(<>) { }'.
You may also want to read up on 'perldoc perlre', as it will show you
how Perl can handle regular expressions better than grep.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: Tue, 30 Jun 1998 08:51:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Alternative solution ?
Message-Id: <MPG.1002a9621ace0294989705@nntp.hpl.hp.com>
In article <35990245.E99CF377@rl.ac.uk> on Tue, 30 Jun 1998 16:20:39
+0100, Andrew MacInnes <a.g.macinnes@rl.ac.uk> says...
> I am trying to get information from a file and have written the
> following script using perl FAQ's and tutorials. This works fine,
> however I would like a more efficient way to get the data into the
> array. Could someone please give me an idea for a better solution which
> does not mean me having to create a temp file each time.
>
> #!usr/local/bin/perl/
>
> # run command to get data from log and write to a new file
> exec "grep 130.246.12.22 log.dat | grep 130.246.180.31 > temp";
>
> # open new file and read data into array
> $file = 'temp'; # Name the file
> open(INFO, $file); # Open the file
> @data_array = <INFO>; # Read it into an array
> close(INFO); # Close the file
open(INFO, "grep 130.246.12.22 log.dat | grep 130.246.180.31 |") or
die "Couldn't open pipe. $!.";
A (better?) way would be to open 'log.dat' directly and do the greps in
Perl:
@data_array = grep /\Q130.246.12.22/ && /\Q130.248.180.31/, <INFO>;
The \Q forces literal matches against the dots; your original greps don't
do that (but probably should: grep '130\.246\.12\.22' ...).
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 30 Jun 1998 11:56:50 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Alternative solution ?
Message-Id: <ic5bn6.juf.ln@localhost>
Andrew MacInnes (a.g.macinnes@rl.ac.uk) wrote:
: I am trying to get information from a file and have written the
: following script using perl FAQ's and tutorials. This works fine,
: however I would like a more efficient way to get the data into the
: array. Could someone please give me an idea for a better solution which
: does not mean me having to create a temp file each time.
: #!usr/local/bin/perl/
Hey!
Where is your -w?
You should always, yes ALWAYS, enable warnings:
#!usr/local/bin/perl/ -w
^^
^^
: # run command to get data from log and write to a new file
: exec "grep 130.246.12.22 log.dat | grep 130.246.180.31 > temp";
Don't need the exec() if you use a pipe open.
: # open new file and read data into array
: $file = 'temp'; # Name the file
: open(INFO, $file); # Open the file
open(INFO, 'grep 130.246.12.22 log.dat | grep 130.246.180.31 |') ||
die "could not fork a process!";
: @data_array = <INFO>; # Read it into an array
: close(INFO); # Close the file
close(INFO) || die "problem reading the output from grep $!";
Of course, you can do the whole thing from within perl itself (UNTESTED):
open(IN, 'log.dat') || die "could not open 'log.dat' $!";
while (<IN>) {
push @data_array, $_ if /\Q130.246.12.22/ && /\Q130.246.180.31/;
}
close(IN);
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 3006
**************************************