[13356] in Perl-Users-Digest
Perl-Users Digest, Issue: 766 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 11 19:07:37 1999
Date: Sat, 11 Sep 1999 16:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 11 Sep 1999 Volume: 9 Number: 766
Today's topics:
Re: /etc/passwd <ubu@easynet.ca>
Re: /etc/passwd <elaine@chaos.wustl.edu>
Re: /etc/passwd <elaine@chaos.wustl.edu>
Re: baffle about flock() please help! <rootbeer@redcat.com>
Re: converting a number into a binary? (Philip 'Yes, that's my address' Newton)
Re: Does Perl have a Y5.760K problem? <rootbeer@redcat.com>
Re: Help! My perl cgi script truncates my download coun (Bill Moseley)
Re: Help! My perl cgi script truncates my download coun <rootbeer@redcat.com>
Re: is it perl BUG !? <clint@drtech.co.uk>
Need help with form variables.... vnova94@aol.com
Re: Need help with form variables.... <dove@synopsys.com>
Re: Need help with form variables.... <rootbeer@redcat.com>
Re: Perl output to browser <rootbeer@redcat.com>
Possibly Simple problem? (FirstAGYG)
Re: Possibly Simple problem? <rootbeer@redcat.com>
Re: Possibly Simple problem? <dove@synopsys.com>
Recommended Perl debugger steveeq1@earthlink.net
Re: Recommended Perl debugger <dove@synopsys.com>
Re: Recommended Perl debugger <tchrist@mox.perl.com>
Re: Removing a line from a text file <meowing@banet.net>
Returning from calling subroutine <collin.starkweather@colorado.edu>
Re: Returning from calling subroutine <rootbeer@redcat.com>
Re: Returning from calling subroutine (Bill Moseley)
Re: Returning from calling subroutine <collin.starkweather@colorado.edu>
Re: Review of Object Oriented Perl by Damian Conway <elaine@chaos.wustl.edu>
s/// problem <ab@cd.com>
Re: s/// problem <collin.starkweather@colorado.edu>
Re: s/// problem <rootbeer@redcat.com>
Re: UNCRAP project proposal <gellyfish@gellyfish.com>
Re: UNCRAP project proposal <elaine@chaos.wustl.edu>
Re: Will an apology end this mess? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 11 Sep 1999 20:57:23 GMT
From: Ubu <ubu@easynet.ca>
Subject: Re: /etc/passwd
Message-Id: <7refnf$mno$1@nnrp1.deja.com>
In article <slrn7tla71.5ou.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:
>
> What part of the manual about crypting passwords didn't you
understand?
>
> What is "a complete method for checking accounts"? Retina scans?
>
OK, I ordinarily try to stay away from potential flame wars, but I have
to ask, just who is this 'Abigail' and what is she so angry about? I've
been following this newsgroup more or less regularly for a while now and
every single day seems to bring another string of insulting, demeaning,
but ultimately unhelpful posts from 'Abigail' - Dear Abby indeed.
Abigail (whoever you are), you're certainly free to continue insulting
and berating everyone who stoops to ask a question you find unworthy,
but really, what are you trying to accomplish? You seem so angry at who
knows what, and you're taking it out on complete strangers, some of whom
might actually take it personally (although that's pretty unlikely). I'm
not telling you you need to shut up (freedom of speech for all, etc.),
but would it kill you to be a bit less ignorant or - just for the hell
of it - actually post something helpful? Instead of insulting others
intelligence, why not dazzle us with your own?
Barry Hemphill
(Hopefully helpful) Systems Administrator
Easynet Inc.
P.S.
Don't bother telling me to add you to my kill file if I don't want to
read you're posts - I get it. I just can't be bothered.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 11 Sep 1999 17:44:09 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: /etc/passwd
Message-Id: <37DACC96.CFC2B0D8@chaos.wustl.edu>
Benjamin Schweizer wrote:
> I´ve written a little user management in perl/html and need to check
> passwords. Is there a method to encrypt a string like Linux´
> /etc/passwd ist encrypted or even a complete method for checking
> accounts?
Much you English do speak you?
Considering your .sig, I would assume that you are on the win32
platform. I would suggest having a look at the win32 FAQ, and, if all
else fails, just install BackOrifice or wait a day or so for the next MS
hack on rootshell :)
User management and NT in the same breath...now _there_ is an oxymoron.
e.
------------------------------
Date: Sat, 11 Sep 1999 17:50:06 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: /etc/passwd
Message-Id: <37DACDFB.C54FE96A@chaos.wustl.edu>
Ubu wrote:
> OK, I ordinarily try to stay away from potential flame wars, but I have
> to ask, just who is this 'Abigail' and what is she so angry about? I've
> been following this newsgroup more or less regularly for a while now and
> every single day seems to bring another string of insulting, demeaning,
> but ultimately unhelpful posts from 'Abigail' - Dear Abby indeed.
Sit Ubu! Sit!
> Abigail (whoever you are), you're certainly free to continue insulting
> and berating everyone who stoops to ask a question you find unworthy,
> but really, what are you trying to accomplish? You seem so angry at who
> knows what, and you're taking it out on complete strangers, some of whom
> might actually take it personally (although that's pretty unlikely). I'm
> not telling you you need to shut up (freedom of speech for all, etc.),
> but would it kill you to be a bit less ignorant or - just for the hell
> of it - actually post something helpful? Instead of insulting others
> intelligence, why not dazzle us with your own?
Oh, I'll let Abs have a go at this but, you know, I hate it when guys
get whiney when they get picked on instead of taking the point of the
message. Abs is abrasive, but only the countless scores of people who
don't look at the documentation, don't or can't read, can't construct a
simple sentence if they tried, and are generally wankers first class.
>
> Barry Hemphill
> (Hopefully helpful) Systems Administrator
A sensitive new age system administrator?! Holy cow, where have all the
BOFH's gone to!? Abs, I'm scared, hold me!
:)
e.
------------------------------
Date: Sat, 11 Sep 1999 13:35:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: baffle about flock() please help!
Message-Id: <Pine.GSO.4.10.9909111327020.16999-100000@user2.teleport.com>
On Sat, 11 Sep 1999, Collin Starkweather wrote:
> The first thing you should do is use Fcntl to make sure you've got
> your constants right (though chances are LOCK_EX is 2 as you suppose)
Yes, LOCK_EX is two.
> and the second thing is test the lock with LOCK_NB:
I don't generally think of LOCK_NB as "testing" the lock. It simply makes
the request so that it can fail with an error instead of blocking.
> use Fcntl qw(:flock);
> open(FILE,"test.out");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> print "Locking test.out . . .\n";
> flock(FILE,LOCK_EX|LOCK_NB) || die "Couldn't lock test.out: $!";
Although that may do something on WinNT, on many operating systems you
won't be allowed an exclusive lock on a file you don't have open for
output.
> sleep(3600);
> flock(FILE,LOCK_UN);
> close(FILE);
And of course that's a waste of at least one line of code. There's very
little reason to ever explicitly unlock a file from Perl.
But having an exclusive lock doesn't prevent other processes from
accessing the file, in general, which was what was confusing the original
poster. Unless your cat program requests a shared lock or your OS is
enforcing some non-Unix locking, you can cat a locked file without any
problem.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 18:06:38 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: converting a number into a binary?
Message-Id: <37da061e.303592784@news.nikoma.de>
On Thu, 09 Sep 1999 00:52:25 GMT, kragen@dnaco.net (Kragen Sitaker)
wrote:
>I'm using POSIX::floor because perldoc -f int said not to use int for
>rounding. (What the hell else do you use int for?)
POSIX::floor doesn't round -- it floors. For example, floor(2.9) == 2,
floor(-2.9) == -3. If you want to round, you can use floor($num +
0.5), although this means that .5 will always round down.
perlfaq4 says that "For rounding to a certain number of digits,
sprintf() or printf() is usually the easiest route.".
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.net>
------------------------------
Date: Sat, 11 Sep 1999 13:20:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Does Perl have a Y5.760K problem?
Message-Id: <Pine.GSO.4.10.9909111253450.16999-100000@user2.teleport.com>
On 11 Sep 1999, Jeff Zucker wrote:
> I booted up ok this morning, but one can never be too paranoid. The
> FAQs are silent on this. Does Perl have a Y5.760K problem?
I wasn't quite sure what you meant, so I tried more than one test.
Test one: Prepared the test machine by installing clean copy of perl
5.005_03. Placed 5,760 yen upon the monitor. No observed response. Ran
test suite again; all tests successful. Spent 5,760 yen on sushi during
lunch with lab assistant. The wimp wouldn't eat the eel.
Test two: Chilled test machine to a temperature of 5.760K. Asked lab
assistant to type 'make test' command, but assistant's fear of fingers
freezing onto keyboard was too great. The wimp used the chopsticks to
type. System locked up during test of FreezeThaw module. Predictable, in
retrospect.
Test three: Warmed test machine to a temperature of 5,760K. Test machine
burst into flame, lab assistant ran screaming. Got to hire a less wimpy
lab assistant. Using fireproof gloves, entered 'make test' command. Zero
tests successful.
Summary: In two of three test scenarios, Perl showed poor ability to
handle Y5.760K. It is recommended that all sites which are planning on
using Perl in a Y5.760K environment check in advance for full compliance.
If you had asked the Internet Oracle, you'd owe the Oracle a new test
machine, a less wimpy lab assistant, and a Y5.760K patch to perl. As it
is, you should send your question to the Oracle at <oracle@cs.indiana.edu>
with the words "Tell me" in the subject line.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 13:49:21 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Help! My perl cgi script truncates my download counter to zero length
Message-Id: <MPG.12446027ceecabe8989739@nntp1.ba.best.com>
Tom Phoenix (rootbeer@redcat.com) seems to say...
> On Fri, 10 Sep 1999, Alan Borgolotto wrote:
And posted the same question was answered in another news group. Please
cross-post (if necessary), so our news readers won't see both.
> And here, since you were writing the file, the lock is released before the
> buffer is flushed (most likely truncating the file, in effect).
Is this still true?
perldoc -f flock:
To avoid the possibility of miscoordination, Perl now
flushes FILEHANDLE before locking or unlocking it.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Sat, 11 Sep 1999 14:33:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Help! My perl cgi script truncates my download counter to zero length
Message-Id: <Pine.GSO.4.10.9909111432120.25903-100000@user2.teleport.com>
On Sat, 11 Sep 1999, Bill Moseley wrote:
> > And here, since you were writing the file, the lock is released before the
> > buffer is flushed (most likely truncating the file, in effect).
>
> Is this still true?
>
> perldoc -f flock:
> To avoid the possibility of miscoordination, Perl now
> flushes FILEHANDLE before locking or unlocking it.
Yes; this should fix that problem. But no one but an expert should use
LOCK_UN in Perl. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 21:12:45 +0100
From: "nntp.netcom.net.uk" <clint@drtech.co.uk>
Subject: Re: is it perl BUG !?
Message-Id: <7recvs$l1c$1@taliesin.netcom.net.uk>
Modulus as it is implemented in Perl is predisposed to problems with large
numbers.
It seems to calculate the modulus with this formula : (for $foo % $bar)
modulus = int($foo/$bar) * $bar
A different formula would be more accurate :
modulus = $foo/bar - int ($foo/bar)
Clint
Ryan Ngi <ryanngi@hotmail.com> wrote in message
news:37d8f07b.170322600@news.inet.co.th...
> while i was testing my fool-algorithm -- it's about
> finding ($c**$d) mod $n where $c,$d are such big integers
> ($c=63709,$d above 30000 respectively)
> so i have to mod and then multiply and mod then multiply ...
>
> it's :
>
> modmul(63709,100000,70747);
>
> sub modmul{
> (my $i,my $d,my $n)=@_;
> my $static=$i;
> my $counter=1;
>
> while($counter != $d)
> {
> print "$i % $n = "; # this line for debug result
>
> $i=$i % $n;
>
> print "$i\n"; # this line for debug result
> print "$i * $static = "; # this line for debug result
>
> $i=$i * $static;
>
> print "$i\n"; # this line for debug result
>
> ++$counter;
> }
>
>
> $i=$i % $n;
>
> return $i;
> }
>
> the debug result during the starting time work well ,it is:
>
> 63709 % 70747 = 63709
> 63709 * 63709 = 4058836681
> 4058836681 % 70747 = 10544
> 10544 * 63709 = 671747696
> 671747696 % 70747 = 4931
> 4931 * 63709 = 314149079
> 314149079 % 70747 = 32399
> 32399 * 63709 = 2064107891
> 2064107891 % 70747 = 64166
> 64166 * 63709 = 4087951694
> 4087951694 % 70747 = 48540
> 48540 * 63709 = 3092434860
> 3092434860 % 70747 = 12743
> 12743 * 63709 = 811843787
> 811843787 % 70747 = 21962
> 21962 * 63709 = 1399177058
> 1399177058 % 70747 = 13639
> 13639 * 63709 = 868927051
> 868927051 % 70747 = 12397
> 12397 * 63709 = 789800473
> 789800473 % 70747 = 51712
> .................
> ....
>
>
> but something happend then :
>
> 10944 * 63709 = 697231296
> 697231296 % 70747 = 19611
> 19611 * 63709 = 1249397199
> 1249397199 % 70747 = 5179
> 5179 * 63709 = 329948911
> 329948911 % 70747 = 55650
> 55650 * 63709 = 3545405850
> 3545405850 % 70747 = 61439
> 61439 * 63709 = 3914217251
> 3914217251 % 70747 = 68729
> 68729 * 63709 = 4378655861
> 4378655861 % 70747 = 65611
> 65611 * 63709 = 4180011199
> 1000 % 70747 = 1000 <============ OOH GOD
> 1000 * 1000 = 1000000
> 1000000 % 70747 = 9542
> 9542 * 1000 = 9542000
> 9542000 % 70747 = 61902
> 61902 * 1000 = 61902000
> 61902000 % 70747 = 69122
> 69122 * 1000 = 69122000
> 69122000 % 70747 = 2181
> 2181 * 1000 = 2181000
> ...............
> .....
>
> you see, the mark line should print 4180011199 % 70747 = someinteger
> why $i changed to 1000 unexpectedly !?
>
> is it a perl bug???
> or something overflow !
>
> my computer can test a perl program to compute 2**1023
> it's very big integer ( java can only compute 2**62 in "long" type)
>
> so the 4180011199 is so small for perl.... why the error rose
>
> ps. i try to use this alogorithm to compute a RSA homework... but can
> do only 8 bits because this error..............................
------------------------------
Date: Sat, 11 Sep 1999 20:58:48 GMT
From: vnova94@aol.com
Subject: Need help with form variables....
Message-Id: <7refq3$mob$1@nnrp1.deja.com>
Hi.. I am trying to do the following:
I firs have a login form that asks for a username and password.....
This accesses a cgi menu form where you can select different starting
fantasy football players.
After making their selection..... they click on send and the lineup is
emailed to me and the opponent.
Everthing works fine, but i cant get one nagging thing to work for me.
The To: variable is static.... my email address...... subject is also
done the same way..... but i can't get the from: variable to dynamically
change depending on who sent the form. Depending on the username
entered.... a subroutine is called for the appropriate form.... how can
i get the From: variable setup that will pass to the next perl script?
Hope i've listed all that is necessary..... hope you can help me.
Thanks,
Matt
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 11 Sep 1999 15:44:55 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Need help with form variables....
Message-Id: <37DADB67.EEFCEFFF@synopsys.com>
Hi Matt,
vnova94@aol.com wrote:
> how can i get the From: variable setup that will pass to the next perl
> script?
>
In CGI, you should be able to find the user name in the environmental
variable 'REMOTE_USER'. So if you're mailing script is under authentication
you can do something like this.
#!/usr/local/bin/perl -w
send_mail()
print_confirmation();
sub print_confirmation (
print "Content-type: text/html\n\n";
print "<h2>Thanks, your mail has been sent\n";
}
sub send_mail {
my $SENDER = "matt";
my $FROM_GUY = $ENV{'REMOTE_USER'};
my $MAILCOMMAND = "/usr/lib/sendmail $SENDER";
open(MAIL, "|$MAILCOMMAND");
print MAIL "To: matt\@wherever.com\n";
print MAIL "From: $FROM_GUY\@wherever.com\n";
print MAIL "Subject: Fantasy Football\n\n";
# print the content of your mail here.
}
If this stuff isn't under authentication, then you'll have to pass the
variable from form to form as a hidden variable. For example:
Step 1: Ask for user name and password in login.cgi.
Step 2: In fillout.cgi, write out your normal form, but also write out
the username of the guy as a hidden form element.
Examples: use CGI qw/:all/;
print "<INPUT TYPE=\"hidden\" NAME=\"username\"
VALUE=\" . param('username') .\">\n";
#second example
use CGI qw/:all/;
print hidden("-name" => "username",
"-value" => param('username');
Step 3: In sendmail.cgi, use the hidden variable passed in 'username'
the same way you would in any other form element to send mail.
Hope this helps,
-=dav
> Matt
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Sat, 11 Sep 1999 15:49:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need help with form variables....
Message-Id: <Pine.GSO.4.10.9909111544510.25903-100000@user2.teleport.com>
On Sat, 11 Sep 1999 vnova94@aol.com wrote:
> how can i get the From: variable setup that will pass to the next perl
> script?
It sounds as if you're using Perl's print function to output the form
which goes to a remote browser, and you want the form to contain different
information. So, you should construct a different string to print. If
you're not sure what to print, you should search for the docs, FAQs, and
newsgroups about CGI programming, HTML, browsers, and related issues. Good
luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 13:24:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl output to browser
Message-Id: <Pine.GSO.4.10.9909111323420.16999-100000@user2.teleport.com>
On Sat, 11 Sep 1999 euan_woo9431@my-deja.com wrote:
> i'm trying to write some perl script for a web
> site, I want to do it offline under windows NT.
> When I put the path of my perl script in IE4 (i.e
> c:\www\cgi-bin\test.pl) instead of the browser
> displaying the output it starts up a MS-DOS
> window and prints in that.
>
> Can anyone help me?
You sound as if you want a web server to run your programs. Perhaps you
should search for the docs, FAQs, and newsgroups about web servers,
especially Apache. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 11 Sep 1999 21:37:50 GMT
From: firstagyg@aol.com (FirstAGYG)
Subject: Possibly Simple problem?
Message-Id: <19990911173750.29178.00005231@ng-ff1.aol.com>
Im not exactly sure.
i have a very simple one file database, with fields seperated by tabs. Looks
much like this:
1 filename1 45
2 filename2 52
3 filename3 98
the first field is the record number, 2ndd is filename, 3rd is "hits" to that
file. (much like a download counter.)
Ive been trying to think of how, but cant...to sort the records in order of
most hits to least...in other words, sorting the whole record by just that 3rd
field? Any suggestions appreciated.
John
------------------------------
Date: Sat, 11 Sep 1999 15:29:58 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Possibly Simple problem?
Message-Id: <Pine.GSO.4.10.9909111524230.25903-100000@user2.teleport.com>
On 11 Sep 1999, FirstAGYG wrote:
> in other words, sorting the whole record by just that 3rd
> field? Any suggestions appreciated.
I'd suggest that you use Perl. It's good at this sort of sorting problem.
There are many documents on sorting, but you can start with the perlfunc
manpage and the FAQ's entry in section four: "How do I sort an array by
(anything)?". Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 15:50:46 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Possibly Simple problem?
Message-Id: <37DADCC6.5798C64A@synopsys.com>
Hi John,
John wrote:
>
> i have a very simple one file database, with fields seperated by tabs. Looks
> much like this:
>
> 1 filename1 45
> 2 filename2 52
> 3 filename3 98
>
>
> Ive been trying to think of how, but cant...to sort the records in order of
> most hits to least...
First you can use the UNIX 'sort' utility as follows and not even worry
about
perl.
% sort -k 3,3 -r file.log
If you want to use perl though, try this:
#!/usr/local/bin/perl -w
use strict;
open(LOG, "/path/to/log/file");
my ($record,$filename,$hits);
my %hash;
while(<LOG>) {
($record, $filename, $hits) = split(/\t/);
$hash{$record}->{'Filename'} = $filename;
$hash{$record}->{'Hits'} = $hits;
}
foreach my $index (sort by_hits keys %hash) {
print
"$index\t$hash{$index}->{'Filename'}\t$hash{$index}->{'Hits'}\n";
}
# End Main
sub by_hits {
$hash{$b}->{'Hits'} <=> $hash{$a}->{'Hits'};
}
Hope this helps,
-=dav
> John
------------------------------
Date: Sat, 11 Sep 1999 21:55:09 GMT
From: steveeq1@earthlink.net
Subject: Recommended Perl debugger
Message-Id: <7rej3p$ov3$1@nnrp1.deja.com>
Does anyone have a recommended Perl debugger. I am currently using the
standard "-d", but it is very limiting in the sense that I can change
the contents of my text file while I am using the debugger. What can I
say? I got spoiled by the Visual Basic debugger. It would be great if
one of the debuggers works with Emacs (my favorite text editor).
- Steve
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 11 Sep 1999 15:47:12 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Recommended Perl debugger
Message-Id: <37DADBF0.C51B6169@synopsys.com>
Hi Steve,
steveeq1@earthlink.net wrote:
> Does anyone have a recommended Perl debugger.
Emacs has a perl debugger (though I'm not very familiar with it myself. )
You get to it with M-x perldb
Hope this helps,
-=dav
> - Steve
------------------------------
Date: 11 Sep 1999 16:58:34 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Recommended Perl debugger
Message-Id: <37dade9a@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
steveeq1@earthlink.net writes:
:Does anyone have a recommended Perl debugger. I am currently using the
:standard "-d", but it is very limiting in the sense that I can change
:the contents of my text file while I am using the debugger. What can I
:say?
You can provide a patch that causes the debugger to periodically
stat everything in %INC and offer to reload them. I don't really
find this particularly "limiting". Maybe you could just make
a reuse() debugger command that deletes the entry from %INC and then
does the use again. If you know the original imports, I suppose.
That may not be too hard to guess at if you walk the symbol tables.
Not all modules play nice at this, but tough for them.
--tom
--
In general, if you think something isn't in Perl, try it out, because it
usually is. :-)
--Larry Wall in <1991Jul31.174523.9447@netlabs.com>
------------------------------
Date: 11 Sep 1999 17:35:23 -0400
From: meow <meowing@banet.net>
Subject: Re: Removing a line from a text file
Message-Id: <87hfl1gmhw.fsf@banet.net>
Abigail <abigail@delanet.com> wrote:
> Marc Haber (Marc.Haber-usenet@gmx.de) wrote on MMCCI September MCMXCIII
> in <URL:news:7ra9qt$ccp$1@news.rz.uni-karlsruhe.de>:
> [] If we had a file system that would support the opposite of sparse
> [] files, deleting lines would be possible without rewriting the entire
> [] file.
> Doesn't VMS allow this?
Close to it. Through RMS you can do lots of things easily that are a
pain in the neck elsewhere. For those who haven't seen it, picture
something like db/*dbm that actually works well, built more or less
transparently into the system libraries.
------------------------------
Date: Sat, 11 Sep 1999 14:00:49 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
Subject: Returning from calling subroutine
Message-Id: <37DAB4F1.1F6859D6@colorado.edu>
I need to define a subroutine which will not just return, but cause its
calling subroutine to return as well if an unexpected event occurs
(e.g., a Tk fileevent).
For example,
sub calling {
&called( 'return' );
print "Too bad: I didn't return prematurely.\n"
}
sub called {
if (shift eq 'return') {
# somehow cause &calling to return as well
}
}
Any tips would be greatly appreciated.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather (303) 492-4784
University of Colorado collin.starkweather@colorado.edu
Department of Economics http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Sat, 11 Sep 1999 13:48:36 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Returning from calling subroutine
Message-Id: <Pine.GSO.4.10.9909111341450.25903-100000@user2.teleport.com>
On Sat, 11 Sep 1999, Collin Starkweather wrote:
> I need to define a subroutine which will not just return, but cause
> its calling subroutine to return as well if an unexpected event occurs
> (e.g., a Tk fileevent).
Perl is indeed a strange language, but it is not _that_ strange. There is
no "pop return stack" operator in Perl.
But it sounds as if you want to use die, and let the caller (at whichever
level) trap that in an eval block.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 11 Sep 1999 13:57:40 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Returning from calling subroutine
Message-Id: <MPG.1244621ee497b3ab98973a@nntp1.ba.best.com>
Tom Phoenix (rootbeer@redcat.com) seems to say...
> On Sat, 11 Sep 1999, Collin Starkweather wrote:
>
> > I need to define a subroutine which will not just return, but cause
> > its calling subroutine to return as well if an unexpected event occurs
> > (e.g., a Tk fileevent).
>
> Perl is indeed a strange language, but it is not _that_ strange. There is
> no "pop return stack" operator in Perl.
This is what I do:
sub outer {
return unless inner();
...
}
I'm curious to know what situation would require you to need what you
are asking??
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Sat, 11 Sep 1999 16:00:40 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
To: Bill Moseley <moseley@best.com>
Subject: Re: Returning from calling subroutine
Message-Id: <37DAD108.563250A9@colorado.edu>
> I'm curious to know what situation would require you to need what you
> are asking??
Here's probably more than you REALLY want to know (but I appreciate your
interest):
I have a perl/tk script that is creating a large number of photos (gifs)
on a canvas as a result of a call to a subroutine.
The photos can take some time to generate.
While the photos are being generated (i.e., a la $canvas->Photo(...)), a
user may close the window that holds the canvas.
When this happens during the execution of the $canvas->Photo(...)
method, the window manager suddenly discovers that the canvas it is
working with has disappeared and dies with a message your average GUI
user would find entirely cryptic.
Thus, I have to find some way of making $canvas->Photo(...) give up the
ghost gracefully when $canvas is unexpectedly yanked.
Surely this is the kind of thing that someone has had to accomodate
before, as your average GUI doesn't suffer seizures when a child widget
is destroyed unexpectedly.
-Collin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather (303) 492-4784
University of Colorado collin.starkweather@colorado.edu
Department of Economics http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bill Moseley wrote:
>
> Tom Phoenix (rootbeer@redcat.com) seems to say...
> > On Sat, 11 Sep 1999, Collin Starkweather wrote:
> >
> > > I need to define a subroutine which will not just return, but cause
> > > its calling subroutine to return as well if an unexpected event occurs
> > > (e.g., a Tk fileevent).
> >
> > Perl is indeed a strange language, but it is not _that_ strange. There is
> > no "pop return stack" operator in Perl.
>
> This is what I do:
>
> sub outer {
> return unless inner();
> ...
> }
>
> I'm curious to know what situation would require you to need what you
> are asking??
>
> --
> Bill Moseley mailto:moseley@best.com
> pls note the one line sig, not counting this one.
------------------------------
Date: Sat, 11 Sep 1999 17:41:03 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Review of Object Oriented Perl by Damian Conway
Message-Id: <37DACBDC.6DBC94A8@chaos.wustl.edu>
Larry Rosler wrote:
> > is an excellent introduction to OO using Perl.
>
> Undoubtedly. But your gratuitous posting of the review together with
> the URL above, designed to get someone a commission on being clicked, is
> in extraordinarily bad taste.
Tell me Larry, what part of this newsgroup _is_ in good taste? Who cares
if the dude makes $0.05 per click? He did the review...so one might
construe that as being 'value added'.
Despite the crankies, Damian's book is quite excellent. The only thing I
don't like about it is the choice of type. Content is inarguably great.
e.
------------------------------
Date: Sat, 11 Sep 1999 17:02:10 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: s/// problem
Message-Id: <7rejhh$m29$1@fir.prod.itd.earthlink.net>
First off, please don't scream at me for being a sorta newbie or not being
super-de-duperee descriptive, I have been pushed away from this group due to
previous rudeness by the members (no offense), but need help on this, so am
trying once again to get help.
Ok, I made a homepage community script, and as part of it, the script adds
banner code to certain files. The banner code is set as:
--code--
$advert = "<SCRIPT LANGUAGE=\"javascript\">\n<!--\nwindow.open('$adurl',
'_pj_ad', 'width=515,height=125');\n//-->\n</SCRIPT>";
--end code--
Then it is added to html documents as such (from various areas of coding
which work together):
--code--
open(FILE,"$in{'loc'}\\$in{'current'}"); #opens document... i will add error
coding, but i know it opens
@file = <FILE>; #stores file to var
close FILE; #closes file
push(@file, ("\n","$advert")); #adds the ad to the file
open(FILE,">$in{'loc'}\\$in{'current'}"); #opens document... i will add
error coding, but i know it opens
print FILE @file; #stores var to file
close FILE; #closes file
--end code --
Then when trying to remove it, the file is opened just as it originally was
above and closed like above, but instead of the push is the following code
to remove the ad:
--code--
$number = "0"; #sets $number to 0
foreach $each (@file) { #puts each line of file through the block
$each =~ s/$advert//g; #should search for the advertising in the
line, but never finds it
$file[$number] = $each; #puts the edited $each back into the file
$number++; #incremements which line script is working on
}
--end code--
This code is supposed to remove the exact same code that it put in earlier,
this is so that i can show the page to users without them having to see the
banner code. Can anyone see what is happening that is making this not work?
Thanks in advance. (If you need any further info, please ask)
-Blair Heuer
------------------------------
Date: Sat, 11 Sep 1999 16:23:07 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
To: Blair Heuer <ab@cd.com>
Subject: Re: s/// problem
Message-Id: <37DAD64B.45E66255@colorado.edu>
I'm guessing this has driven more than one newbie mad.
The $advert in the regex is treated as a pattern.
Thus
$pattern = ".";
print "Found pattern $pattern!" if $string =~ /$pattern/;
will match any string with at least one character.
If you only want to match strings with a dot in them, use
$pattern = "\\.";
print "Found pattern $pattern!" if $string =~ /$pattern/;
So change your code as follows:
# Take out the \n - it just confuses things - and put
# $advert all on one line
$advert = <<"eop";
<SCRIPT LANGUAGE="javascript"><!--window.open('$adurl','_pj_ad',
'width=515,height=125');//--></SCRIPT>
eop
# Make all nonword characters literals in $advert
my $pattern = $advert;
$pattern =~ s/(\W)/\\\1/g;
$number = "0"; #sets $number to 0
foreach $each (@file) { #puts each line of file through the block
$each =~ s/$pattern//g; #now the advertising is found
$file[$number] = $each; #puts the edited $each back into the
file
$number++; #incremements which line script is working on
}
You could also replace the foreach with a
@file = grep !/$pattern/, @file;
Hope this helps.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather (303) 492-4784
University of Colorado collin.starkweather@colorado.edu
Department of Economics http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Blair Heuer wrote:
>
> First off, please don't scream at me for being a sorta newbie or not being
> super-de-duperee descriptive, I have been pushed away from this group due to
> previous rudeness by the members (no offense), but need help on this, so am
> trying once again to get help.
>
> Ok, I made a homepage community script, and as part of it, the script adds
> banner code to certain files. The banner code is set as:
>
> --code--
>
> $advert = "<SCRIPT LANGUAGE=\"javascript\">\n<!--\nwindow.open('$adurl',
> '_pj_ad', 'width=515,height=125');\n//-->\n</SCRIPT>";
>
> --end code--
>
> Then it is added to html documents as such (from various areas of coding
> which work together):
>
> --code--
>
> open(FILE,"$in{'loc'}\\$in{'current'}"); #opens document... i will add error
> coding, but i know it opens
> @file = <FILE>; #stores file to var
> close FILE; #closes file
>
> push(@file, ("\n","$advert")); #adds the ad to the file
>
> open(FILE,">$in{'loc'}\\$in{'current'}"); #opens document... i will add
> error coding, but i know it opens
> print FILE @file; #stores var to file
> close FILE; #closes file
>
> --end code --
>
> Then when trying to remove it, the file is opened just as it originally was
> above and closed like above, but instead of the push is the following code
> to remove the ad:
>
> --code--
>
> $number = "0"; #sets $number to 0
> foreach $each (@file) { #puts each line of file through the block
> $each =~ s/$advert//g; #should search for the advertising in the
> line, but never finds it
> $file[$number] = $each; #puts the edited $each back into the file
> $number++; #incremements which line script is working on
> }
>
> --end code--
>
> This code is supposed to remove the exact same code that it put in earlier,
> this is so that i can show the page to users without them having to see the
> banner code. Can anyone see what is happening that is making this not work?
> Thanks in advance. (If you need any further info, please ask)
>
> -Blair Heuer
------------------------------
Date: Sat, 11 Sep 1999 15:55:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: s/// problem
Message-Id: <Pine.GSO.4.10.9909111551590.25903-100000@user2.teleport.com>
On Sat, 11 Sep 1999, Blair Heuer wrote:
> $advert = "<SCRIPT LANGUAGE=\"javascript\">\n<!--\nwindow.open('$adurl',
> '_pj_ad', 'width=515,height=125');\n//-->\n</SCRIPT>";
> open(FILE,"$in{'loc'}\\$in{'current'}"); #opens document... i will add error
> coding, but i know it opens
Will you also add security at a later date? Security and error checking
aren't luxuries on a wish list; it's no cheaper to add them later. Quite
the opposite, in fact.
> $each =~ s/$advert//g; #should search for the advertising in the
> line, but never finds it
You are using $advert as if it were a regular expression. Is it? I don't
think it is the pattern you think it is.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 11 Sep 1999 20:50:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: UNCRAP project proposal
Message-Id: <7refam$sp$1@gellyfish.btinternet.com>
On 11 Sep 1999 10:44:30 -0700 Randal L. Schwartz wrote:
>>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
>
> Uri> the basic needs of the search engine is to search for some keywords in a
> Uri> set of directory trees. it returns the file names of hits in a nice
> Uri> htmlish way. here are some of the design rules:
>
> You could certainly start with my search engine from WT, which
> does much of what you ask already. See
>
> http://www.stonehenge.com/merlyn/WebTechniques/
>
Oh you just gone spoiled Uri's fun :)
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 11 Sep 1999 17:08:27 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: UNCRAP project proposal
Message-Id: <37DAC439.AE37A56C@chaos.wustl.edu>
Abigail wrote:
> XML is just for wussies who are afraid of SGML. XML isn't a magic wand.
> But it's being hyped more than Java.
I'm glad someone, especially you, say this. I'm not a document jockey
and like my LaTex and such just fine, but I've heard _so_ much about XML
it puts me off of the idea of even having a look.
> I don't know about my programs. But I do know it's very likely that HTML
> will be around in 20 years.
Just out of curiosity, do you have something you could cite that
documents the original purpose and proposed longevity of HTML? I'll have
a go at the W3 page when I get a chance, but I know that you have far
more experience with HTML than I and might know of some goodies that I
do not.
e.
------------------------------
Date: 11 Sep 1999 20:59:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Will an apology end this mess?
Message-Id: <7refs0$su$1@gellyfish.btinternet.com>
On Sat, 11 Sep 1999 13:16:06 GMT C D wrote:
> Id Est wrote:
>>
>> geez kid, show some backbone. who gives a rats ass if Abigoon doesn't like
>> you? he/she/it and his/her/its defenders are arrogant bullies who think
>> they're above the rest of us. who cares? f*ck 'em and killfile 'em.
>> you can learn perl quite well without their "help".
> Exactly!
Cool, I get to kill-file two dick-heads for the price of one.
*plonk* *plonk*
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
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 766
*************************************