[8432] in Perl-Users-Digest
Perl-Users Digest, Issue: 2049 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 7 23:08:00 1998
Date: Sat, 7 Mar 98 20:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 7 Mar 1998 Volume: 8 Number: 2049
Today's topics:
-l flag bug? <stvhoof@netvision.net.il>
Re: 501 error from www server <petersongroup-nospam@home.com>
getting perl recognized by a server (Dirksen E. Bussiere [42T])
Re: Help wanted (philip Martin)
HELP with SUBROUTINES and @_ (MercuryZ)
HELP with SUBROUTINES and @_ (MercuryZ)
Re: Help: avoiding eval() on a grep() function. <dformosa@st.nepean.uws.edu.au>
HTML::Element/Parser/Tree help <dgoyette@NoMoreSPAMpcisys.net>
Re: Memory limitation of Perl for OS/2 (Ilya Zakharevich)
Re: ODBC32 <agruskin@melbpc.org.au>
Oreilly Perl Resource Kit Setup: Segmentation fault! <whisper@unix.cde.com>
Re: Oreilly Perl Resource Kit Setup: Segmentation fault (Nathan V. Patwardhan)
re: Performance Question <beans@bedford.net>
Please Help... Trying to Download PERL to a Windows 95 <GartenGroup@worldnet.att.net>
Re: Please Help... Trying to Download PERL to a Windows (dave)
Re: Pw32i302...now this is just plain frustrating! <stvhoof@netvision.net.il>
Retriving last item in array. <mhanson@arrowweb.com>
Re: Script for RTrimming Fields <dformosa@st.nepean.uws.edu.au>
Re: Script to print out memory addreses in use ... here (Allan Peda)
Re: Script to print out memory addreses in use ... here (Allan Peda)
Script to print out memory addreses in use ... here, th (Allan Peda)
Re: Script will not run (I R A Aggie)
Re: The -w switch (was Re: better way to do this?) (Abigail)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 07 Mar 1998 23:45:35 +0200
From: Tzadik Vanderhoof <stvhoof@netvision.net.il>
Subject: -l flag bug?
Message-Id: <3501BFFF.7302@netvision.net.il>
If I give the following command from the shell:
perl -le 'print "foo"'
it outputs:
foo
as one would expect. However, if I create a script file like this:
#!/usr/local/bin/perl -l
print "foo";
I get no output (presumably because the shell I use does not output
lines that do not end in a newline). I need to add a "\n" after the
"foo" above to get it to print "foo". Why does the "-l" work on the
command line but not in a script file? I know I could use:
$\ = "\n";
in a script file, (which does work for me, by the way) but it's much
more convenient to use "-l".
I'm using version 5.003, in case that matters.
Tzadik
------------------------------
Date: Sat, 7 Mar 1998 18:25:46 -0800
From: "Dan Peterson" <petersongroup-nospam@home.com>
Subject: Re: 501 error from www server
Message-Id: <6dsvjr$iff$1@ha2.rdc1.sfba.home.com>
Jonathan,
Thats what I thought also, I get confused by single quotes and double
quotes. However it seems to have worked at one time. I have been running it
that way for about a month. Then they changed the server to an older
version.
I did some packet dumping off the wire and found that the problem is the way
I formed that string. The web server does not accept the user name and
password that way. Some web servers will accept:
http://<username>:<password>@<host name>/<path>
Seems when they changed the server to the older version it stopped working.
I have modified the code to:
my $req = POST 'http://<host name>/<path>/index.cgi',
[proc => "retrieve",
retrieve => $code,
usr => $user];
$req->authorization_basic($user,$pw);
local ($got_it)=$ua->request($req)->as_string;
Now it seems to work just fine. Maybe if I had used "$user:$pw" it would
have worked all along.
Thanks for you help!
-Dan
Jonathan Feinberg wrote in message ...
>"Dan Peterson" <petersongroup-nospam@home.com> writes:
>
>> my $req = POST 'http://$user:$pw@//<host-name>/index.cgi',
>
>Do you realy intend to be sending the literal string '$user:$pw'?
>Those single-quotes will not interpolate those scalars. I'm sorry if
>I've misunderstood your code, but I think that may be part of your
>trouble.
>
>--
>Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 8 Mar 1998 01:11:03 GMT
From: bussierd@tvsfrank (Dirksen E. Bussiere [42T])
Subject: getting perl recognized by a server
Message-Id: <6dsr77$1pn3@fizban.pprd.abbott.com>
I am trying to get a system running under a server where the
main control script is written in perl and is named 'main'.
everytime I click on main, it comes up as an ascii dump of
the script, so I gather that the script is not being
recognized by the server. I am using httpd from NCSA. Does
anyone know how I can get the perl scripts that lack the .pl
to be recognized and executed properly.
-Dirk
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dirk Bussiere bussierd@tvsfrank.pprd.abbott.com
Abbott Laboratories Office: (847)935-0916
Department 42T FAX: (847)937-2625
Scientific Information, Analysis, and Management/
Dept. of Structural Biology
100 Abbott Park Rd.
Abbott Park, IL 60064-3500
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 8 Mar 1998 03:21:37 GMT
From: philip@pmwd.com (philip Martin)
Subject: Re: Help wanted
Message-Id: <6dt2s1$ren$1@ha2.rdc1.sfba.home.com>
>As a beginner to Perl, I have a problem. I am contacted with TWICS
>(http://www.twics.com). In my first CGI script in Perl, the line;
>$name = <SCRIPT>
I assume that you have the ; in the real script. that line means to load the
first line of <SCRIPT> into $name. If you want the entire file use
@name=<SCRIPT>; or if you have to have it in a scalar var you can try this:
while(<SCRIPT>){
$name .= $_;
}
this uses the concentration operator to stick the entire file into one
(possabily long) line. Also be sure that the file handle is open for output,
and that you are using the same capitilazation.
>print("\n"); or print("\t"); don't work.
try just print "\n"; does something like print "Hello, World\n"; work?
>I desperately need a help from someone. If needed, I can send all the 7
>lines of code to check. I am quite familiar with "C" and other programming
>language but feel helpless taking the first step in Perl. Is it so difficult
>to program?
No, Perl is actully quite easy, at least for me. Maybe bacause I never learned
C, so Perl is all I know. If you need any more help feel free to contact me.
-Philip
__
Philip Martin
PM Web Design
http://www.pmwd.com
------------------------------
Date: 8 Mar 1998 00:44:34 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: HELP with SUBROUTINES and @_
Message-Id: <6dspli$ror@chile.earthlink.net>
Hello all you Perl wizards...
I have been studying Perl for about 5 months now and
I have difficulty in only one area...subroutines.
I understand how to write subroutines and how to include
them in my programs, but what I don't understand is
how variables are made local and especially how @_ works.
For example, here is a chunk of code that I fail to
understand:
##################################################
sub uppercase {
local ( *string ) = @_;
foreach $string (@string) {$string =~ tr/a-z/A-Z/; }
return @string;
}
$string = "lower case";
@change = ("Sean", "F");
@return = uppercase( *change );
print "change is now $change[0] $change[1]\n";
print "return is now $return[0] $return[1]\n";
print "and string is still $string\n";
##################################################
I have many Perl books, and have studied hard,
but I can't understand for one reason or another
how file globbing works in combination with localizing
variables. What I need is for someone to explain
in simple terms how all this works. Why use
*string? How does local (*string)=@_; work?
And most importantly, what is the function of @_?
I see the code used all the time and it is the only
code that I have yet to grasp.
Thanks, Sean
------------------------------
Date: 8 Mar 1998 00:44:12 GMT
From: mercuryz@mail.alabanza.com (MercuryZ)
Subject: HELP with SUBROUTINES and @_
Message-Id: <6dspks$ror@chile.earthlink.net>
Hello all you Perl wizards...
I have been studying Perl for about 5 months now and
I have difficulty in only one area...subroutines.
I understand how to write subroutines and how to include
them in my programs, but what I don't understand is
how variables are made local and especially how @_ works.
For example, here is a chunk of code that I fail to
understand:
##################################################
sub uppercase {
local ( *string ) = @_;
foreach $string (@string) {$string =~ tr/a-z/A-Z/; }
return @string;
}
$string = "lower case";
@change = ("Sean", "F");
@return = uppercase( *change );
print "change is now $change[0] $change[1]\n";
print "return is now $return[0] $return[1]\n";
print "and string is still $string\n";
##################################################
I have many Perl books, and have studied hard,
but I can't understand for one reason or another
how file globbing works in combination with localizing
variables. What I need is for someone to explain
in simple terms how all this works. Why use
*string? How does local (*string)=@_; work?
And most importantly, what is the function of @_?
I see the code used all the time and it is the only
code that I have yet to grasp.
Thanks, Sean
------------------------------
Date: 7 Mar 1998 22:46:32 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Help: avoiding eval() on a grep() function.
Message-Id: <889310791.817899@cabal>
In <3500811B.A680577@technologist.com> Tommy <tkho@technologist.com> writes:
[...]
>grep(/$STR1/i&&/$STR2/i, @Array);
># this take only 0.3 sec for 600k records.
>grep( eval(/$STR1/i&&/$STR2/i) , @Array);
># this take about 10 sec for 600k records.
>Does anyone how to do the same task without using eval()?
What you are doing is re running grep in a loop. What you should do it
something like this.
$evaledstring= eval "sub {/$STR1/i && /$STR2/i}";
grep(&$evaledstring,@Array);
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 8 Mar 1998 01:26:24 GMT
From: "Don" <dgoyette@NoMoreSPAMpcisys.net>
Subject: HTML::Element/Parser/Tree help
Message-Id: <01bd4a30$ec100380$4e68d2d0@586win95>
Hello,
The simple script listed below is being run from a browser for ease of use,
thus the QUERY_STRING var. It employs several LWP module sub-modules in
order to GET an HTML document and PARSE a specific tag (<a href>). I'm
able to obtain the quoted part of the href link and now I want to obtain
the text part (that falls between the ">" and "</a>"), as in:
<a href="filename.xyz"> This is text </a>
The part I now need to obtain is " This is text ". The HTML::Element
documentation is unclear as to where this is stored (if at all) and there
are no examples in the docs or in the libwww-perlCookbook file either as to
how to obtain this text.
Would someone here who is familiar with the use of the HTML::Element and/or
Parse(r) and/or TreeBuilder modules please tell me where to find the
example I need, or provide a line of code showing me how to get this text?
Thank you.
Don
(dgoyette@pcisys.net)
------------------------( script )-----------------------
#!/usr/local/bin/perl
use LWP::Simple;
use HTML::Parse;
use HTML::Element;
use URI::URL;
print "Content-type:text/html\n\n";
$html = get $ENV{'QUERY_STRING'};
$parsed_html = HTML::Parse::parse_html($html);
for (@{ $parsed_html->extract_links(a) }) {
$link = $_->[0];
$url = new URI::URL $link;
$full_url = $url->abs($ENV{'QUERY_STRING'});
print "$full_url<BR>";
}
$parsed_html->delete();
------------------------------
Date: 7 Mar 1998 22:58:56 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory limitation of Perl for OS/2
Message-Id: <6dsjfg$cob$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Bill Jones
<bill@astro.fccj.cc.fl.us>],
who wrote in article <3501C883.72CF3D81@fccjmail.fccj.cc.fl.us>:
> The memory issue is not Perl, it is a problem with
> versions of OS/2 prior to OS/2 Warp Connect v3 and
> can be corrected with Service Pack 17 or 22
> (SP are accumulative.)
>
> If you are on OS/2 Warp Connect, SP 17 is available
> for free (see www.os2bbs.com), otherwise you
> must upgrade to Warp Connect.
Wow! What an info! What was that problem exactly, to put in READMEs?
I have never seen a report like this before. But very old EMX's had
32M limitation of sbrk()-ed memory.
Btw, I do not have Warp Connect, but it works OK with fixpak17. I do
not have a fixpakless machine around to check your claim.
Ilya
------------------------------
Date: Sun, 08 Mar 1998 14:01:16 +1000
From: Andrew Gruskin <agruskin@melbpc.org.au>
Subject: Re: ODBC32
Message-Id: <3502180B.EAD2D023@melbpc.org.au>
Usual deal. Send some sample code, like the piece causing your problems, and
then I might be able to help.
d2dcblu@fre.fsu.umd.edu wrote:
> I installed ODBC32 for Perl. When I try to test it I get
> DOCUMENT CONTAINS NO DATA. I have a system DSN and I have the username and
> password part it so I don't know what's wrong. Can somebody please
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Sat, 07 Mar 1998 18:12:09 -0500
From: Jeff Rose <whisper@unix.cde.com>
Subject: Oreilly Perl Resource Kit Setup: Segmentation fault!
Message-Id: <3501D449.A96C629D@unix.cde.com>
This is a multi-part message in MIME format.
--------------A36F5904489514C5D5907EC6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I was attempting to 'follow directions' in the Oreilly
Perl Resource Kit - Unix Edition to setup the CD, etc...
I did as follows:
mount /dev/hdc /mnt/cdrom
startx
nxterm
cd /mnt/cdrom/oreilly
./setup
The error I got was:
"Starting up Tk ... hang on ..."
segmentation fault
And I was dead in the water.
Here is my basic setup:
RH Linux 5.0 (2.0.33/Intel) on a i586 w/32meg RAM
with Perl5.004_01 installed by RH but also the
RH perl5.004_02.rpm installed. Haven't seen any
problems with other Tk progs in X either.
Haven't noticed any other problems on the system
since the segmentation fault occured. Anyone
ever experienced this or have a clue as to why
the ./setup script craps out?
FYI here is a copy of Oreilly's ./setup which
you are free to [snip!]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Jeff Rose Eustis Linux User Group (ELUG)
mailto:jrose@elug.org http://www.elug.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--------------A36F5904489514C5D5907EC6
Content-Type: text/plain; charset=us-ascii; name="setup"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="setup"
#!/bin/sh
case ${1} in
-devel) newversion=5.00453;;
*) newversion=5.00404;;
esac
realversion=5.00404;
oldversion=`(perl -e 'print $]') 2>/dev/null`;
case "$0" in
*/*) cd `dirname $0`;;
esac
if [ ! -f setup.really ]; then
echo "You must cd to the oreilly directory first."
exit
fi
cwd=`pwd`;
arch=unknown
case `uname` in
Linux)
case `uname -r` in
[2-9].*) arch=i586-linux;;
esac;;
SunOS)
case `uname -r` in
[5-9].*) arch=sun4-solaris;;
esac;;
FreeBSD)
case `uname -r` in
[2-9].*) arch=i386-freebsd;;
esac
esac
# XXX need to give better instructions here
if [ "X$arch" = Xunknown -a "X$existingperl" = "X" ]; then
cat <<"END"
Sorry, there are no precompiled binaries on this CD-ROM for your
architecture. You'll have to install from CPAN/src/5.0/latest.tar.gz
yourself. (If you subsequently install the Tk extension module, you
can still use this setup program to install other modules.)
END
exit
fi
echo "Starting up Tk...hang on..."
PATH="$cwd/$arch/$realversion/bin:$PATH"
export PATH
PERL5LIB="$cwd/$arch/$realversion/lib/perl5:$cwd/$arch/$realversion/lib/perl5/site_perl${PERL5LIB:+:$PERL5LIB}"
export PERL5LIB
LD_LIBRARY_PATH="$cwd/$arch/$realversion/lib/perl5/$arch/$realversion/CORE${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
exec perl setup.really "$arch" "$oldversion" "$newversion"
echo "You'll have to install Perl before you can run the module manager."
--------------A36F5904489514C5D5907EC6--
------------------------------
Date: 8 Mar 1998 02:06:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Oreilly Perl Resource Kit Setup: Segmentation fault!
Message-Id: <6dsueu$sqb@fridge.shore.net>
Jeff Rose (whisper@unix.cde.com) wrote:
: RH Linux 5.0 (2.0.33/Intel) on a i586 w/32meg RAM
: with Perl5.004_01 installed by RH but also the
: RH perl5.004_02.rpm installed. Haven't seen any
: problems with other Tk progs in X either.
These are problems with RH 5.0 and the Perl stuff on the Unix PRK, or
at least that is my understanding. You should probably call ORA tech
support about this. I've heard about segfaults and the inability to
link things on more than one occassion.
--
Nathan V. Patwardhan
------------------------------
Date: 8 Mar 98 00:59:29 GMT
From: "TomH" <beans@bedford.net>
Subject: re: Performance Question
Message-Id: <01bd4642$f24a8dc0$4b9163ce@beans.bedford.net>
Aside from the usual RTFM responses you will get to this, I wonder why you
asked it at all. Why do you care what is fastest? Unless you are checking
hundreds of REs, the difference will be a couple of milleseconds at best.
It seems to me that everyone's time is better spent solving significant
problems, rather that focusing on a non-problem (just my humble opinion).
If by "fastest" you really meant "easiest to code", you didn't present the
problem very well either, since you already suggested the solution you
intend to use...
-Tom
...
> >I want to check a string that's entered by the user against some regular
> >expressions I read from a config-file. Now I am wondering what is the
fastest
> >way to do that:
------------------------------
Date: 8 Mar 1998 01:23:49 GMT
From: "Sam Garten" <GartenGroup@worldnet.att.net>
Subject: Please Help... Trying to Download PERL to a Windows 95 Environment...
Message-Id: <6dsrv5$9ga@bgtnsc02.worldnet.att.net>
Saturday, 7 March 1998
Dear Colleagues - we have been trying to download PERL to a Windows 95
environment
without success.
Which site can we go to get a copy of Perl that
will run successfully in
our WINDOWS setup (we've aleady tried perl.com
and ActiveState.com)???
Your help will be greatly appreciated...
Sincerely,
Sam Garten
email: GartenGroup@worldnet.att.net
------------------------------
Date: Sun, 08 Mar 1998 01:27:51 GMT
From: meet@the.zoo (dave)
Subject: Re: Please Help... Trying to Download PERL to a Windows 95 Environment...
Message-Id: <3501f3bc.20425225@news.isoc.net>
On 8 Mar 1998 01:23:49 GMT, "Sam Garten"
<GartenGroup@worldnet.att.net> wrote:
>
>
>Saturday, 7 March 1998
>
>Dear Colleagues - we have been trying to download PERL to a Windows 95
>environment
> without success.
>
> Which site can we go to get a copy of Perl that
>will run successfully in
> our WINDOWS setup (we've aleady tried perl.com
>and ActiveState.com)???
>
> Your help will be greatly appreciated...
>
>Sincerely,
> Sam Garten
> email: GartenGroup@worldnet.att.net
>
The readme:
http://www.perl.com/CPAN-local/ports/win95/Standard/x86/perl5.00402-bindist04-bc.readme
The ZIP file:
http://www.perl.com/CPAN-local/ports/win95/Standard/x86/perl5.00402-bindist04-bc.zip
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dlripberXisoc.net (sub X with shunned char)
http://www.isoc.net/dlripber
/--\./==\./ee\./oo\./--\
------------------------------
Date: Sun, 08 Mar 1998 00:04:51 +0200
From: Tzadik Vanderhoof <stvhoof@netvision.net.il>
To: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Pw32i302...now this is just plain frustrating!
Message-Id: <3501C483.6E10@netvision.net.il>
Mark Stackhouse wrote:
> program right out of my "Learning Perl" book. HOW DO I RUN
> THE SCRIPT??? If I try to run it from a DOS prompt, I'm
Look for a batch file called "runperl" or perlrun" or something like
that. Change its name to the same name as your perl script (except
leave the extension as .BAT) and make sure your perl script has no
extension. Make sure the bat file is in the same directory as the perl
script. Then just type its name at the DOS prompt or Run command.
------------------------------
Date: Sat, 07 Mar 1998 18:39:01 -0800
From: Mike <mhanson@arrowweb.com>
Subject: Retriving last item in array.
Message-Id: <350204C5.CDA@arrowweb.com>
How would you retrieve the last item in an array?
------------------------------
Date: 7 Mar 1998 23:02:11 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Script for RTrimming Fields
Message-Id: <889311731.146811@cabal>
In <6dpk2k$46p$1@marina.cinenet.net> cberry@cinenet.net (Craig Berry) writes:
>? the platypus {aka David Formosa} (dformosa@st.nepean.uws.edu.au) wrote:
[...]
>: what is wrong with s/(.*?)\s*$/$1/ (Add flags to the end of sub
>: depeanding on what you think the string is)?
>How's that superior to s/\s+$// ?
Its not, it was the first solition that popped into my head, yours is
better.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep.
Support NoCeM http://www.cm.org/
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Sun, 08 Mar 1998 03:10:34 GMT
From: allan@interport.net (Allan Peda)
Subject: Re: Script to print out memory addreses in use ... here, thanks perl users for a useful tool - addresses.pl (0/1)
Message-Id: <35020baf.17319624@news.interport.net>
Here is the script, in a more readable form (closer to the top of the
message):
------------------------------
Date: Sun, 08 Mar 1998 03:12:32 GMT
From: allan@interport.net (Allan Peda)
Subject: Re: Script to print out memory addreses in use ... here, thanks perl users for a useful tool - addresses.pl
Message-Id: <35020c60.17496468@news.interport.net>
On Sun, 08 Mar 1998 03:10:34 GMT, allan@interport.net (Allan Peda)
wrote:
>Here is the script, in a more readable form (closer to the top of the
>message):
>
#!/D/usr/perl/bin/perl
# address.pl v 0.1
# Allan Peda
# allan@interport.net
#
# How to use: Prepare a file based on the format of the sample at
# the end of this script.
# This script will plot a servicable chart of the addresses in use,
# with the gaps plainly apparant.
#
$debug = 1;
$min_addr=0;
$max_addr=0;
for ($i=1; <>; $i++) {
/^(\w+)\s/; $$memory[$i]{base_addr}=$1; # base address
/^\w+\s+(\w+)\t/; $$memory[$i]{upper_addr}=$1; # upper
address
/\:(.+)$/; $$memory[$i]{addr_descrip} = $1; # description
of address
$ttl_num_addresses = $i;
print "$i\t $$memory[$i]{base_addr} \t" if $debug;
print hex($$memory[$i]{base_addr}),"\t-->\t" if $debug;
print " $$memory[$i]{upper_addr}\t" if $debug;
print hex($$memory[$i]{upper_addr}),"\t" if $debug;
print "$$memory[$i]{addr_descrip}\n" if $debug;
if (( hex($$memory[$i]{base_addr}) < hex($min_addr) ) ||
$i<=1){
$min_addr = $$memory[$i]{base_addr};
}
if (( hex($$memory[$i]{upper_addr}) > hex($max_addr) ) ||
$i<=1){
$max_addr = $$memory[$i]{upper_addr};
}
}
print "\nTotal number of addreses used = $ttl_num_addresses" if
$debug;
print "\nMinimimum address is: $min_addr" if $debug;
print "\nMaximimum address is: $max_addr\n" if $debug;
for ($addr = hex($min_addr); $addr <= hex($max_addr); $addr++) {
printf "\n%4x -> ", $addr;
for ($i=1; $i <= $ttl_num_addresses; $i++) {
if (( hex($$memory[$i]{base_addr}) <= $addr ) and
(( hex($$memory[$i]{upper_addr}) >= $addr))){
print "*** ";
if (( hex($$memory[$i]{base_addr}) == $addr )) {
print "$$memory[$i]{addr_descrip}";
}
}
}
}
# sample file address.txt follows:
__END__
0x1F0 0x1f8 :Hard disk drive
0x200 0x207 :Game I/O
0x278 0x27f :Parallel Port 2 (LPT2)
0x2e8 0x2ef :serial port, com4
0x300 0x31f :Prototype / Network PCB
0x360 0x363 :PC Network (Low address)
0x368 0x36B :PC Network (High address)
0x378 0x37f :Parallel Port 1 (LPT1)
0x380 0x38f :SDLC, Bisync
0x3a0 0x3bf :MDA / prn adapter (hercules)
0x3c0 0x3cf :EGA/VGA
0x3d0 0x3df :CGA/MDA/MCGA
0x3e8 0x3ef :Diskette controller
0x3fb 0x3ff :serial port 1 - com 1
------------------------------
Date: Sun, 08 Mar 1998 03:01:56 GMT
From: allan@interport.net (Allan Peda)
Subject: Script to print out memory addreses in use ... here, thanks perl users for a useful tool
Message-Id: <350207e8.16352854@news.interport.net>
I was trying to do two things recently..
1.) make sure my network card and sound card got along
2.) learn references in perl
So I wrote a little perl script to help me. It reads a descrition
file with three fields base address, upper address, and a description
of the card/hardware device that requires the address (see sample
below).
Output looks like this:
D:\usr\allan\work_area\Prog\perl>addresses.pl addr.txt
1 0x1F0 496 --> 0x1f8 504 Hard disk drive
2 0x200 512 --> 0x207 519 Game I/O
3 0x278 632 --> 0x27f 639 Parallel Port 2 (LPT2)
4 0x2e8 744 --> 0x2ef 751 serial port, com4
5 0x300 768 --> 0x31f 799 Prototype / Network
PCB
6 0x360 864 --> 0x363 867 PC Network (Low
address)
7 0x368 872 --> 0x36B 875 PC Network (High
address)
8 0x378 888 --> 0x37f 895 Parallel Port 1 (LPT1)
9 0x380 896 --> 0x38f 911 SDLC, Bisync
10 0x3a0 928 --> 0x3bf 959 MDA / prn adapter
(hercules)
11 0x3c0 960 --> 0x3cf 975 EGA/VGA
12 0x3d0 976 --> 0x3df 991 CGA/MDA/MCGA
13 0x3e8 1000 --> 0x3ef 1007 Diskette controller
14 0x3fb 1019 --> 0x3ff 1023 serial port 1 - com 1
Total number of addreses used = 14
Minimimum address is: 0x1F0
Maximimum address is: 0x3ff
1f0 -> *** Hard disk drive
1f1 -> ***
1f2 -> ***
1f3 -> ***
1f4 -> ***
1f5 -> ***
1f6 -> ***
1f7 -> ***
1f8 -> ***
1f9 ->
1fa ->
1fb ->
1fc ->
1fd ->
1fe ->
1ff ->
200 -> *** Game I/O
201 -> ***
202 -> ***
203 -> ***
204 -> ***
205 -> ***
206 -> ***
207 -> ***
208 ->
209 ->
20a ->
20b ->
20c ->
20d ->
20e ->
20f ->
210 ->
211 ->
212 ->
213 ->
214 ->
215 ->
216 ->
217 ->
218 ->
219 ->
21a ->
21b ->
21c ->
21d ->
21e ->
21f ->
220 ->
221 ->
222 ->
223 ->
224 ->
225 ->
226 ->
227 ->
228 ->
229 ->
22a ->
22b ->
22c ->
22d ->
22e ->
22f ->
230 ->
231 ->
232 ->
233 ->
234 ->
235 ->
236 ->
237 ->
238 ->
239 ->
23a ->
23b ->
23c ->
23d ->
23e ->
23f ->
240 ->
241 ->
242 ->
243 ->
244 ->
245 ->
246 ->
247 ->
248 ->
249 ->
24a ->
24b ->
24c ->
24d ->
24e ->
24f ->
250 ->
251 ->
252 ->
253 ->
254 ->
255 ->
256 ->
257 ->
258 ->
259 ->
25a ->
25b ->
25c ->
25d ->
25e ->
25f ->
260 ->
261 ->
262 ->
263 ->
264 ->
265 ->
266 ->
267 ->
268 ->
269 ->
26a ->
26b ->
26c ->
26d ->
26e ->
26f ->
270 ->
271 ->
272 ->
273 ->
274 ->
275 ->
276 ->
277 ->
278 -> *** Parallel Port 2 (LPT2)
279 -> ***
27a -> ***
27b -> ***
27c -> ***
27d -> ***
27e -> ***
27f -> ***
280 ->
281 ->
282 ->
283 ->
284 ->
285 ->
286 ->
287 ->
288 ->
289 ->
28a ->
28b ->
28c ->
28d ->
28e ->
28f ->
290 ->
291 ->
292 ->
293 ->
294 ->
295 ->
296 ->
297 ->
298 ->
299 ->
29a ->
29b ->
29c ->
29d ->
29e ->
29f ->
2a0 ->
2a1 ->
2a2 ->
2a3 ->
2a4 ->
2a5 ->
2a6 ->
2a7 ->
2a8 ->
2a9 ->
2aa ->
2ab ->
2ac ->
2ad ->
2ae ->
2af ->
2b0 ->
2b1 ->
2b2 ->
2b3 ->
2b4 ->
2b5 ->
2b6 ->
2b7 ->
2b8 ->
2b9 ->
2ba ->
2bb ->
2bc ->
2bd ->
2be ->
2bf ->
2c0 ->
2c1 ->
2c2 ->
2c3 ->
2c4 ->
2c5 ->
2c6 ->
2c7 ->
2c8 ->
2c9 ->
2ca ->
2cb ->
2cc ->
2cd ->
2ce ->
2cf ->
2d0 ->
2d1 ->
2d2 ->
2d3 ->
2d4 ->
2d5 ->
2d6 ->
2d7 ->
2d8 ->
2d9 ->
2da ->
2db ->
2dc ->
2dd ->
2de ->
2df ->
2e0 ->
2e1 ->
2e2 ->
2e3 ->
2e4 ->
2e5 ->
2e6 ->
2e7 ->
2e8 -> *** serial port, com4
2e9 -> ***
2ea -> ***
2eb -> ***
2ec -> ***
2ed -> ***
2ee -> ***
2ef -> ***
2f0 ->
2f1 ->
2f2 ->
2f3 ->
2f4 ->
2f5 ->
2f6 ->
2f7 ->
2f8 ->
2f9 ->
2fa ->
2fb ->
2fc ->
2fd ->
2fe ->
2ff ->
300 -> *** Prototype / Network PCB
301 -> ***
302 -> ***
303 -> ***
304 -> ***
305 -> ***
306 -> ***
307 -> ***
308 -> ***
309 -> ***
30a -> ***
30b -> ***
30c -> ***
30d -> ***
30e -> ***
30f -> ***
310 -> ***
311 -> ***
312 -> ***
313 -> ***
314 -> ***
315 -> ***
316 -> ***
317 -> ***
318 -> ***
319 -> ***
31a -> ***
31b -> ***
31c -> ***
31d -> ***
31e -> ***
31f -> ***
320 ->
321 ->
322 ->
323 ->
324 ->
325 ->
326 ->
327 ->
328 ->
329 ->
32a ->
32b ->
32c ->
32d ->
32e ->
32f ->
330 ->
331 ->
332 ->
333 ->
334 ->
335 ->
336 ->
337 ->
338 ->
339 ->
33a ->
33b ->
33c ->
33d ->
33e ->
33f ->
340 ->
341 ->
342 ->
343 ->
344 ->
345 ->
346 ->
347 ->
348 ->
349 ->
34a ->
34b ->
34c ->
34d ->
34e ->
34f ->
350 ->
351 ->
352 ->
353 ->
354 ->
355 ->
356 ->
357 ->
358 ->
359 ->
35a ->
35b ->
35c ->
35d ->
35e ->
35f ->
360 -> *** PC Network (Low address)
361 -> ***
362 -> ***
363 -> ***
364 ->
365 ->
366 ->
367 ->
368 -> *** PC Network (High address)
369 -> ***
36a -> ***
36b -> ***
36c ->
36d ->
36e ->
36f ->
370 ->
371 ->
372 ->
373 ->
374 ->
375 ->
376 ->
377 ->
378 -> *** Parallel Port 1 (LPT1)
379 -> ***
37a -> ***
37b -> ***
37c -> ***
37d -> ***
37e -> ***
37f -> ***
380 -> *** SDLC, Bisync
381 -> ***
382 -> ***
383 -> ***
384 -> ***
385 -> ***
386 -> ***
387 -> ***
388 -> ***
389 -> ***
38a -> ***
38b -> ***
38c -> ***
38d -> ***
38e -> ***
38f -> ***
390 ->
391 ->
392 ->
393 ->
394 ->
395 ->
396 ->
397 ->
398 ->
399 ->
39a ->
39b ->
39c ->
39d ->
39e ->
39f ->
3a0 -> *** MDA / prn adapter (hercules)
3a1 -> ***
3a2 -> ***
3a3 -> ***
3a4 -> ***
3a5 -> ***
3a6 -> ***
3a7 -> ***
3a8 -> ***
3a9 -> ***
3aa -> ***
3ab -> ***
3ac -> ***
3ad -> ***
3ae -> ***
3af -> ***
3b0 -> ***
3b1 -> ***
3b2 -> ***
3b3 -> ***
3b4 -> ***
3b5 -> ***
3b6 -> ***
3b7 -> ***
3b8 -> ***
3b9 -> ***
3ba -> ***
3bb -> ***
3bc -> ***
3bd -> ***
3be -> ***
3bf -> ***
3c0 -> *** EGA/VGA
3c1 -> ***
3c2 -> ***
3c3 -> ***
3c4 -> ***
3c5 -> ***
3c6 -> ***
3c7 -> ***
3c8 -> ***
3c9 -> ***
3ca -> ***
3cb -> ***
3cc -> ***
3cd -> ***
3ce -> ***
3cf -> ***
3d0 -> *** CGA/MDA/MCGA
3d1 -> ***
3d2 -> ***
3d3 -> ***
3d4 -> ***
3d5 -> ***
3d6 -> ***
3d7 -> ***
3d8 -> ***
3d9 -> ***
3da -> ***
3db -> ***
3dc -> ***
3dd -> ***
3de -> ***
3df -> ***
3e0 ->
3e1 ->
3e2 ->
3e3 ->
3e4 ->
3e5 ->
3e6 ->
3e7 ->
3e8 -> *** Diskette controller
3e9 -> ***
3ea -> ***
3eb -> ***
3ec -> ***
3ed -> ***
3ee -> ***
3ef -> ***
3f0 ->
3f1 ->
3f2 ->
3f3 ->
3f4 ->
3f5 ->
3f6 ->
3f7 ->
3f8 ->
3f9 ->
3fa ->
3fb -> *** serial port 1 - com 1
3fc -> ***
3fd -> ***
3fe -> ***
3ff -> ***
==========================
The script:
==========================
#!/D/usr/perl/bin/perl
# address.pl v 0.1
# Allan Peda
# allan@interport.net
#
# How to use: Prepare a file based on the format of the sample at
# the end of this script.
# This script will plot a servicable chart of the addresses in use,
# with the gaps plainly apparant.
#
$debug = 1;
$min_addr=0;
$max_addr=0;
for ($i=1; <>; $i++) {
/^(\w+)\s/; $$memory[$i]{base_addr}=$1; # base address
/^\w+\s+(\w+)\t/; $$memory[$i]{upper_addr}=$1; # upper
address
/\:(.+)$/; $$memory[$i]{addr_descrip} = $1; # description
of address
$ttl_num_addresses = $i;
print "$i\t $$memory[$i]{base_addr} \t" if $debug;
print hex($$memory[$i]{base_addr}),"\t-->\t" if $debug;
print " $$memory[$i]{upper_addr}\t" if $debug;
print hex($$memory[$i]{upper_addr}),"\t" if $debug;
print "$$memory[$i]{addr_descrip}\n" if $debug;
if (( hex($$memory[$i]{base_addr}) < hex($min_addr) ) ||
$i<=1){
$min_addr = $$memory[$i]{base_addr};
}
if (( hex($$memory[$i]{upper_addr}) > hex($max_addr) ) ||
$i<=1){
$max_addr = $$memory[$i]{upper_addr};
}
}
print "\nTotal number of addreses used = $ttl_num_addresses" if
$debug;
print "\nMinimimum address is: $min_addr" if $debug;
print "\nMaximimum address is: $max_addr\n" if $debug;
for ($addr = hex($min_addr); $addr <= hex($max_addr); $addr++) {
printf "\n%4x -> ", $addr;
for ($i=1; $i <= $ttl_num_addresses; $i++) {
if (( hex($$memory[$i]{base_addr}) <= $addr ) and
(( hex($$memory[$i]{upper_addr}) >= $addr))){
print "*** ";
if (( hex($$memory[$i]{base_addr}) == $addr )) {
print "$$memory[$i]{addr_descrip}";
}
}
}
}
# sample file address.txt follows:
__END__
0x1F0 0x1f8 :Hard disk drive
0x200 0x207 :Game I/O
0x278 0x27f :Parallel Port 2 (LPT2)
0x2e8 0x2ef :serial port, com4
0x300 0x31f :Prototype / Network PCB
0x360 0x363 :PC Network (Low address)
0x368 0x36B :PC Network (High address)
0x378 0x37f :Parallel Port 1 (LPT1)
0x380 0x38f :SDLC, Bisync
0x3a0 0x3bf :MDA / prn adapter (hercules)
0x3c0 0x3cf :EGA/VGA
0x3d0 0x3df :CGA/MDA/MCGA
0x3e8 0x3ef :Diskette controller
0x3fb 0x3ff :serial port 1 - com 1
------------------------------
Date: Sat, 07 Mar 1998 18:42:08 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Script will not run
Message-Id: <fl_aggie-0703981842090001@aggie.coaps.fsu.edu>
In article <3501C8F2.4624357C@internetnorth.com.au>, Ray Hall
<rayhall@internetnorth.com.au> wrote:
+ Could some one please tell me what is wrong with this script, I get
+ error 500 when it is run. The script searches a text file for a
+ sub-string and returns the line containing the search string.
Do you syntax check your perl scripts? perl -c _script_name_
+ #!/usr/local/bin/perl
+ Content-type: text/html
MacPerl told me (same thing a unix flavor did):
# syntax error, near "type:"
This is an 'UFF-DUH' error. What is "Content-type: text/html" doing
there? don't you mean: print "Content-type: text/html\n\n"; ???
+ $file = "cgi-bin/Parts/gar.dat";
I'd feel a lot better if this where an absolute path to file...
+ open (DATA_FILE, $file);
You might want to check to see if the open succeeded or failed...one
way to do that is:
open(DATA_FILE, $file) or die $!;
and check the server's error log. If you can't get access to it, you may
want to use CGI.pm:
use CGI::Carp qw/fatalsToBrowser/;
and have the error messages dumped to your browser's screen.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>
------------------------------
Date: 7 Mar 1998 23:30:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <6dsla9$l2n$2@client3.news.psi.net>
Joseph N. Hall (joseph@5sigma.com) wrote on 1649 September 1993 in
<URL: news:3500D24E.B4657F64@5sigma.com>:
++ Your users are running prototype software?
As a matter of fact, yes, they often do. Operating in an environment
that rapidly changes. Needless to say my code is loaded with dies
and croaks.
++ Perl is perfectly suitable for producing finished products. Finished
++ products don't yield assertion failures under any circumstances.
I ain't Knuth.
Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'
------------------------------
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 2049
**************************************