[17532] in Perl-Users-Digest
Perl-Users Digest, Issue: 4952 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 22 18:09:34 2000
Date: Wed, 22 Nov 2000 15:05:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <974934319-v9-i4952@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 22 Nov 2000 Volume: 9 Number: 4952
Today's topics:
Re: Accessing NT shares from UNIX - Remote Invocation ? (Martien Verbruggen)
Re: Binding Variables and DBI (Honza Pazdziora)
Catching a pop-up dialog? <orret@wmn.net>
Re: CGI in a table (Honza Pazdziora)
ETRADE login script problem <douglas@home.com>
Re: Executing own module as root? (Martien Verbruggen)
Re: how do I merge blocks of text from different lines? (Honza Pazdziora)
Re: how do I merge blocks of text from different lines? <-@-.com>
Re: How do I read line by line of data from a file usin <kip@skiltrip.com>
Re: How to Install Crypt::SSLeay on Remote Host? (Honza Pazdziora)
Re: I need to create proegrma like iescrow.com (Chris Fedde)
Re: I need to create proegrma like iescrow.com <xzrgpnys@yvtugubhfrovm.pbz>
I'm confused <replynews@bigfoot.com>
Re: I'm confused <uri@sysarch.com>
Re: I'm confused <mjcarman@home.com>
Re: looking for PERL GUI debugger for UNIX (Chris Fedde)
Re: looking for PERL GUI debugger for UNIX (Ilya Zakharevich)
Re: Most easy way to get IP from a local NIC by device <nospam.newton@gmx.li>
Multiprocesser kernel threads in Perl 5.6?? <jmessrie@telcordia.com>
Re: need some help with regex <bart.lateur@skynet.be>
Re: OT:Re: Eurodate mysteries (Martien Verbruggen)
Re: Perl and Netscape's history.dat (Garry Williams)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Nov 2000 22:33:55 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Accessing NT shares from UNIX - Remote Invocation ?
Message-Id: <slrn91oibj.r2.mgjv@verbruggen.comdyn.com.au>
On Wed, 22 Nov 2000 11:05:00 -0000,
Clyde Ingram <cingram-at-pjocs-dot-demon-dot-co-dot-uk> wrote:
>
> 1. An rsh daemon running on NT: is there such a daemon? is this a security
> loophole?
Yes, rsh daemons are available. Exceed comes with one. I don't know
how good it is. I don't use it. In general I have given up on making
any of the NT machines here to behave more, err..., let's say
cooperatively.
IMO having NT at all is a security risk :).
Then of course, rsh doesn't pass back any success or error codes
anyway, so you'd have to write a wrapper that outputs stuff on stdout
and parse that at the invoking end.
A telnet daemon with Net::Telnet would be ok as well, I guess.
> 2. Sockets: I guess shed-loads of development effort of specific
> client-server pairs. I'd prefer something generic like option 1 above.
I would probably do this. It's not that hard to write a very simple
daemon that executes scripts for you. What is hard is to make it
secure, and have some sort of authentication mechanism that you can
trust. But at least you'd have full control over the code. Unless you
can find an open source rsh or telnet daemon, I'd be hard pressed to
trust them, if security is an issue. Perl, together with its multitude
of Win32 plugin modules probably would make the job easy enough.
> 3. RMI: a colleague suggested Java Remote Method Invocation - tho' we don't
> know much about it, and I'd rather avoid the problems of interfacing Perl to
> Java if possible.
Euhmmm.. RMI works in a different way. You could do it, but it's
almost impossible to make it secure. Maybe there are wrappers out
there that can help you. I tend to avoid java for system interaction.
It's really bad at it. you'd probably need to work with weird and
obscure sandboxes and security managers and all that oddness that the
Java API developers came up with.
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message
> news:slrn91jth0.r2.mgjv@verbruggen.comdyn.com.au...
>> However, there's samba out there, and on some platforms it can
>> actually mount (via smbfs) SMB drives.
>
> We use Samba, but I guess that's not going to help with remote invocation.
Nope. It isn't. traditionally the win32 platforms have been single
user platforms. Remote access to those machines has just never been
needed. If you're used to multi-user platforms, that 'feature' is very
annoying and frustrating.
Martien
--
Martien Verbruggen |
Interactive Media Division | I used to have a Heisenbergmobile.
Commercial Dynamics Pty. Ltd. | Every time I looked at the
NSW, Australia | speedometer, I got lost.
------------------------------
Date: Wed, 22 Nov 2000 17:37:30 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Binding Variables and DBI
Message-Id: <G4FsyI.8oA@news.muni.cz>
On Wed, 22 Nov 2000 08:57:50 -0800, Jeff Zucker <jeff@vpservices.com> wrote:
>
> Or, to make it totally generic and not have to care about how many
> elements there are in the arrray (as long as some other part of the
> script knows how many columns can be used for that particular database
> and procedure):
>
> my $param_str = (join ',', ('?') x scalar @param_array);
> my $sql = qq/BEGIN PROCEDURE_NAME ($param_str); end;/
> $dbh->do( $sql, {}, @param_array);
With procedure calls, you usually want to be pretty sure how many
parameters you give it (with the exception of default parameters --
but even then you don't want it to be completely random).
But your example is very helpfull for
$dbh->do("select field from table where id in ($param_str)",
{}, @param_array);
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Wed, 22 Nov 2000 12:35:46 -0800
From: "Lourdes Orret" <orret@wmn.net>
Subject: Catching a pop-up dialog?
Message-Id: <8vhamp$k7f$1@madmax.keyway.net>
Hello
Platform: Infamous Windows NT or Windows 2000
Problem: I have an application running (actually is Dr. Watson) that
sometimes pop-up
dialogs with information about system or resources warnings or problems.
Normally the
dialogs have two buttons YES or NO (Accept or Cancel).
I am trying to find out the way (using PERL) to know when a Dr Watson's
dialog show up, and
send the OK|YES|ACCEPT event, to the dialog, in order to close it.
Suggestions?
Maybe better way to ask: There is a way to have access to the information,
events and data
structure of the window that have the FOCUS on MS-WINDOWS?
Thanks in advance,
Sidney
------------------------------
Date: Wed, 22 Nov 2000 17:25:42 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: CGI in a table
Message-Id: <G4FsEu.E0v@news.muni.cz>
On Wed, 22 Nov 2000 09:47:02 -0600, Jim <jaedma@yahoo.com> wrote:
> I have a perl cgi script (a clock) that I want to put into a table in an
> html page. I cant figure out what code to put the table cell (img...embed
> ect).
You mean you want to use server side include? Ask you web server
administrator how to do it on your site.
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Wed, 22 Nov 2000 21:09:40 GMT
From: Douglas Galbraith <douglas@home.com>
Subject: ETRADE login script problem
Message-Id: <3A1C360E.5CFE0562@home.com>
I'm attempting to write a perl script to logon to Etrade, but I'm stuck
(I had one working until Etrade made some changes recently). Below is a
script that extracts the variables from Etrades login page, adds the
user password and userid, and then tries to login. It fails and I'm not
sure what is wrong.
I'm interested if anyone has any pointers or advice.
Note that you'll have to add your own UserId and Password.
thanks,
DGalbra862@aol.com
use Win32::OLE;
# local variables
my $myname = "<UserId>"; #my userid (add your own)
my $mypass = "<Password>"; #my password (add your own)
my $BROWSER; #make local
my $stat; #make local
my $body; #make local
my $mystring = "junk"; #make local (eliminate warning in loop below)
my @lines1; #make local
my @lines2; #make local
my @lines3; #make local
my $i = 0; #make local
my $myline = ""; #make local
my $name = ""; #make local
my $value = ""; #make local
my $post_string = ""; #initialize the string to be posted
$BROWSER =
Win32::OLE->new('InternetExplorer.Application');
#open the browser
$BROWSER->{'Visible'}=1;
#make it visible
$BROWSER->Navigate("https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+Loginpage");
#get the https cookies from etrade
for($i = 0; $i < 10 && !($mystring =~ m/login_sid/); $i++) # try up to
10 times before giving up
{
do #wait until the first page finishes loading (to get the cookies)
before logging in
{
select(undef,undef,undef,0.1); #sleep 0.1 seconds (finer time
resolution than "sleep" command)
$stat=$BROWSER->{Busy}; #get the status of the browser load
}
while ($stat); #continue looping if the browser is NOT
yet done loading
# get the HTML data for extraction of login_sid
$body=$BROWSER->Document->{body}; #get the hash
string retruned by the browser
$mystring= $body->{innerHTML}; #get the HTML data
from browser
}
# get the variables for the HTML page
$mystring =~ s/>/ /g; #replace all of
the ">" characters in the HTML string with spaces
@lines1 = split /</m, $mystring; #split the lines
in the HTML page at the "<"
@lines2 = grep /[iI][nN][pP][uU][tT]/, @lines1; #grep lines
containing "input" (any mixture of upper and lower case characters)
@lines3 = grep /[nN][aA][mM][eE]/, @lines2; #grep lines
containing "name" (any mixture of upper and lower case characters)
foreach $myline (@lines3) #add the HTML
variables to the string to be posted
{
if(($name) = $myline =~ m|[nN][aA][mM][eE]=(\S+)|) { $post_string
.= "&$name" }; #get name of the variable
if($name =~ m|[uU][sS][eE][rR]|) { $post_string .=
"=$myname&userid=$myname"} #add values of the USER
variables
elsif($name =~ m|[pP][aA][sS][sS][wW][oO][rR][dD]|) { $post_string .=
"=$mypass&password=$mypass"} #add values of the PASSWORD variables
elsif($name =~ m|[lL][oO][gG][oO][nN]|) { $post_string .=
"=1&$name.x=10&$name.y=10"} #add values of the Logon
variables
elsif(($value) = $myline =~ m|[vV][aA][lL][uU][eE]="([^"]+)"|)
{$post_string .= "=\"$value\""} #value quoted? if yes, then keep
quoted
elsif(($value) = $myline =~ m|[vV][aA][lL][uU][eE]=(\S+)|)
{$post_string .= "=$value"}; #value unquoted? if no, then do NOT
keep quoted
}
$post_string .= '&TARGET=/cgi-bin/gx.cgi/applogic+Home?protect'; #add
variable showing where to start
$post_string =~ s/&/?/;
#replace first "&" character with "?" in post string
$BROWSER->Navigate('https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+Loginpage/login.fcc'
. $post_string ); #login
# debug: print out the componants of $post_string
print "\npost_string=$post_string\n\n";
@lines1 = split /&/m, $post_string;
foreach $myline (@lines1) {print "\n$myline\n"};
------------------------------
Date: Wed, 22 Nov 2000 22:07:41 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Executing own module as root?
Message-Id: <slrn91ogqm.r2.mgjv@verbruggen.comdyn.com.au>
On 22 Nov 2000 15:22:02 +0100,
Christian Meisl <meisl@amvt.tu-graz.ac.at> wrote:
> mgjv@tradingpost.com.au (Martien Verbruggen) writes:
>> What is the exact error? What sort of module is this? What C code is
>> this? Is the C code clean? debugged, purified, whatever you normally do
>> to make sure it doesn't leak or cross memory boundaries anywhere? What
>> system calls do you use? Have you tried debugging this to see where that
>> 'memory error' occurs? Tried to fiddle the compiler flags to make the
>> compilation phase as tight and pedantic as possible?
>>
>> Instead of battling the symptoms with brute force, maybe you should
>> concentrate on trying to find the cause.
>
> I'm sorry for being a bit too short in my explanation: I have a
> interface card and a driver that is written in C. As the driver is
> very simple, the following "unirel.xs" seems to be sufficient to
> operate the card:
Ah yes. Interface drivers most often can only be operated by root. For
good reasons.
As I hinted at in my previous post: The only way you can get your
module code to run with root priveleges is if the program that runs it
has root permissions. That happens either when root runs it, or when
you fiddle with setuid bits. Neither, of course, has any relevance to
Perl. You might want to find another post I sent yesterday, in another
thread, to someone who wanted to run things as root for web clients.
The same warnings I gave there apply here.
You probably want to read the perlsec documentation, which talks about
how to do this sort fo stuff safely. But you have to understand that
these permissions are set at the program level, not in some library.
But if at all possible, avoid creating setuid programs everywhere.
Operate the thing as root.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Wed, 22 Nov 2000 17:49:08 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: how do I merge blocks of text from different lines?
Message-Id: <G4FtHw.M69@news.muni.cz>
On Wed, 22 Nov 2000 17:01:42 -0800, Mauro <-@-.com> wrote:
> ________input is____
> [1]|some text
> [2]|I've an apple
> [3]|I eat the apple
>
> separatortag
>
> 1. HALLO
> 2. HI
> 3. FOOBAR
>
> _______output must be_____
> HALLO|some text
> HI|I've an apple
> FOOBAR|I eat the apple
>
> do you know the way to do that?
use strict;
my (@nums, @texts, %convert);
while (<>) {
last if /^separatortag$/;
if (my ($num, $text) = /^\[(\d+)\]\|(.*)/s) {
push @nums, $num;
push @texts, $text;
}
}
while (<>) {
if (my ($num, $text) = /^(\d+)\.\s*(.*)/) {
$convert{$num} = $text;
}
}
for (@texts) {
my $num = shift @nums;
print $convert{$num}, '|', $_;
}
__END__
[ PS: comp.unix.programmer,comp.lang.awk and comp.unix.shell
stripped. ]
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Wed, 22 Nov 2000 22:16:44 -0800
From: "Mauro" <-@-.com>
Subject: Re: how do I merge blocks of text from different lines?
Message-Id: <8vhd2e$k14$1@nslave3.tin.it>
thanksssssssssssssss Honza, you saved my life :) I envy your perl skills..
I love perl too much!
> use strict;
> my (@nums, @texts, %convert);
> while (<>) {
> last if /^separatortag$/;
> if (my ($num, $text) = /^\[(\d+)\]\|(.*)/s) {
> push @nums, $num;
> push @texts, $text;
> }
> }
> while (<>) {
> if (my ($num, $text) = /^(\d+)\.\s*(.*)/) {
> $convert{$num} = $text;
> }
> }
> for (@texts) {
> my $num = shift @nums;
> print $convert{$num}, '|', $_;
> }
> __END__
------------------------------
Date: Wed, 22 Nov 2000 17:51:17 -0500
From: "Kip" <kip@skiltrip.com>
Subject: Re: How do I read line by line of data from a file using perl
Message-Id: <8vhijk$vg$1@news.warwick.net>
# first you need to open a filehandle to the file...
open (DB, "yourfilenamehere");
while(<DB>) { # while there are still lines in your file, (it
will read one at a time)
print $_; # $_ represents each line as it's read, so
do whatever you want to $_
}
close(DB); # close your filehandle
# hope this helps!
------------------------------
Date: Wed, 22 Nov 2000 17:52:01 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How to Install Crypt::SSLeay on Remote Host?
Message-Id: <G4FtMp.16q@news.muni.cz>
On Wed, 22 Nov 2000 17:28:43 GMT, horace700@my-deja.com <horace700@my-deja.com> wrote:
> I'd like to use LWP to retrieve a secure page from my Hypermart
> account. Presently I get a 501 error & modlist.pl says crypt::ssleay is
> not installed. I understand that so long as module does not require
> compilation, one can upload module in user directory. The only changes
I bet Crypt::SSLeay needs compiling.
> I'm told would be to create appropriate use's & require's to the
> script. Basically I've got 3 questions?
> 1. Can Crypt::SSLeay be successfully installed in a remote user
> directory?
What's remote directory? Your user (non system) directory? Yes.
> 2. Would I just add "use /path/to/Crypt::SSLeay" to script?
The syntax is
use lib '/path/to';
use Crypt::SSLeay;
> 3. Exactly what "require" (or do I even need a require call?) call do I
> need.
To do what, HTTPS request? Just issue the request with correct URL.
Yours,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------
------------------------------
Date: Wed, 22 Nov 2000 19:29:49 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: I need to create proegrma like iescrow.com
Message-Id: <N8VS5.9$QX6.171074560@news.frii.net>
In article <8vh2kf$2o0k$1@taidint.taide.lt>, Dario <dario@kateka.lt> wrote:
>I need to create proegrma like iescrow.com
>
>
Cool! Let us know how it goes.
chris
--
This space intentionally left blank
------------------------------
Date: 22 Nov 2000 21:28:43 GMT
From: kevin metcalf <xzrgpnys@yvtugubhfrovm.pbz>
Subject: Re: I need to create proegrma like iescrow.com
Message-Id: <3A1C3B14.626855E4@yvtugubhfrovm.pbz>
Dario wrote:
> I need to create proegrma like iescrow.com
I need a vegimatic. I need a pocket fisherman. I need a handy
appliance that will scramble an egg while it's still inside its shell!
etc... etc... etc...
--
email: xzrgpnys@yvtugubhfrovm.pbz
Huh? http://www.flactem.com/utils/rot13.html
------------------------------
Date: Wed, 22 Nov 2000 22:44:24 +0100
From: "Ralf Siedow" <replynews@bigfoot.com>
Subject: I'm confused
Message-Id: <8vhenk$4bj4p$1@ID-23826.news.dfncis.de>
Hello,
I'm just mangling the following trainig course at
http://www.bjnet.edu.cn/tech/book/perl/ch18.htm
They have an exercise at the end of the chapter that confuses me a little
bit:
Why is $b not being set in the following line of code? What do you have to
do to make it okay?
sub xxx {
my ($a, $b) = @_;
}
Answer:
Make the line
my($a,$b)
look like this:
my (\$a,\$b)
Then use @$a and @$b to access these arrays by reference.
I just wrote an example according to the excercise and it works perfectly:
#!/usr/bin/perl
use strict;
my @test = ('1', '2', '3');
&test(@test);
sub test
{
my ($a, $b) = @_;
print "a=$a;b=$b";
}
cu Ralf
------------------------------
Date: Wed, 22 Nov 2000 22:26:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: I'm confused
Message-Id: <x7n1erd4or.fsf@home.sysarch.com>
>>>>> "RS" == Ralf Siedow <replynews@bigfoot.com> writes:
RS> I'm just mangling the following trainig course at
RS> http://www.bjnet.edu.cn/tech/book/perl/ch18.htm
eewwww!!! i just took a gander at that site and i am barfing chunks. it
is garbage perl teaching and i highly recommend you (and all others)
stay away from it. the code is wrong in many cases and the formatting
(in particular close braces) is horrifying.
and i just realized this is teach yourself perl in 21 days and probably
a bootleg site (from china, what else is new). so this is double wrong,
a pirate of a bad book. no wonder i was sick after looking at it.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 22 Nov 2000 22:52:59 GMT
From: Michael Carman <mjcarman@home.com>
Subject: Re: I'm confused
Message-Id: <3A1C4FB0.7010701@home.com>
Ralf Siedow wrote:
>
> I'm just mangling the following trainig course at
> http://www.bjnet.edu.cn/tech/book/perl/ch18.htm
I've no idea whether or not this is a good course, but my gut tells me
no...
> They have an exercise at the end of the chapter that confuses me a
> little bit:
> Why is $b not being set in the following line of code? What do you
> have to do to make it okay?
> sub xxx {
> my ($a, $b) = @_;
> }
Without context (how it's called) the question is pointless. The only
*real* reason for $b to not be set is if @_ contains less than two
elements.
> Answer:
> Make the line
> my($a,$b)
> look like this:
> my (\$a,\$b)
> Then use @$a and @$b to access these arrays by reference.
I think you misread... if they actually wrote what you have above, get
the hell away from the site and never look back. my (\$a, \$b) isn't
valid syntax.
Okay, I looked, and (thank heavens) that's not what they said. What they
did say is 'mysub(\@one, \@two)' which is the correct way to pass
multiple arrays to a sub if you need to keep them seperate. However,
this is given as the answer to a different question. Maybe it's what
they want for the one you're having trouble with, maybe not. As I said,
the only real reason that $b wouldn't get set would be if @_ contained
less than two elements, which would only happen if you called xxx()
without enough arguments.
-mjc
------------------------------
Date: Wed, 22 Nov 2000 19:13:14 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: looking for PERL GUI debugger for UNIX
Message-Id: <eVUS5.8$QX6.135468544@news.frii.net>
In article <jfSS5.5$QX6.170913792@news.frii.net>,
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>>
>> The minimum is to highlight the current line, of course...
>>
> Obviously.
Following up on my own posts might be bad form but sometiimes you just
have to go with what feels good...
I've spent a few minutes resurecting my old debug file follower.
the shar file below has two scripts in it. One is the source file viewer
The other is a simple canned cat command line.
I use it as follows:
- start two xterms in your development directory
- In the first xterm run ./perl_db_display
- in the second one start the perl debugger as follows:
env PERLDB_OPTS="LineInfo=|./catit" perl -d testprog
With luck the first xterm will have a display of testprog while
the second xterm will have the perl debugger command line running
in it. The two communicate over a fifo in the current working
directory. It's a bit bute force, I need to work on the display
esthetics a bit and figure out a way to get breakpoints into the
display but it's a start. Let me know what you think.
chris
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# perl_db_display
# catit
#
echo x - perl_db_display
sed 's/^X//' >perl_db_display << 'END-of-perl_db_display'
X#!/usr/bin/perl -w
X#
X# Display a file using curses
X# Standard input looks like strings from perl -d
X# with option "0 LineInfo=|perl_db_display"
X#
X
Xuse strict;
Xuse Curses;
X
X$SIG{__DIE__} = sub { endwin; };
X
Xsystem ('/usr/bin/mkfifo', 'fifo');
Xopen('fifo', 'fifo') or die "can't open fifo for data from debugger";
X
Xinitscr();
X
Xwhile (1) {
X while (<fifo>) {
X chomp;
X
X # main::(testprog:6): for (1..1000) {
X # ^^^^^^^ ^
X # file line
X #
X my ($file, $line) = /\((\w+):(\d+)\)/;
X next unless (defined $file and -f $file);
X display ($file, $line);
X }
X}
X
Xsub display {
X my ($file, $line) = @_;
X my ($maxy, $maxx);
X
X unless (open(F, $file))
X {
X cantopen($file);
X return 1;
X }
X
X my @file = <F>;
X getmaxyx($maxy, $maxx);
X my $center = int($maxy/2);
X
X my $top;
X my $bottom;
X if ($line - $center < 0){ #
X $top = 0;
X } else {
X $top = $line - $center;
X }
X
X if ($#file < $maxy) {
X $bottom = $#file;
X } else {
X $bottom = $line+$center;
X }
X
X clear();
X move(0,0);
X for my $l ($top .. $bottom) {
X addstr (sprintf("%6d %s %s", $l+1,
X ($l+1 == $line)?"=>":" ", $file[$l]));
X }
X
X refresh;
X
X}
X
Xsub cantopen
X{
X my $file = shift;
X
X my ($maxy, $maxx);
X getmaxyx($maxy, $maxx);
X
X my $cline = int($maxy/2);
X clear();
X move($cline, 0);
X addstr("can't open $file");
X refresh;
X return 1;
X}
END-of-perl_db_display
echo x - catit
sed 's/^X//' >catit << 'END-of-catit'
X#!/bin/sh
Xcat -u >> fifo
END-of-catit
exit
--
This space intentionally left blank
------------------------------
Date: 22 Nov 2000 20:29:12 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: looking for PERL GUI debugger for UNIX
Message-Id: <8vhaao$q7h$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@fedde.littleton.co.us>],
who wrote in article <jfSS5.5$QX6.170913792@news.frii.net>:
> The slave vi mode that TomC built was what prompted me to use a
> simpler passive screen. All that was needed was to position the
> current line in the window and mark it.
Do not think this is enough. IMO Up/Down/PgUp/PgDn/Home/End/Search
are included in the "minimal" interface.
Ilya
------------------------------
Date: Wed, 22 Nov 2000 20:36:02 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Most easy way to get IP from a local NIC by device name (eth0,eth1...)
Message-Id: <f55o1tkrf5d4uorh7tksapvqs7bu3ddd3h@4ax.com>
On Wed, 22 Nov 2000 01:49:57 GMT, mgjv@tradingpost.com.au (Martien Verbruggen)
wrote:
> Of course, you have to wrap anything in a sub anyway, and test for the
> platform you're on. You're free to use ifconfig where appropriate,
> netstat where that works, and anything else for the others (ipconfig
> for NT?)
Probably. And, theoretically, winipcfg on Win 9x, though it'll probably be tough
parsing stuff out of a GUI with Perl.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 22 Nov 2000 15:36:14 -0500
From: James Messrie <jmessrie@telcordia.com>
Subject: Multiprocesser kernel threads in Perl 5.6??
Message-Id: <3A1C2E3E.5C84E501@telcordia.com>
How can I take advantage of a 4 processor Sun box using Perl 5.6? I
spawn four threads. Each thread goes through a loop and creates an
object of one of my modules on each iteration. It seems like only one
thread works at a time and only one CPU is doing the work. The thread
that is working is never preempted unless a yield is called. I am
running on Solaris 7. Thanks.
James
jmessrie@telcordia.com
------------------------------
Date: Wed, 22 Nov 2000 19:39:42 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: need some help with regex
Message-Id: <k78o1tkjop18k9k08igmggsnch57f0ml2t@4ax.com>
metamp@my-deja.com wrote:
>if ($query->param('texfield_name') != /[^a-zA-Z]/)
>{
>print "result a no ilegal characters";
You've taken the wrong operator. You want !~ not != (which does
numerical comparisons).
--
Bart.
------------------------------
Date: Wed, 22 Nov 2000 22:17:09 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: OT:Re: Eurodate mysteries
Message-Id: <slrn91ohce.r2.mgjv@verbruggen.comdyn.com.au>
On Wed, 22 Nov 2000 08:07:47 -0500,
Tad McClellan <tadmc@metronet.com> wrote:
> On Wed, 22 Nov 2000 22:37:08 +1100, Martien Verbruggen
> <mgjv@tradingpost.com.au> wrote:
>
>>it's obvious that that's wrong.
>
> [ herein we manage to drift back on-topic...]
>
> I am amazed that a Perler would have such a non-TMTOWTDI attitude:
TMTOWTDI, but there's often only one way that follows the True Path,
and arrives at the Right Solution. Code indentation is another one of
those issues. So are the spelling of PERL, the way to quote text in a
Usenet article, the operating system one works on, date formatting,
binary vs. text file formats, pipes vs SYSV IPC, Object Oriented
Programming vs procedural or functional programming, OO on its own,
whether to sit in a window ir aisle seat, to eat your pizza crust
first, or the issue of which OSes can be called Unix.
Should I mention Hitler now?
> Freedom rulz!
Sure, you can break your eggs any way you want. But you won't ever
convince me to break them the Wrong Way!
Martien
--
Martien Verbruggen |
Interactive Media Division | The four horsemen of the apocalypse
Commercial Dynamics Pty. Ltd. | are called Abort, Retry, Ignore and
NSW, Australia | Fail.
------------------------------
Date: Wed, 22 Nov 2000 22:47:45 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Perl and Netscape's history.dat
Message-Id: <l2YS5.1368$xb1.86805@eagle.america.net>
On Wed, 22 Nov 2000 16:15:59 +0100, Josef Moellers
<josef.moellers@fujitsu-siemens.com> wrote:
>I use Perl (5.0 patchlevel 5 subversion 3) on a SuSE6.3 system running
>NetscapeŽ Communicator 4.7
>
>I'm trying to extract the history from the history.dat file with a
>script from the camel book:
>
> #! /usr/bin/perl
>
> use DB_File;
>
> $filename = "$ENV{HOME}/.netscape/history.dat";
> print "Opening $filename\n";
> dbmopen(%NS_Hist, "$filename", undef)
> or die "Can't open netscape history file: $!";
>
> while (($url, $when) = each %NS_Hist) {
> next unless defined($when);
> chop($url, $when);
> $w = scalar(localtime(unpack("V", $when)));
> print "$w: $url\n";
> }
>
> dbmclose(%NS_Hist);
> exit(0);
>
>Unfortunately it prints the error message
> Can't open netscape history file: at /home/josef/bin/nshist line 11.
>and dies.
>
>The strace output shows that it opens the history.dat file twice, each
>time reading a couple of bytes. I've tried replacing the DB_File by any
>one of the other *DBM_File modules to no avail. I also used the "tie"
>syntax to no avail.
>
>What's happening?
I have observed the same behavior. I can duplicate it by creating a
Berkeley DB file with the Berkeley `makemap' program and then
attempting to tie() it in a Perl program. I ran into this some time
ago when I was initializing maps for sendmail using makemap. I just
worked around the problem by creating the maps with a Perl script
instead of using makemap.
Here's a small procedure to reproduce the error (it requires the
"sendmail" makemap utility):
$ cat map
key1 val1
key2 val2
$ makemap hash map < map
$ cat dump_map
#!/usr/local/bin/perl -w
use strict;
use DB_File;
my %db;
my $key;
my $val;
my $file = shift;
tie(%db, 'DB_File', $file, O_RDONLY, 0, $DB_HASH)
|| die "$0: can't open $file: $!\n";
while ( ($key, $val) = each(%db) ) {
print "key=$key\tval=$val\n";
}
untie(%db);
exit(0);
$ perl dump_map map.db
dump_map: can't open map.db:
$
If the database file is created with Perl and DB_File, then everything
works as expected. This *looks* like a problem with DB_File. I point
out that sendmail has no problem accessing the maps created by
makemap. I also note that I can reproduce the original poster's
problem (the Netscape history file) on my Solaris workstation.
Here's the relevant part of my truss output:
...
open64("./map.db", O_RDONLY) = 3
fcntl(3, F_SETFD, 0x00000001) = 0
fstat64(3, 0xFFBEF210) = 0
llseek(3, 0, SEEK_SET) = 0
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0".., 256) = 256
close(3) = 0
dump_map: can't open map.db:
write(2, " d u m p _ m a p : c a".., 30) = 30
getcontext(0xFFBEF5B8)
setcontext(0xFFBEF5B8)
llseek(0, 0, SEEK_CUR) = 6838861
_exit(255)
$
--
Garry Williams
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 4952
**************************************