[7045] in Perl-Users-Digest
Perl-Users Digest, Issue: 670 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 26 18:07:59 1997
Date: Thu, 26 Jun 97 15:00:27 -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 Thu, 26 Jun 1997 Volume: 8 Number: 670
Today's topics:
5.004 CORE DUMP, BUG? maximum length of $1? <mthurn@irnet.rest.tasc.com>
Bad Filenames <jch11@airmail.net>
Re: Call 'lynx' with Perl <aas@bergen.sn.no>
Re: Call 'lynx' with Perl <rootbeer@teleport.com>
Re: Call 'lynx' with Perl <zenin@best.com>
Re: Call 'lynx' with Perl (Tung-chiang Yang)
Re: Can I call "http://www... in perl? (Matthew Mac Gibbon)
Checkout Perlchat <labah@algonet.se>
Re: Checkout Perlchat <labah@algonet.se>
Re: Client-Side Execution (Nathan V. Patwardhan)
Event Log Reporting - Doesn't Work <Frank.Huddleston@guardian.brooks.af.mil>
find.pl Problem (Brent Johnson)
flock problems <chrisps@bc.sympatico.ca>
Re: GIFgraph.pm or finance scripts <zenin@best.com>
How to determine "()" at compile time? <dwc3q@mamba.cs.Virginia.EDU>
Re: How to get browser window size? ( Tina Marie Holmboe )
O'Reilly: Advanced Perl Programming (Steve Abatangle)
problem running a C shell program in PERL.. <scoler@earthlink.net>
Re: Regexp with exclusion <danboo@ixl.com>
Re: Regexp with exclusion (Tung-chiang Yang)
Script Fake a browser? <labah@algonet.se>
Re: Script Fake a browser? (Nathan V. Patwardhan)
Software Development Web Guides Wanted <richard@icsn.com>
Re: Sorry another regex question - parsing HTML anchors ( Tina Marie Holmboe )
Re: Source code comparison - know of a tool? <rootbeer@teleport.com>
Re: Substitute ^M by HTML <br> code... (Tung-chiang Yang)
Re: Substitute ^M by HTML <br> code... (brian d foy)
Re: Substitute ^M by HTML <br> code... (brian d foy)
Telnet in the web... <serginho@alpha.hydra.com.br>
Re: Telnet in the web... (Nathan V. Patwardhan)
Re: telnet port 80 get & measge (Nathan V. Patwardhan)
Re: telnet port 80 get & measge <rootbeer@teleport.com>
Re: What does "UNIX" stand for.. (Kaz Kylheku)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Jun 1997 16:48:58 -0400
From: Kingpin <mthurn@irnet.rest.tasc.com>
Subject: 5.004 CORE DUMP, BUG? maximum length of $1?
Message-Id: <eud8p9ay4l.fsf_-_@irnet.rest.tasc.com>
#!/usr/local/bin/perl -w
=message
The following program demonstrates what I believe is a bug in perl
5.004. If the pattern /^((.|\n)*)/m is applied to a string longer
than 26201 characters, perl dumps core. On the other hand, the
pattern /^([\s\S]*)/m works fine for longer strings. Just feed it any
text file longer than 26201 characters to get a core dump.
Attached below is my perl -V, in case that matters.
=cut
$/ = 'XXXZZZXXX'; # Suck all the data at once
$_ = <>;
/^([\s\S]*)/m; # should match the whole input
$body = $1;
print "length(body) after [\\s\\S]* trick = ", length($body), "\n";
/^((.|\n)*)/m; # should match the whole input
$body = $1;
print "length(body) after (.|\\n)* trick= ", length($body), "\n";
__END__
Summary of my perl5 (5.0 patchlevel 4 subversion 0) configuration:
Platform:
osname=solaris, osvers=2.5.1, archname=sun4-solaris
uname='sunos copper 5.5.1 generic sun4u sparc sunw,ultra-2 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio= d_sfio=
Compiler:
cc='gcc', optimize='-O', gccversion=2.7.2.1
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at May 29 1997 10:48:46
%ENV:
PERL5LIB="/fs81/TIR/lib/perl5"
@INC:
/fs81/TIR/lib/perl5
/usr/local/lib/perl5/sun4-solaris/5.004
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/sun4-solaris
.
--
- - Martin "Kingpin" Thurn mthurn@tasc.com
Research Software Engineer (703) 834-5000 x2926
The Information Refinery http://tir.tasc.com
TASC, Inc. http://www.tasc.com
------------------------------
Date: 26 Jun 1997 18:57:14 GMT
From: "Justin Henry" <jch11@airmail.net>
Subject: Bad Filenames
Message-Id: <9781739527F02AAD.8B8E262463A442DF.C76F3AC4313C31E4@library-proxy.airnews.net>
Ok, I've been looking at this all day and I am stumped. Maybe some of you
more advanced Perleese can see what I'm overlooking. I have this script
that opens a text file which is a listing of C header files, one per line
(example.h) I then have the Filehandle HEADERS that is supposed to open the
file and search for structs (which are data structures in case ya don't use
c). ANYway... I can't get this script to open the header files by using
$list_line. Everything else works ok ( I know it's not complete). Thanks
for any help you cna give. Here it is
#! /usr/....
$textfile="gahead.txt"; # the text file containing the
list of header files
$pagename="QueueList.c"; # the program I end up writing to (not
important yet)
open(LIST,"textfile") || die $!;
@list = <LIST>;
open(PAGE,">$pagename") || die $!;
@page=<PAGE>;
foreach $list_line (@list) {
open (HEADERS, $list_line) || die $!; # THIS LINE IS BAD, IT WORKS WHEN
I USE A REGULAR FILENAME BUT
@headers = <HEADERS>; # THE $LIST_LINE FORMAT DOESN'T WORK. I'VE TRIED
CHOMPING TO GET
# RID OF \n BUT IT STILL FAILS.
.
.
.
Thanks alot in advance...
Justin
PLEASE E-MAIL as I don't have news groups at work. thanks
jch11@airmail.net
------------------------------
Date: 26 Jun 1997 22:53:16 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: Call 'lynx' with Perl
Message-Id: <hsoy5hyrn.fsf@bergen.sn.no>
jzhuang@ringer.cs.utsa.edu (Jun Zhuang) writes:
> Any sugestions to solve the problem(by not use web browser)?
You could try:
use LWP::Simple;
$gb_file = get "http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&uid=619931&form=6&Dopt=g";
--
Gisle Aas <aas@sn.no>
------------------------------
Date: Thu, 26 Jun 1997 14:04:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jun Zhuang <jzhuang@ringer.cs.utsa.edu>
Subject: Re: Call 'lynx' with Perl
Message-Id: <Pine.GSO.3.96.970626140113.6142C-100000@kelly.teleport.com>
On 26 Jun 1997, Jun Zhuang wrote:
> Is that a problem that "lynx" won't work for query string (CGI)?
Isn't that a Lynx question, instead of a Perl question? As near as I can
see, your Perl code is just fine. If you have a problem with something
other than the Perl code, you may be able to find the answer in a
more-suitable forum. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 26 Jun 1997 21:21:15 GMT
From: Zenin <zenin@best.com>
Subject: Re: Call 'lynx' with Perl
Message-Id: <5oumgb$5p9$3@nntp2.ba.best.com>
Jun Zhuang <jzhuang@ringer.cs.utsa.edu> wrote:
>snip<
> BUT, when I add some query strings, it failed to work.
> $gb_file = qx{lynx http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&uid=619931&form=6&Dopt=g};
You've got shell excape chars in there. Quote the URL:
$gb_file = `lynx 'http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&uid=619931&form=6&Dopt=g'`;
You'll probably also want the -dump or -source options for lynx.
See man lynx for details.
--
-Zenin
zenin@best.com
------------------------------
Date: Thu, 26 Jun 1997 19:51:57 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Call 'lynx' with Perl
Message-Id: <tcyangECEF6L.21H@netcom.com>
Posted and mailed. Perl will interpret your URL with Bourne Shell before
lynx takes over, and '?', '&' are both assigned a new meaning.
Try to pass $gb_file through
$gb_file =~ s/([\?&])/\\$1/;
before you call lynx. The above line is not tested which escapes the
'?' and '&'.
=============================================
Jun Zhuang typed before Poison Ivy kissed him:
: Hi:
: I tried call a 'lynx' command with my Perl script in Unix:
: $gb_file = qx{lynx http://www.ncbi.nlm.nih.gov/};
: print $gb_file;
: I was happy that I saw what I want.
: BUT, when I add some query strings, it failed to work.
: $gb_file = qx{lynx http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&uid=619931&form=6&Dopt=g};
: This works fine if under a netscape browser.
: But,I got an error mesage under Unix: www.ncbi.nlm.nih.gov/htbin-post/Entrez:
: No such file or directory.
: Is that a problem that "lynx" won't work for query string (CGI)?
: Any sugestions to solve the problem(by not use web browser)?
: Thanks.
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: 26 Jun 1997 17:28:42 -0400
From: mirtos@panix.com (Matthew Mac Gibbon)
Subject: Re: Can I call "http://www... in perl?
Message-Id: <5oumua$nl4@panix2.panix.com>
oops sorry, reposting because part of the post got wasted...
Matthew Mac Gibbon (mirtos@panix.com) wrote:
neither exec or system are going to do you that much luck..
think of it, http:// is hardly a system command..now im confused, is this
web database on the same machine that you're running the perl script out of?
if it is, it should be relatively simply to just run the script...
if it isnt, you might need to open some sort of socket...
now keep in mind, that the web form outputs html, so unless you want it
displayed (i got the feeling you are looking for bit of data that the form
creates), you will have to parse it.
: Jun Zhuang (jzhuang@ringer.cs.utsa.edu) wrote:
: : Hi!
: : Can I call "http://www...." in my perl script?
: : For exmaple: I want to call a web database and get the returned data
: : and add to my database.
: : How can I call:
: : "http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?db=n&uid=619912&form=6"
: : and add the returned data in my file "my_data"?
: : Everytime I just need a different "uid=______" and the others remain the
: : same in query. Should I call with "system" or "execl"?
: : Any suggestions will be appretiated.
: now keep in mind, this script outputs html, so you'll have to parse the info
: that is returned...
------------------------------
Date: Fri, 27 Jun 1997 23:22:17 +0200
From: Jonas Thvrnvall <labah@algonet.se>
Subject: Checkout Perlchat
Message-Id: <33B42EC4.15B9@algonet.se>
Hello!
Please have a look at http://www.algonet.se/chat/jtchat.htm
I try to do a Pel chat that will work without server socket connection.
I just upload to a file that can be read just like a guestbook i have
Implemented private messages, optional images, and login check, and
checkcode mailing and it will be quite configurable,
The problem is!
that i can't be sure that people will use the logout button, so i
looking for a way to see if the window is closed. I've tryed
Javascript if self.closed {submit.form()} but it won't work cause the
form is not there anymore (Another idea is to check lastmessage in the
chatroom files). Do anyone have a real smart idea how to solve this i
woul be glade.
Jonas T
------------------------------
Date: Fri, 27 Jun 1997 23:26:12 +0200
From: Jonas Thvrnvall <labah@algonet.se>
Subject: Re: Checkout Perlchat
Message-Id: <33B42FF4.4CAA@algonet.se>
Jonas Thvrnvall wrote:
>
> Hello!
> Please have a look at http://www.algonet.se/chat/jtchat.htm
> I try to do a Pel chat that will work without server socket connection.
> I just upload to a file that can be read just like a guestbook i have
> Implemented private messages, optional images, and login check, and
> checkcode mailing and it will be quite configurable,
>
> The problem is!
> that i can't be sure that people will use the logout button, so i
> looking for a way to see if the window is closed. I've tryed
> Javascript if self.closed {submit.form()} but it won't work cause the
> form is not there anymore (Another idea is to check lastmessage in the
> chatroom files). Do anyone have a real smart idea how to solve this i
> woul be glade.
>
> Jonas T
http://www.algonet.se/~labah/chat/jtchat.htm
------------------------------
Date: 26 Jun 1997 19:53:05 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Client-Side Execution
Message-Id: <5ouhb1$1m1@fridge-nf0.shore.net>
Brian Wheeler (bdwheele@indiana.edu) wrote:
: Why doesn't someone write a plug-in that will let perl run on the
: client? A first version wouldn't have to actually display anything...just
: let it modify the fields on the form...sorta like javascript. :)
Great! So glad you volunteered. Start with the Penguin module, and
you're off and running! :-)
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 26 Jun 1997 20:46:47 GMT
From: "Frank Huddleston" <Frank.Huddleston@guardian.brooks.af.mil>
Subject: Event Log Reporting - Doesn't Work
Message-Id: <01bc8272$15f631b0$70058c8c@oepc05112>
Greetings,
I've been trying to run a script which prints events from a
system's event logs. I copied this script from somewhere, I think a Byte
Magazine article, and I think I ran it successfully with an earlier version
of perl - which one I don't remember. I did have problems trying to select
a certain kind of event, so that I could print out only errors, but at
least the script would print the last n event entries. Now I revisit it
after a while, and I've tried builds 302, 304, and 306. All produce the
same error - here it is:
R:\perl5\pl>perl -w evt.pl VALHALLA System 10
Name "main::sec" used only once: possible typo at evt.pl line 44.
Name "main::isdst" used only once: possible typo at evt.pl line 44.
Name "main::yday" used only once: possible typo at evt.pl line 44.
Name "Win32::EventLog::pack" used only once: possible typo at
R:\perl5\lib/Win32/EventLog.
Name "main::i" used only once: possible typo at evt.pl line 41.
Name "main::sday" used only once: possible typo at evt.pl line 44.
Use of uninitialized value at R:\perl5\lib/Win32/EventLog.pm line 80.
Modification of a read-only value attempted at
R:\perl5\lib/Win32/EventLog.pm line 81.
Any ideas about what to do? Here's the script (sorry for the length):
# EVT - Reads/dumps NT event log
#
# Jon Udell, BYTE, jon_u@dev5.byte.com
# usage: perl evt.pl MYSERVER System 10
# result: dumps most recent 10 events in MYSERVER's System event log
use Win32::EventLog;
$machine = $ARGV[0];
$eventlog = $ARGV[1];
$limit = $ARGV[2];
my $EventLog;
Open Win32::EventLog($EventLog,$machine,$eventlog) || die $!; my $event={
'Source' =>NULL,
'Computer' =>NULL,
'Length' =>NULL,
'Category' =>NULL,
'RecordNumber' =>NULL,
'TimeGenerated' =>NULL,
'Timewritten' =>NULL,
'EventID' =>NULL,
'EventType' =>NULL,
'ClosingRecordNumber' =>NULL,
'Strings' =>NULL,
'Data', =>NULL,
};
$first = $count = 0;
$EventLog->GetOldest(\$first) || die $!; $EventLog->GetNumber(\$count) ||
die $!;
$EventLog->Read((EVENTLOG_SEEK_READ |
EVENTLOG_BACKWARDS_READ),$first+$count,$event);
for $i ($first+$count-$limit+1..$first+$count)
{
$EventLog->Read((EVENTLOG_SEQUENTIAL_READ|EVENTLOG_BACKWARDS_READ),0,$
event);
($sec,$min,$hour,$mday,$mon,$year,$sday,$yday,$isdst) =
localtime($event->{'TimeGenerated'});;
print sprintf("%15s -> %02d\-%02d\-%02d,
%02d:%02d\n",'timestamp',$year,$mon+1,$mday,$hour,$min);
foreach $key ('RecordNumber','Category','Source','Strings')
{
print sprintf( "%15s -> %s\n",$key, $event->{$key} ); }
print "\n";
}
----------------------------------------------------------------------
Thanks,
Frank Huddleston
Frank.Huddleston@guardian.brooks.af.mil
------------------------------
Date: 26 Jun 1997 21:31:20 GMT
From: brent@AAC.MsState.Edu (Brent Johnson)
Subject: find.pl Problem
Message-Id: <5oun38$9rc$2@NNTP.MsState.Edu>
Im assuming find.pl comes with the perl5 distribution. The problem
is, the find feature doesnt seem to follow symbolic links. Is
there a way around this... or some other version of find.pl
that DOES follow symbolic linked directories??
- Brent
--
---------------------
Brent L. Johnson brent@saturn.msstate.edu
Computer Application & Services blj1@ra.msstate.edu
http://saturn.msstate.edu/homepages/brent blj1@cobilan.msstate.edu
------------------------------
Date: Thu, 26 Jun 1997 14:16:18 -0700
From: Chris Percival-Smith <chrisps@bc.sympatico.ca>
Subject: flock problems
Message-Id: <33B2DC22.89F@bc.sympatico.ca>
I've been a PERL programmer for 9 months now and have come up against a
problem which I cannot solve.
Recently we moved the dbm files from another server to our current
server, both support the DB_FILE module.
The programs and databases worked fine on the new server. I started
experimenting with flocking using the example
in Programming Perl by Larry Wall. I succeeded in implementing flocking
on a small scale, then I attempted
to flock the program which needed it.
This attempt at 'flock'ing has resulted in a corrupted 'display.dbm'
file and a compiler error which
stoped the compiler/interpreter from running the program past the first
flocking. I've isolated the problem
to these three lines in the code. Any comments would be appreciated
with regard to any errors in the code
which follows.
Thank You
$dbdisplay = tie %DBdisplay, DB_File, $display, O_RDWR, 0777, $DB_HASH
|| die " ERROR accessing display";
$filedisplay = $dbdisplay->fd;
open(FH_DISPLAY, "+<&=$filedisplay") || die "dup $!";
The above code is extracted from the code that follows
#!usr/bin/perl -w
# unimportant code is extracted from the code that follows
$display ="/proper path/display.dbm";
$search ="/proper path/search.dbm";
$LOCK_SH = 1;
$LOCK_EX = 2;
$LOCK_NB = 4;
$LOCK_UN = 8;
chmod (0777,$display);
print "I made it here 1\n";
$dbdisplay = tie %DBdisplay, DB_File, $display, O_RDWR, 0777, $DB_HASH
|| die " ERROR accessing display";
$filedisplay = $dbdisplay->fd;
open(FH_DISPLAY, "+<&=$filedisplay") || die "dup $!";
unless (flock(FH_DISPLAY, $LOCK_EX | $LOCK_NB)){
print "$$: CONTENTION; must have exclusive lock on display!
Waiting for read lock ($!) ....";
unless (flock(FH_DISPLAY, $LOCK_EX)) { die "flock: $!" }
}
### At this point $tempnumber is unique
### Assign the value to the database
$DBdisplay{$tempnumber} = "$data_to_be_inputed";
$DBdisplay{1000000} = $tempnumber;
sleep 2;
$dbdisplay->sync(); # to flush
flock(FH_DISPLAY, $LOCK_UN);
untie %DBdisplay;
undef $dbdisplay;
close(FH_DISPLAY);
chmod (0755,$display);
print "I made it here 2\n";
chmod (0777,$search);
$dbsearch = tie %DBsearch, DB_File, $display, O_RDWR, 0777, $DB_HASH ||
die " ERROR accessing search";
$filesearch = $dbsearch->fd;
open(FH_SEARCH, "+<&=$filesearch") || die "dup $!";
unless (flock (FH_SEARCH, $LOCK_EX | $LOCK_NB)) {
print "$$: CONTENTION; must have exclusive lock on search!
Waiting for write lock ($!) ....";
unless (flock (FH_SEARCH, $LOCK_EX)) { die "flock: not
exclusive" }
}
$DBsearch{$var{linkaddress}} = $tempnumber;
sleep 2;
$dbsearch->sync(); # to flush
flock(FH_SEARCH, $LOCK_UN);
untie %DBsearch;
undef $dbsearch;
close(FH_SEARCH);
chmod (0755,$search);
print "I made it here 3\n";
------------------------------
Date: 26 Jun 1997 21:48:54 GMT
From: Zenin <zenin@best.com>
Subject: Re: GIFgraph.pm or finance scripts
Message-Id: <5ouo46$5p9$4@nntp2.ba.best.com>
Mike Christensen <mike@soft-tek.com> wrote:
> When you find that your current charting solution is coming up short, I
> would like to invite you to check out GRAFSMAN/WWW from Soft-tek
> International, Inc.
> You will find a live demonstration of GRAFSMAN/WWW on our website:
> http://www.soft-tek.com
Looks great. Too bad you don't seem to have a perl interface
to it, and this is a perl news group.
Read man perlxs and perlxstut to learn how to build a perl module
out of your C API. Once it's done, please email me as I'd love to
use it. -Your demo graphs look great.
As for the original question, the GIFGraph module has some *really*
ugly code and lots of umm, features. Most of the time when I've
wanted to do anything other then copy the demos I've had to hack the
module code to let me do it. I wouldn't recommend this for the
adverage perl programmer however as the code is *vary* hard to read,
uses heavy perl5 features, and names all it's variables and
methods, 'f', 'g', 'xg', etc with basicly no comments as to what
they are or what they do... My guess is that the author is really
a math guy at heart, not a programmer. :-(
--
-Zenin
zenin@best.com
------------------------------
Date: Thu, 26 Jun 1997 20:59:53 GMT
From: "David W. Coppit" <dwc3q@mamba.cs.Virginia.EDU>
Subject: How to determine "()" at compile time?
Message-Id: <Pine.SOL.3.96.970626164311.28602A-100000@mamba.cs.Virginia.EDU>
Hi all,
I'm trying to write a subroutine in a module that takes an array as a
parameter. I prototyped it using "sub blah(\@)", which according to the
camel book means that the actual parameter must begin with a "@". Well,
actually, this isn't true, because it allows:
blah()
Is there any way to determine at compile time that the programmer has
(mis)used my subroutine this way? My guess is no, since "()" resolves to
an empty list, and BEGIN blocks can't statically determine if an array is
empty or not...
Thanks,
David
_________________________________________________________________________
David Coppit - Graduate Student coppit@cs.virginia.edu
The University of Virginia http://www.cs.virginia.edu/~dwc3q
"Never imagine yourself not to be otherwise than what it might appear to
others that what you were or might have been was not otherwise than what
you had been would have appeared to them to be otherwise." -Lewis Carroll
------------------------------
Date: 26 Jun 1997 21:04:41 GMT
From: tina@elfi.adbkons.se ( Tina Marie Holmboe )
Subject: Re: How to get browser window size?
Message-Id: <5oulh9$jd4$2@uabs64.uab.ericsson.se>
[Wed, 18 Jun 1997 06:12:09] [Zonycat]
> I am trying to get the size of my browser window or anybody's browser
> window that displays my WEB page. Is there an environmental variable or
> cookie I could look at to see the window size?
> I am trying to dynamically resize my images I display depending on the
> window size. Basically different people have different screen sizes.
In short: it isn't possible. Some browsers *may* send such information, but
it is as far from a standard as it is possible to come.
The question is also *abit* off-topic for comp.lang.perl.misc; followups
set accordingly.
--
Tina Marie Holmboe
[ tina@htmlhelp.com ] WDG [ http://www.htmlhelp.com/%7Etina/ ]
[ tina@ifi.uio.no ] University [ http://www.ifi.uio.no/%7Etina/ ]
[ tina@elfi.adbkons.se ] Private [ http://www.elfi.adbkons.se/%7Etina/ ]
------------------------------
Date: 26 Jun 1997 20:49:36 GMT
From: sabat@us.oracle.com (Steve Abatangle)
Subject: O'Reilly: Advanced Perl Programming
Message-Id: <5oukl0$de0$1@inet16.us.oracle.com>
>>Advanced Perl Programming
>>By Sriram Srinivasan
>>1st Edition August 1997 (est.)
>>1-56592-220-4, Order Number: 2204
>>400 pages (est.), $34.95 (est.)
>>This book covers complex techniques for managing production-ready Perl programs and explains methods for manipulating
>>data and objects that may have looked like magic before. It gives you necessary background for dealing with networks,
>>databases, and GUIs, and includes a discussion of internals to help you program more efficiently, and embed Perl within C
>>when necessary.
So, Perl insiders: who is Sriram Srinivasan, and have any of you
heard anything (positive/negative) about this book?
Steve
--
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
sabat <sabat@oracle.com> .
http://www.area51.org . " You have no right to despise
purveyors of modern myth . the present. " -- Baudelaire
------------------------------
Date: Thu, 26 Jun 1997 12:08:30 -0700
From: Stephen Cole <scoler@earthlink.net>
Subject: problem running a C shell program in PERL..
Message-Id: <33B2BE2E.30E3@earthlink.net>
My boss requested that I write a PERL script that makes a
menu front end for several other programs that we use in our department.
Everything in it works except for one program. The program that will not
work is a C Shell script program .
Now, within my code, I used a system command like I did for the
other 10 programs on the menu:
system "cshellprogram $arg1 $arg2";
What happens is that the C Shell program bombs out on a line that uses
the "!" as a NOT expression. (i.e. if !(-f file) ). If you are at a
prompt in UNIX & type cshellprogram $arg1 $arg2, the program works.
I decided to try the exec() command instead since it terminates
the current PERL program but it makes no difference. Has anyone out
there had similiar problems running a C Shell script program from within
PERL??
P.S. Specifying the full path to the C Shell program makes no
difference either...
Thanks in Advance-
Steve
------------------------------
Date: Thu, 26 Jun 1997 16:10:01 -0400
From: Dan Boorstein <danboo@ixl.com>
To: Per Olesen <danpel@pluto.dannet.dk>
Subject: Re: Regexp with exclusion
Message-Id: <33B2CC99.D10C8DF8@ixl.com>
Per Olesen wrote:
>
> Hello
>
> I need a way to substituate multi whitespace with
> single whitespace globally in a string. BUT. Everything
> in the string, which is enclosed within " must NOT
> participate in the substitution.
>
> example:
>
> $line = 'hello world "dab dab dab" more';
Well, I know it is not a single, elegant regex, but it was
the first thing that came to mind:
$_ = 'hello world "dab dab dab" more';
@pcs = split '"', $_, tr/"/"/+1;
for ($i=0; $i<=$#pcs; $i++) { $pcs[$i++] =~ s,\s+, ,g; }
$copy = join '"', @pcs;
print $copy;
I am assuming that your quotes will always be matched since
they "enclosed" something, and that only container quotes exist
(i.e., no escaped quotes).
Dan Boorstein
danboo@ixl.com
------------------------------
Date: Thu, 26 Jun 1997 19:39:09 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Regexp with exclusion
Message-Id: <tcyangECEEL9.17p@netcom.com>
I doubt if this regexp exists. I could have thought the problem more
difficult than it really is, but do you want the regexp to handle
multiple " pairs, say,
$line = 'hello world "dab dab dab" more if "dabadaba du" less ';
if the answer is no, and you are guaranteed to have only one pair (at
most) of ", then maybe you can try the following regexp:
if ($line =~ /^([^"]*)("[^"]*")([^"]*)$/){
$first = $1; $third = $3;
$first =~ s/\s+/ /; $third =~ s/\s+/ /;
$line = $first . $2 . $third;
}
This is tested and passed for the input
$line = 'hello world "dab dab dab" more if dabadaba du less ';
Some gurus should be able to optimize it (sigh, I am always a RISC
worshiper).
On the other hand, if you have multiple pairs of " in the string, then
the above Perl lines do nothing about your string since the pattern
is not matched. What's worse, it could be ambiguous how you pair the
double apostrophe in
$line = 'hello world "dab dab dab" more if dabadaba du" less ';
for an erroneous data with three (odd) "'s.
==========================================
Per Olesen typed before Poison Ivy kissed him:
: Hello
: I need a way to substituate multi whitespace with
: single whitespace globally in a string. BUT. Everything
: in the string, which is enclosed within " must NOT
: participate in the substitution.
: example:
: $line = 'hello world "dab dab dab" more';
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Fri, 27 Jun 1997 22:57:44 +0200
From: Jonas Thvrnvall <labah@algonet.se>
Subject: Script Fake a browser?
Message-Id: <33B42948.1D21@algonet.se>
Is it possible for a Perl script to call a server and fake that it's a
browser. Is there any script available for doing this?
Could a script handle a html response from server, if you do such call?
Jonas T
------------------------------
Date: 26 Jun 1997 21:29:40 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Script Fake a browser?
Message-Id: <5oun04$7ri@fridge-nf0.shore.net>
Jonas Thvrnvall (labah@algonet.se) wrote:
: Is it possible for a Perl script to call a server and fake that it's a
: browser. Is there any script available for doing this?
Yes. Use the LWP modules to GET and POST.
: Could a script handle a html response from server, if you do such call?
Read the LWP documentation.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Thu, 26 Jun 1997 19:19:06 GMT
From: Richard <richard@icsn.com>
Subject: Software Development Web Guides Wanted
Message-Id: <ECEDo2.6I1@nonexistent.com>
Wanted for part time. We are looking for a web savvy individual who
keeps current on SOFTWARE DEVELOPMENT to build a site about it. Surf,
present best links & write column. Html necessary. Email
richard@icsn.com for details.
------------------------------
Date: 26 Jun 1997 20:47:45 GMT
From: tina@elfi.adbkons.se ( Tina Marie Holmboe )
Subject: Re: Sorry another regex question - parsing HTML anchors??? Interesting though...
Message-Id: <5oukhi$jd4$1@uabs64.uab.ericsson.se>
[Wed, 18 Jun 1997 02:01:09] [topaz56@one.net]
> I can't figure this out, even after reading (sporadically) through
> understading regular expressions. What operator matches
> anything akin to * in unix? Is it *? or (*) or .*? What I'm trying
. - usually >:), as stated:
". Match any character (except newline)"
> I'd like to dump the url and the name into separate variables, and to
> add a bit of interest to this, I'd like it to smoothly handle text
> files generated from Netscape bookmarks. The rough anchors look like
I would be tempted to use this, using the emminent x modifier to make things
look abit less like Schwartzian Transforming... :)
#! /usr/bin/perl
while(<>){
my($url, $name) = (
$_ =~ /href= # Starting the patter; the HREF attribute.
"? # Possibly a "
([^"]+) # Then one or more of whatever, but not a ".
"? # Possibly another "
[^>]* # Zero or more of anything, but not a >.
> # Then a >, ending the first part of the A
([^<]+) # Now one or more of anything, but NOT a <.
</ix ) ; # And finally a <, ending the link.
print "URL=[$url] NAME=[$name]\n" ;
}
> My logic (& it is probably flawed) is to input this data as a scalar &
> store the variables &url & name in a hash. Am I thinking about this
> correctly??? And how can I fix the regex below???
The question is: what do you *need* to do ? Yes, storing the URL and link
name in a hash table would be viable, if that is the best solution to your
problem - but since we don't know what the purpose behind your program may
be, it ain't easy to say... how 'bout a hint ?
But for the associative array trick, something like this:
#! /usr/bin/perl -w
# To please certain individuals in clpm >:)
# Open the file, or die ! (*)
open(PTR, "<$data") || die("Unable to open $data, $!\n") ;
# Traverse the content, and pick out
# the data we want:
while(<>){
# Parse a line.
my($url, $name) = ( $_ =~ /href="?([^"]+)"?[^>]*>([^<]+)</ix ) ;
# Make the URL lowercase, to avoid
# hashing addresses twice. (They get
# soggy that way.)
$url =~ y/A-Z/a-z/ ;
# I'm storing the data twice, just to
# illustrate a point.
$LinkByUrl{$url} = $name ;
$UrlByLink{$name} = $url ;
}
Std. disclaimer: code is untested, althought the regexp works quite nicely
on my Netscape bookmarks. Note, however, that if you want to use this on other
types of HTML files you need to bear in mind that the A element - like all
HTML elements - can stretch over N lines. That means you'll have to slurp the
entire file into one big scalar, and use the /m modifier and a slightly
different regexp to parse it. On Netscape style bookmark HTML it works, though.
(*)
Hm... in the next version of Perl, someone really ought to change the
name 'file'. It ought to be called 'safe'. That way the open() above could
be nicely commented:
# Open the safe, or die !
open(PTR, "<$data") || die("Unable to open $data, $!\n") ;
Just a thought...
--
Tina Marie Holmboe
[ tina@htmlhelp.com ] WDG [ http://www.htmlhelp.com/%7Etina/ ]
[ tina@ifi.uio.no ] University [ http://www.ifi.uio.no/%7Etina/ ]
[ tina@elfi.adbkons.se ] Private [ http://www.elfi.adbkons.se/%7Etina/ ]
------------------------------
Date: Thu, 26 Jun 1997 14:21:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Simon Goland <sg@mda.ca>
Subject: Re: Source code comparison - know of a tool?
Message-Id: <Pine.GSO.3.96.970626141828.6142G-100000@kelly.teleport.com>
On Thu, 26 Jun 1997, Simon Goland wrote:
> I am looking for a tool/utility/script (partial or complete) that will
> compare various programs in C/C++/Java and tell me how closely they
> resemble each other. I teach these programming courses, and would like
> to get an accurate estimate of "program resemblance" when checking the
> assignments of my students... because some programs look way too similar
> to each other.
And of course, that's a sign that one of your students is destined
to work for Microsoft, right?
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 26 Jun 1997 19:39:11 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Substitute ^M by HTML <br> code...
Message-Id: <tcyangECEELB.18F@netcom.com>
Nope. "^M" is a control character (I forgot whether it is newline or
carriage return in DOS) which is one-byte, while your pattern matches the
two-byte "^" . "M". Sylvain should use \nnn to specify the control
character.
=============================
James J. Heck typed before Poison Ivy kissed him:
: Sylvain,
: The "^" is a reserved character in PERL. Thus you just need to escape
: the character.
: $Note =~ s/\^M/<br>\n/g;
: This should work just fine now. :-)
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: Thu, 26 Jun 1997 15:59:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Substitute ^M by HTML <br> code...
Message-Id: <comdog-ya02408000R2606971559000001@nntp.netcruiser>
In article <33B2A429.2781@merck.com>, jheck@acm.org wrote:
> The "^" is a reserved character in PERL. Thus you just need to escape
> the character.
>
> $Note =~ s/\^M/<br>\n/g;
>
> This should work just fine now. :-)
just a note - that matches the literal '^M', a two character string,
rather than the control character 'M' (one "character"), which tends
to show up with certain operating systems :)
--
brian d foy <URL:http://computerdog.com>
------------------------------
Date: Thu, 26 Jun 1997 15:59:08 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Substitute ^M by HTML <br> code...
Message-Id: <comdog-ya02408000R2606971559080001@nntp.netcruiser>
In article <33B27E9B.5569@nortel.ca>, "Sylvain St.Germain"
<sgermain@nortel.ca> wrote:
> I have a variable that contain a string like :
> ...load tapes. ^M- A list of all...
>
> I would like to subtitute the ^M by <br>...
to match control characters, you can use \c, like
$note =~ s/ \cM /<br>\n/xg;
for further details, see the man pages or the Blue Camel [1] :)
[1] the Blue Camel (specifically page 65)
Programming Perl, Larry Wall
Tom Christensen, & Randal L. Schwartz
ISBN 1-56592-149-6.
<URL:http://www.ora.com>
--
brian d foy <URL:http://computerdog.com>
------------------------------
Date: 26 Jun 1997 18:12:05 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Telnet in the web...
Message-Id: <01bc825c$d5e6b500$6875e7c8@Term104>
Hi! I'm trying to show a telnet output in a web page, and I don't know what
code the telnet server send me when it's waiting for a entry. The following
code :
do
{
$text = '';
until (recv(MYSOCK, $ch, 1, 0) && (ord($ch) == 0 or ord($ch) == 10) )
{
$text .= $ch;
}
print $text;
} until ($text eq ????????????? )
Here is my question : What have I to put in the ????????????? to know when
the telnet server is asking that I type anything ? (per example, the telnet
server stops in : "login :". I'd like to identificate this moment
independent of the server...
Thanks for any help.
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@usa.net
--------------------------------------------
------------------------------
Date: 26 Jun 1997 19:56:00 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Telnet in the web...
Message-Id: <5ouhgg$1m1@fridge-nf0.shore.net>
Sergio Stateri Jr (serginho@alpha.hydra.com.br) wrote:
: Hi! I'm trying to show a telnet output in a web page, and I don't know what
: code the telnet server send me when it's waiting for a entry. The following
: code :
You can probably use the Net::Telnet module with some degree of
success for what you're trying to accomplish. You should refer
to the Net::Telnet docs after you've downloaded and installed it.
Hope this helps!
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: 26 Jun 1997 19:57:15 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: telnet port 80 get & measge
Message-Id: <5ouhir$1m1@fridge-nf0.shore.net>
Carlos Reed (creed@rescol.fse.ulaval.ca) wrote:
: that telnets a host at port 80
: captures any thing from that host
: an then it says succeed.
Yep. Use Net::Telnet. If you're just trying to grab a webpage, then
you should get the LWP modules.
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Thu, 26 Jun 1997 14:43:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Carlos Reed <creed@rescol.fse.ulaval.ca>
Subject: Re: telnet port 80 get & measge
Message-Id: <Pine.GSO.3.96.970626144158.6142J-100000@kelly.teleport.com>
On 26 Jun 1997, Carlos Reed wrote:
> I'm wondering if there is a script that telnets a host at port 80
> captures any thing from that host an then it says succeed.
Yes, there is. If you want to write one of your own, you may want to use
the LWP module to make the task easier. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 26 Jun 1997 20:27:32 GMT
From: kaz@vision.crest.nt.com (Kaz Kylheku)
Subject: Re: What does "UNIX" stand for..
Message-Id: <5oujbk$rkb@bcrkh13.bnr.ca>
In article <5ol5mq$873$1@tsunami.wavetech.net>,
Ron McFarland <ronmcf@wavetech.net> wrote:
>In article <33A562FC.3126@cs.odu.edu>, eddie@cs.odu.edu says...
>>If operating systems were programming languages UNIX would be C
>>and Win95 would be BASIC with line numbers. :)
>
>Naw. Win95 would be like C++. ;)
Granted, but an incompatible C++ with line numbers. Templates and virtual would
be available in some promised future upgrade, of course. And no program
written before August 1995 would compile.
------------------------------
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 670
*************************************