[6884] in Perl-Users-Digest
Perl-Users Digest, Issue: 509 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 21 17:18:47 1997
Date: Wed, 21 May 97 14:00:29 -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 Wed, 21 May 1997 Volume: 8 Number: 509
Today's topics:
2-way communication with unix command (Warren Pollans)
ANNOUNCE: SDF 2.000beta9 (Ian Clatworthy)
Re: AWKer needs Perl help <adam@ideas.net>
Re: Compounding (Martin Cohen)
Re: Differentiating between users :- HOW? <burleigh@hackberry.chem.niu.edu>
Re: File Exsists & get all files (Tim Smith)
Gdbm problems. (Gordon S.)
Re: Getting File Size <david.s.patterson@boeing.com>
Re: getting next line in while (Bill)
Re: getting next line in while <usenet-tag@qz.little-neck.ny.us>
Re: Help Use 1 file to edit another <sfink@cs.berkeley.edu>
Re: Installing GD library <maartenn@vademecum.be>
Re: Mystery characters? (Bart Lateur)
Re: OO Perl instance variables and lists <friedman@uci.edu>
Re: OO Perl instance variables and lists <thuja@internauts.ca>
Re: open and redirect <david.s.patterson@boeing.com>
Page grabber? (Paco Hope)
Re: Page grabber? (A. Deckers)
Re: Patch to Perl 5.004 for case-insensitive patterns ( (John A. Murphy)
Re: Prototype mismatch when forward declaring subs in 5 (Chip Salzenberg)
Re: Q: local in list contex? <jstern@world.northgrum.com>
Re: Questions of version <rootbeer@teleport.com>
Re: running a script from a script <david.s.patterson@boeing.com>
Re: sendmail script (Martin Lee)
Re: Size of simple scalar values (Mike Stok)
Re: Sorting a hash on output - newbie (Honza Pazdziora)
Re: Strange effect (Tim Smith)
system calls (Greg)
Re: Time stamping with perl (I R A Aggie)
Unusual Sys::Syslog behaviour ? (Richard Dows)
Re: Variables In Data Structures. (Jeremy T. Elston)
Webchat Perl Programmer Needed <mstokes@nbn.com>
Re: Webpage via CGI ! <rootbeer@teleport.com>
widget interface? (Warren Pollans)
Re: Year 2000 compliance <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 May 1997 20:13:48 GMT
From: wpollans@scrap.encore.com (Warren Pollans)
Subject: 2-way communication with unix command
Message-Id: <EAHxJ1.6AI@encore.com>
Hello,
I would like to be able to BOTH send input to and get output from a
unix command - namely crash. For example, I would like to start crash
with some command that will cause crash to output the value of a
variable/location, read that output and based on that value input
another command, etc, etc ... I would like to be able to do this
without having to restart crash each time. It's no problem to do the
following: start crash, get output, process, restart crash, get new
output ... This is potentially too time-consuming.
It seems I need both:
open(FH1, "| crash") and open(FH2, "crash |")
with some form of coordination between FH1 and FH2.
All suggestions appreciated. The machines on which this would run
currently have perl4 - so I need to come up with a perl solution.
Thanks,
Warren
------------------------------
Date: 21 May 1997 14:45:37 GMT
From: ianc@mincom.com (Ian Clatworthy)
Subject: ANNOUNCE: SDF 2.000beta9
Message-Id: <5lv1qh$4no$2@pithy.mincom.oz.au>
SDF (Simple Document Format) 2.000beta9 is now available.
As this is the first public announcement about SDF, the
README file is included below.
For historical reasons, SDF is a Perl4-based package,
although it generally runs fine under Perl 5.x.
Porting the SDF libraries to a set of Perl5 modules
is on the to-do list.
Note for POD authors: I'm currently investigating ways
in which SDF can be integrated with POD. For example,
it may be quite simple to embed SDF tables in POD
documents and generate HTML containing these tables.
If you have any thoughts on the best way to do this
integration, please let me know.
Enjoy,
Ian Clatworthy (ianc@mincom.com)
Welcome to SDF (Simple Document Format) 2.000 beta9
===================================================
What is SDF?
------------
SDF (Simple Document Format) is a freely available document development
system which generates high quality outputs in a variety of formats
from a single source. The output formats supported include PostScript(tm),
HTML, Windows(tm) help, MIF, FrameViewer(tm), POD, plain text and RTF.
There is also rudimentary support for generating Unix(tm) man pages.
If the idea of specifying documents in a logical manner via a
simple markup language sounds appealing, SDF may be useful to you.
SDF documents are simple to create and maintain, minimising the time
spent on documentation. In particular, SDF directly supports the
creation and maintenance of large, on-line documentation systems
(including intranets) via centralised hypertext management and
rule-based hypertext generation. As well as normal documents,
SDF is useful for:
* user manuals (paper-based and online)
* online document catalogs
* Delphi(tm) component documentation
* source code listings (pretty printing most languages).
SDF is also good for literate programming, i.e. documentation can
be embedded in the comments of most programming languages and can be
selectively extracted. The embedded documentation can be in any
markup language you like, although there are advantages to using
SDF's markup language.
SDF is freely available for commercial and non-commercial use.
See the LICENSE file for details.
Requirements
------------
SDF has been completely developed in Perl, a popular and highly
portable scripting language. Either Perl 4.036 or 5.003 can be
used, although support for Perl 4 will probably be dropped before
long.
To generate PostScript, SDF currently requires FrameMaker 5.x or
a word processor that can import RTF. (If you have a choice,
use FrameMaker 5.1.1.) To generate Windows help, a help compiler
(e.g. hcp.exe) is required.
Note: The need for a commercial tool for PostScript generation
will probably disappear before long, i.e. SDF can be extended
to use lout or LaTeX, say, as a target format. If you're
interested in assisting with this work, let me know.
Installation
------------
Installation instructions are included in the "SDF User Guide"
(doc/user/ug_sdf.html).
Further Information
-------------------
For the latest information and further details on SDF, see the
SDF home page (http://www.mincom.com/mtr/sdf/).
SDF is available using anonymous ftp. The URLs are:
* ftp://ftp.mincom.com/pub/mtr/sdf - base directory
* ftp://ftp.mincom.com/pub/mtr/sdf/sdf.zip - source and documentation
* ftp://ftp.mincom.com/pub/mtr/sdf/sdfdocs.zip - documentation only.
The following mailing lists are available:
* sdf-users@mincom.com - for general questions
* sdf-bugs@mincom.com - for reporting bugs and fixes.
To subscribe to these lists, send email to
sdf-users-request@mincom.com and/or
sdf-bugs-request@mincom.com for instructions on
using factotum, the majordomo variant that manages these lists.
In short, send email to factotum@mincom.com with a
message body of "subscribe sdf-users" or "subscribe sdf-bugs".
Ian Clatworthy
ianc@mincom.com
13-May-97
------------------------------
Date: Wed, 21 May 1997 09:51:18 -0400
From: Adam Polon <adam@ideas.net>
To: Bryan Hart <bryan@eai.com>
Subject: Re: AWKer needs Perl help
Message-Id: <3382FDD6.6FAB@ideas.net>
Bryan,
This should work:
format ENTRY =
@<<<< @<<<<< @<<<<< etc.
$f1, $f2, $f3 etc.
.
$~ = "ENTRY";
open (FILE, "yourfile") || die "Couldnt open file;
@records = <FILE>;
close (FILE);
foreach $record (@records) {
chop ($record);
($f1, $f2, $f3, etc....) = split (/\,/, $record);
write;
}
exit(0);
Does this help?
Adam
Bryan Hart wrote:
>
> Elton Hughes wrote:
> >
> > Hello All,
> >
> > I have a problem that I hope someone can help me with. I have a
> > text file, that is approximately 200 lines long. Each line represents
> > a single recond, fields are seperated by commas. here is a snippet of
> > what the text file and records look like:
> >
> > 001Z220A,64,59,0,0,0,27,32,0,32,0,,0,0,0,0,56,,0
> > 001Z220B,1,1,0,0,0,0,1,0,1,0,,0,0,0,0,1,,0
> > 001Z220E,17,11,9,8,0,0,0,0,0,2,15.0556,2,0,9,0,12,8.35,0
> > 001Z220J,4,2,2,2,0,0,0,0,0,0,11.215,0,0,2,0,3,6,0
> > 011E220E,45,21,16,11,0,0,0,0,0,5,13.2494,0,0,16,0,35,7,0
> >
> > In awk $1 would be a contract number, $2 the number of enrollments
> > and so on. There are 19 fields overall, sometimes fields are left
> > blank. In Perl they would be undef. This is acceptable, given the
> > nature of the contracts.
> >
> > I need to be able to extract the data from a single line. Using awk,
> > that is very simple. I have finished 86 pages of the llama book, but
> > have not yet found that magic bit of code that puts it all together
> > in a neat little package that I can use, modify, and learn from.
> >
> > BTW, after extract the data, I need to format it for display. I am
> > assuming that printf should handle most of my needs in that respect.
> >
> > If you have a solution, please let me know. I am finding Perl to be
> > almost overwhelming in its capabilities. But it is a fun sort of
> > overwhelming!
> >
> > Thank you for your time,
> >
> > Elton Hughes
> > IT Specialist
> > NOVA Private Industry Council
> >
> > ehughes@novapic.org
>
> _____________begin example perl_______________________
>
> #!/your/perl/here/perl -w
> #
>
> open(DATA, "/your/data/file") or do {
> print "Couldn't open data file!";
> exit;
> };
> my @data=<DATA>;
> close(DATA);
>
> # $contract is the contract number you are searching for
> # this puts all the field elements from a record match on $contract
> # into an array called @record
>
> my @record=split(/,/, grep(/^$contract,/, @data));
>
> ____________end sample perl____________________________
>
> $record[0] is the contract number, $record[1] is # of enrollments, etc
> up to $record[18].
>
> Bryan
>
> --
> -------------------------------
> | Bryan Hart
> | Network Products Engineer
> | Engineering Animation Inc.
> | Phone: (515) 296-5979
> | Fax: (515) 296-7025
> | Email: bryan@eai.com
> | Web: http://www.eai.com/
> -------------------------------
> "A conclusion is simply the place where you got tired of thinking"
------------------------------
Date: 21 May 97 09:06:06 GMT
From: mcohen@arl.mil (Martin Cohen)
Subject: Re: Compounding
Message-Id: <3382BAFE.4A80@arl.mil>
Brian Roberts wrote:
-
- I would like to compound a value x times over.
-
- e.g. 100 compounded up by 10% repeatedly for say 50 times.
-
- How do I get Perl to report each successive compound result in
- table format .
-
- i.e. 100 , 110 , 121 , 133.1 , etc.
-
- Thanks
Another homework problem. Perhaps reading scripts by
other people can help you learn. Remember, just because
it works in every case you try doesn't mean it's correct.
You'd better make sure you understand how it works:
# Perl script to demonstrate compound interest - 5/21/97 mc
# Usage: perl compintr.pl .10 10 (10% for 10 years)
$intrate=shift; $nperiods=shift;
$principal=100;
for ($per=0; $per<=$nperiods; ++$per,$principal*=(1+$intrate)) {
printf "%.2f\n", $principal;
}
--
Martin Cohen - AMSAA-North - Custom House Rm 800 Phila PA 19106-2976
------------------------------
Date: Wed, 21 May 1997 11:31:15 -0500
From: Darin Burleigh <burleigh@hackberry.chem.niu.edu>
Subject: Re: Differentiating between users :- HOW?
Message-Id: <33832353.13C4@hackberry.chem.niu.edu>
Aj wrote:
>
> AS part of departmental research project I have been asked write a
> questionnaire which deals with an emotive subject. With this in mind, I
> feel that I need to identify machines that have completed the
> questionnaire before, so that I am aware of multiple entries from one
> machine (or other attempts to bias the results).
> I know enough to know that I should use a magic(?) cookie to hold a
> variable that I can use to identifly the machine (and is set to expire
> after the questionnaire has finished).
> I'm not after anyway to identify a correspondant personally, mearly
> differentiating between them. Someone suggested capturing the IPAddress
> but didn't say how it could be done.
> Is there a site I can look up for help/inspiration?
> Or any advice that can be offered?
>
> Thanks in advance
> --
> Andrew J Barnes
> University of Surrey, UK
> - The Accidental Tourist -
--
hmm, this looks like yet another CGI question, which of course
belongs in comp.infosystems.www.authoring.cgi;
i suggest we change the name of this group to
comp.lang.perl.misc.not.really.cgi.no.its.not.cgi.even.tho.
perl.is.very.helpful.for.cgi.
==========================================================
- darin
burleigh@hackberry.chem.niu.edu
\\//\\//.\\//\\//.\\//\\//. http://hackberry.chem.niu.edu/HOME/dcb/
'2 kinds of green, look out!' - dieter rot
------------------------------
Date: 21 May 1997 11:44:19 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: File Exsists & get all files
Message-Id: <5lvfq3$sge@web.azstarnet.com>
In article <338191D4.6D73@nettipaja.clinet.fi>,
Lauri Laakso <lauri@nettipaja.clinet.fi> wrote:
>1) How I can check if file Exsists ?
>2) How I can get all files in directory to @files() for reading them.
#!/usr/bin/perl -w
# The wrong way to do it...
my $fname = '/var/log/messages';
my $dir = '/var/log';
system('/bin/sh', '-c', "test -f $fname");
if ($?) { print "file $fname not found\n"; }
else { print "file $fname found\n"; }
my @listing = map {qq/"$_"/} split /[\r\n]+/, `/bin/ls -1 $dir`;
if ($?) { print "can't read dir $dir: $!\n"; }
else { print "files in $dir: ", join(', ', @listing), "\n"; }
exit 0;
# Tim
------------------------------
Date: 21 May 1997 13:52:41 GMT
From: gordon@kootenay.net (Gordon S.)
Subject: Gdbm problems.
Message-Id: <5luun9$44m@spooky.kootenay.net>
I'm trying to compile gdbm with perl 5.003 and Unixware v2.1.
I get the following with make test:
I'm tring to build perl with gdbm and having problems. I get this
error:
lib/gdbm..........Can't load '../lib/auto/GDBM_File/GDBM_File.so' for
module GDBM_File: dynamic linker: ./perl: relocation error: symbol not
found: alloca at ../lib/DynaLoader.pm line 155.
at ./lib/gdbm.t line 14
BEGIN failed--compilation aborted at ./lib/gdbm.t line 14.
FAILED on test 0
Please email me: gordon@knet.kootenay.net
Thanks for the help !
------------------------------
Date: Wed, 21 May 1997 18:56:17 GMT
From: "David S. Patterson" <david.s.patterson@boeing.com>
Subject: Re: Getting File Size
Message-Id: <33834551.2781@boeing.com>
Abigail wrote:
>
> On Mon, 19 May 1997 15:21:39 -0600, cwyatt@cris.com wrote in
> comp.lang.perl.misc URL: news:864072575.454@dejanews.com:
> ++ The UNIX command is 'du + filename'. However, I'm not one to want to make
> ++ a lot of system specific calls. Is there a manner in Perl to echo back a
> ++ given file's size?
>
> perl -we '$_ = shift; printf "%6d %s\n", -M, $_' file
>
> That doesn't simulate du's behaviour for directories though.
>
> Abigail
Abigail,
This is an interesting trick. How did you discover it?
Anyway, the original question asked for a techinque
to get file sizes; the '-M' would have to be changed
to '-s' to accomplish this...
E.g, the following script returns the size and name of any
file given as an argument when run:
#!/bin/perl
$_ = shift;
printf "%6d %s\n", -s, $_;
--
"If the universe is expanding, why can't I find a parking space?..."
David S. Patterson, Sr. Software Engineer
Production Illustration Systems (206) 865-3176
david.s.patterson@boeing.com Mail Stop: 7J80
------------------------------
Date: 21 May 1997 16:48:38 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: getting next line in while
Message-Id: <slrn5o69r6.6mk.bill@granite.sover.net>
In article <5lsoe1$569$1@mark.ucdavis.edu>, Eric Finley wrote:
>How can I get the next line of the file while in the while loop without going through the
>next iteration of the while. My code looks like:
>
>while (<FILE>) {
> if (/foo/) {
> print;
> }
> if (/bar/) {
> print;
> get next line;
> print next line;
> }
>}
>
>I don't want to set some flag and loop through but if I have to I will.
>Any suggestions?
>Thanks,
>Eric
Do it the same way you read it in at the top of the loop: use <FILE>.
Bill
--
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.
------------------------------
Date: 21 May 1997 17:08:21 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: getting next line in while
Message-Id: <5lva65$qpr$1@news.netusa.net>
Eric Finley <etfinley@ece.ucdavis.edu> wrote:
>How can I get the next line of the file while in the while loop without
>going through the next iteration of the while. My code looks like:
>while (<FILE>) {
> if (/foo/) {
> print;
> }
> if (/bar/) {
> print;
$_=<FILE>;
print if defined($_);
> }
>}
Don't forget that "while(<FILEHANDLE>)" is just a handy shorthand for
"while($_=<FILEHANDLE>)".
Elijah
------
note that the "$_=<FILE>;" is /not/ a lookahead, the line gets eaten
------------------------------
Date: Wed, 21 May 1997 11:16:32 -0700
From: Steve Fink <sfink@cs.berkeley.edu>
Subject: Re: Help Use 1 file to edit another
Message-Id: <33833BFF.2BD9@cs.berkeley.edu>
Isn't this what databases are kinda designed for?
My solution:
1. Reload both tables into table1 and table2.
2. DELETE FROM table2 WHERE table2.field1 = table1.field1 AND
table2.field2 = table1.field2;
------------------------------
Date: Wed, 21 May 1997 08:14:37 +0200
From: "Maarten" <maartenn@vademecum.be>
Subject: Re: Installing GD library
Message-Id: <5lvdrb$a9i@news2.Belgium.EU.net>
Thanks Nathan but can someone explain how to build it because I only use
perl on the UNIX machine of my provider and I am not authorized to run
shell commands.
Tx
Nathan V. Patwardhan wrote in article <5lt1q7$ksp@fridge-nf0.shore.net>...
>Maarten (maartenn@vademecum.be) wrote:
>
>: However this does not work since uncompressing the zipped library
results
>: in a set of directories but no trace of a directory named blib. The
only
>: directory I got is libgd.
>
>Hint: Unless I've mis-read your question, you've got to build gd before
>you install it. :-) Hope this helps!
>
>--
>Nathan V. Patwardhan
>nvp@shore.net
>
>
------------------------------
Date: Tue, 20 May 1997 09:09:37 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Mystery characters?
Message-Id: <338166dd.138520@news.tornado.be>
mikane@best.com () wrote:
>I have a script that generates a string representing a path to a file.
>The string will not open the directory. When I hard code the exact same
>string, it does work. I can print the string generated by the script and compare
>it with the hard coded one and they look exactly alike.
>
>I have tried removing blanks, tabs etc with $path=~s/\s//;
>Still no luck. Is there a way to view or print all hidden characters?
You might not need it. You can use tr/// to delete all characters you
consider unwanted.
tr/a-zA-Z0-9_\///cd;
This will delete all characters *not* in the list.
Or use s///:
s/[^\w\/]+//g;
If you insist, you can view those pesky characters. Here are two ways:
1) Replacing control characters by their octal code, preceded by a
backslash. A normal backslash is doubled in this case, to show the
difference:
s/(\\)|([\000-\037\277])/$1?'\\\\':sprintf("\\%.3o",ord($2))/ge;
2) Here is a "real" hexdump routine, that prints the hex dump of the
parameter string to the currently selected output. Use as
&hexdump($problemstring);
sub hexdump {
local($_)=@_;
local($\)="\n";
my($left,$right)=('','');
foreach(split(//)) {
$left.=sprintf(" %.2x",ord);
tr/\040-\276/./c;
$right.=$_;
if (length($right)==16) {
print pack("A52A16",$left,$right);
$left=''; $right='';
}
}
$left and print pack("A52A16",$left,$right);
}
Gent (Ghent, Gand),
Belgium,
Europe,
3rd planet from the sun.
------------------------------
Date: 21 May 1997 16:50:31 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: OO Perl instance variables and lists
Message-Id: <5lv94n$t8f@news.service.uci.edu>
[mailed, posted]
In article <5lv6oc$jgf@vixen.cso.uiuc.edu>,
William L Harrison <harrison@cs.uiuc.edu> wrote:
> I'm hoping someone can answer a (hopefully not too simple)
>question about lists and OO Perl instance variables. Specifically, I
>want to have an instance variable that contains a list. So, for example,
>if I say:
>
> $self->{Foo} = ("blah", "blah", "herman");
>
>then "$self->{Foo}" is set to the last value of "herman" instead of to
>the whole list (which is what I want). Is there some way of having
>"$self->{Foo}" set to the whole list?
William, your problem here is not at all specific to OO methodology.
What you need in this circumstance is a >reference< to a list, which
you can then dereference in the appropriate places.
$self->{foo} = [ 'blah','blah','herman' ];
or, if you prefer:
my @list = qw (blah blah herman);
$self->{foo} = \@list;
What are those [ ] and \ characters doing there? Read all about it in
the perlref man page!
When you need to access list elements, you can do so thusly:
print "$self->{foo}->[2]"; # prints herman
Read about "Hashes of lists" in the perldsc man page for more examples.
It is for this reason that I say your question is only partially about
OO perl. Perl objects are (usually) hashes, and you're trying to
store a list in a hash....
HTH,
Eric
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Wed, 21 May 1997 12:55:33 -0400
From: Michael Iles <thuja@internauts.ca>
Subject: Re: OO Perl instance variables and lists
Message-Id: <33832905.6FB8@internauts.ca>
William L Harrison wrote:
> I'm hoping someone can answer a (hopefully not too simple)
> question about lists and OO Perl instance variables. Specifically, I
> want to have an instance variable that contains a list. So, for example,
>
> $self->{Foo} = ("blah", "blah", "herman");
This doesn't have anything to do with Perl's OO capabilities -- you're
just asking about references. In the above example, just change the
round brackets (which specify a list) to square brackets (which create a
reference to the contained list).
You would then reference the list as,
my @copyoflist = @{ $self->{Foo} };
Have a look at perlref, or page 246 in the Camel.
Mike.
--
Michael Iles, michaeli@dra.com PGP Fingerprint:
sub perl_mind { for ( <LIFE> ) { breathe; } } CB 51 3B 92 A7 25 FB 74
Ceci n'est pas une .sig 68 5A 2D 37 34 D5 39 5B
------------------------------
Date: Wed, 21 May 1997 18:23:56 GMT
From: "David S. Patterson" <david.s.patterson@boeing.com>
Subject: Re: open and redirect
Message-Id: <33833DBC.167E@boeing.com>
Deyoung Hong wrote:
>
> How do I use open to pipe STDOUT to one file and STDERR to another?
>
> For example, I can pipe a command output as open(FH, "/bin/ls |"),
> how about its error output?
>
> Thanks,
> hong@taligent.com
You have an interesting question, but it is a little
too short on specifics. Can you elaborate on the
problem you want to solve?
--
"If the universe is expanding, why can't I find a parking space?..."
David S. Patterson, Sr. Software Engineer
Production Illustration Systems (206) 865-3176
david.s.patterson@boeing.com Mail Stop: 7J80
------------------------------
Date: Wed, 21 May 1997 16:18:56 GMT
From: bah6f@cs.virginia.edu (Paco Hope)
Subject: Page grabber?
Message-Id: <5lv79g$f03@jazz.cs.Virginia.EDU>
Has anyone written a simple program, like churl, which will
download the content of all the things pointed to on a
web page.
Churl already goes out and verifies that all the links on a page are
good. I'd just like to slightly modify it to follow those links one
level and save what it found to local files.
This sort of thing is easy enough with the LWP tools, but I'm hoping
to find it rather than write it.
Thanks,
Paco
--
Paco Hope Computer Systems Engineer
paco@cs.virginia.edu Department of Computer Science
http://www.cs.virginia.edu/~bah6f/ University of Virginia
------------------------------
Date: 21 May 1997 16:57:18 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: Page grabber?
Message-Id: <slrn5o6abe.1ig.I-hate-cyber-promo@news.rediris.es>
In comp.lang.perl.misc,
bah6f@cs.virginia.edu wrote:
>
>Has anyone written a simple program, like churl, which will
>download the content of all the things pointed to on a
>web page.
[...]
<sigh>
If you go read the FAQ, you will find the answer to "how do I get a
remote file?" (maybe not those same exact words)
If you go read the FAQ, you will find the answer to "how do I extract
URLs from a page?"
Put the two together and you have what you ask for.
HTH,
Alain, who really hopes comp.lang.perl.programmer won't just be a Q&A
group.
--
Perl information: <URL:http://www.perl.com/perl/>
Perl archive: <URL:http://www.perl.com/CPAN/>
Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
------------------------------
Date: 21 May 1997 20:15:04 GMT
From: jam@philabs.research.philips.com (John A. Murphy)
Subject: Re: Patch to Perl 5.004 for case-insensitive patterns (REFCASE1)
Message-Id: <5lvl48$1r0$1@philabs.research.philips.com>
In article <5ltj3k$738@news-central.tiac.net>, mike@stok.co.uk (Mike Stok) writes:
|> >Could anyone recommend a version of the 'patch' program which will
|> >properly apply this patch? The linux (Gnu) and the Solaris versions
|> >of 'patch' that I have both choke on this.
|> [mike@localhost perl5.004]$ patch -p1 -N < ../refcsae.patch
|> [...]
|> Patching file regexec.c using Plan A...
|> Hunk #1 succeeded at 826.
|> Hunk #2 succeeded at 840.
|> Hmm... Ignoring the trailing garbage.
|> done
|> [mike@localhost perl5.004]$ find . -name '*.rej' -print
|> [mike@localhost perl5.004]$ patch -v
|> Patch version 2.1
The patch was bombing for me too. I noticed that this looks like it patched
only one file, but the patch I got is supposed to patch 3 different files.
jam@briar:/briar/src/gnu/perl5.004 168 > grep Index perl-5.004.patch
Index: patchlevel.h
Index: regcomp.h
Index: regcomp.c
Index: regexec.c
Are you sure it worked as expected?
Thanks,
Murf
--
John A. Murphy (better known as Erin's dad) jam@philabs.research.philips.com
345 Scarborough Road One one-trillionith of a surprise: picoboo
Briarcliff Manor, NY 10510 millihellen: The beauty needed to launch 1 ship
(914)945-6216 ** My views and opinions do not reflect those of my employer **
------------------------------
Date: 21 May 1997 18:17:20 GMT
From: chip@rio.atlantic.net (Chip Salzenberg)
Subject: Re: Prototype mismatch when forward declaring subs in 5.004
Message-Id: <5lve7g$1gn@news.atlantic.net>
According to jimc@zach1.tiac.net:
>I just got Perl5.004 and found that I couldn't do a forward declaration of a
>subroutine with a prototype unless I also specified the prototype when I
>defined the sub:
And your point is.... ?
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"Men of lofty genius are most active
when they are doing the least work."
-- Leonardo da Vinci
------------------------------
Date: Wed, 21 May 1997 15:15:01 GMT
From: Jim Stern <jstern@world.northgrum.com>
Subject: Re: Q: local in list contex?
Message-Id: <33831175.A94@world.northgrum.com>
Jay Rogers wrote:
> [Article to which JR was replying elided. ... It raised the issue:
> How does `local @local' differ from `local @local[@list]' and why
> does only the latter need parentheses? (`local(@local[@list])`).
> ]
> I can see why this is confusing. I think it would take someone
> familiar with perl's parser to fully explain the distinction between
> localizing one array variable and initializing it, and localizing one
> array variable and initializing a slice of it.
No Perl parser knowledge is needed. Take it from one who has none. :-)
The key is that `local @local' declares one entity to be local,
although that entity, being an array, could contain many entities
of its own.
By contrast, when you localize @local[@list] you localize individual
array elements. You may already be familiar with this behavior in
a different context:
local %SIG; # Localizes the entire %SIG hash
local $SIG{'__WARN__'}; # Localizes one %SIG element only
So if @local has 6 elements and @list=(1,3,5), `local(@local[@list]);'
localizes only elements 1, 3 and 5 of @local. Elements 2 and 4
are not affected. In this case, Perl treats the elements of @local
as if they were separate variables and you already know that `local'
requires parentheses when used to localize more than one variable.
This program illustrates:
=========================
#!/usr/local/bin/perl -w
use strict;
use vars qw(@local);
my @list = (1,3,5);
@local = (0..5);
print "local 1 = @local\n";
{
local(@local[@list]) = (10,30,50);
$local[2] *= 2;
print "local 2 = @local\n";
}
print "local 3 = @local\n";
================================
Its output is:
==========================
local 1 = 0 1 2 3 4 5
local 2 = 0 10 4 30 4 50
local 3 = 0 1 4 3 4 5
===========================
--
Jim Stern -- Views here are my own, not Northrop Grumman's. (El
Segundo, CA)
------------------------------
Date: Wed, 21 May 1997 13:50:41 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff Yoak <jeff@yoak.com>
Subject: Re: Questions of version
Message-Id: <Pine.GSO.3.96.970521134627.735M-100000@kelly.teleport.com>
On Tue, 20 May 1997, Jeff Yoak wrote:
> perl -v reports that This is perl, version 5.003_07 and then some
> information about copyright and a suidperl patch. (At least, it does
> this on my system. :) Does the _07 refer to a build or patch number
> or perhaps some beta?
Yes. :-) It tells me that you've got version 5.003, but it also has seven
sets of experimental patches, bug fixes, new features, mis-features, and
new bugs.
> Is this version substantially out of date?
Yup. Many bugs in 5.003_07 have been found and fixed in 5.004.
> someone who is trying to support some software on this system is
> claiming the reason things aren't working is that we are using an "old
> developer's release of Perl."
They're probably right. Of course, that's no guarantee that the problems
will go away when you start using 5.004!
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Wed, 21 May 1997 17:53:21 GMT
From: "David S. Patterson" <david.s.patterson@boeing.com>
To: liamtu@echonyc.com
Subject: Re: running a script from a script
Message-Id: <33833690.41C6@boeing.com>
liamtu@echonyc.com wrote:
>
> I need to get the result of a perl script for use in a perl script... when
> I open the file in perl I just get the script text. I know there must be a
> simple answer.
>
> Thanks
>
> -Liam
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Liam,
Try enclosing the command for the child perl script in backticks; and
assign a variable to the results. E.g.,
#!/bin/perl
#
# parent perl script
...
$RESULTS = `ChildPerlScript arg1 arg2 ...`;
--
"If the universe is expanding, why can't I find a parking space?..."
David S. Patterson, Sr. Software Engineer
Production Illustration Systems (206) 865-3176
david.s.patterson@boeing.com Mail Stop: 7J80
------------------------------
Date: 21 May 1997 14:42:57 GMT
From: anat0010@ermine.ox.ac.uk (Martin Lee)
Subject: Re: sendmail script
Message-Id: <5lv1lh$60l@news.ox.ac.uk>
Geoffrey V. Brown (an745@traverse.lib.mi.us) wrote:
: I am looking for a way to use perl as a mailing list script.
: What I would like to do is open a file that contains email addresses,
: read each line into an array, then use foreach to send information to
: each person on the list. The function I have seems to work, but the
: script for sendmail doesn't work properly and gives a ton of errors. I
: am using digital unix with perl 5. I'd perfer not to use a module since
: I am unfamiliar with this and fairly new to perl.
This script does exactly that and runs on digital UNIX 4.0:
The file mailist is the list of email addresses, each separated by a carriage
return. Letter.txt is a file containing the letter you wish to send to each
address.
Any problems email me.
#!/usr/bin/perl
$subject="subject";
open (IN,"maillist") || die $!;
open (LET,"letter.txt") || die $!;
@shot=<IN>;
@letter=<LET>;
foreach $add(@shot) {
open (MYL, "| mailx -s \$subject\ $add ");
print MYL ("\n");
print MYL ("@letter\n");
close (MYL);
}
Martin
martin.lee@anat.ox.ac.uk
------------------------------
Date: 21 May 1997 20:09:19 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Size of simple scalar values
Message-Id: <5lvkpf$ir7@news-central.tiac.net>
In article <33833F96.608B@lanl.gov>, Douglas A. Smith <douglas@lanl.gov> wrote:
>I've gone through various books, and I can't find a answer to this
>problem:
>Is there a way to get perl to force the use of more bytes used in
>integer scalars? I don't want to force the use of floating point
>numbers since I need the absolute accuracy of the integer sum.
Have you looked at the Math::BigInt package which will cost you speed but
will free you from a native representation of integers...
NAME
Math::BigInt - Arbitrary size integer math package
SYNOPSIS
use Math::BigInt;
$i = Math::BigInt->new($string);
$i->bneg return BINT negation
$i->babs return BINT absolute value
$i->bcmp(BINT) return CODE compare numbers (undef,<0,=0,>0)
$i->badd(BINT) return BINT addition
$i->bsub(BINT) return BINT subtraction
$i->bmul(BINT) return BINT multiplication
#!/usr/local/bin/perl -w
use Math::BigInt;
$i = new Math::BigInt '123 456 789 123 456 789';
$j = new Math::BigInt '999 999 999 999 999 999 999 999 999';
$tot = new Math::BigInt $i + $j;
print "tot is $tot\n";
$tot += 1;
print "tot is $tot\n";
__END__
says
tot is +1000000000123456789123456788
tot is +1000000000123456789123456789
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 21 May 1997 13:37:59 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Sorting a hash on output - newbie
Message-Id: <adelton.864221879@aisa.fi.muni.cz>
bmcguire@business.uvic.ca (Bruce McGuire) writes:
> Hello.
>
> I am trying to sort a hash (names and counters) by the value of the key.
>
> ie I would like output such as:
> Alpha 034
> Alphas 433
> Beta 001
> Deltas 991
for (sort keys %hash)
{ print "$_\t$hash{$_}\n"; }
> I have looked in "The Camel Book", and on the www.perl.com site, but I can't
> get this right.
It's in the perlfunc man page (keys section) so if you know what
hashes are, you couldn't miss it.
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 21 May 1997 11:22:08 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: Strange effect
Message-Id: <5lvegg$mc9@web.azstarnet.com>
In article <3379122C.41C67EA6@ny.ubs.com>,
Glen Culbertson <nyxcu@ny.ubs.com> wrote:
>The general rule that seems to hold is that if the first action after
>the end of a block with a 'my' declaration is an assignment to a
>variable with the same name, the assignment does not take.
>Can anyone find a situation where this rule fails?
It is fixed in perl5.004, it seems.
Tim
------------------------------
Date: 21 May 1997 12:33:12 -0700
From: galoi@sdcc13.ucsd.edu (Greg)
Subject: system calls
Message-Id: <5lvilo$ec2@sdcc13.ucsd.edu>
I was wondering how to make certain system calls from within a perl
script. For example how could I make a call to the unix command
"date" and store the value returned by "date" in a variable?
greg
galoi@sdcc13.ucsd.edu
--
--greg--
------------------------------
Date: Wed, 21 May 1997 14:26:05 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Time stamping with perl
Message-Id: <fl_aggie-ya02408000R2105971426050001@news.fsu.edu>
In article <5lvaib$j67$1@newbabylon.rs.itd.umich.edu>, adysart@umich.edu
(Aidan Dysart) wrote:
+ You could always just do
Why do you insist upon spawning additonal processes?
+ $timestamp = `date`;
$timeis=localtime(time);
+ Or you could even parse the time field as well like this:
+ ($day,$month,$date,$hours,$mintues,$seconds,$time_zone,$year)
+ =split /:| /, `date`;
Or just:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
If you one needs to, one may substitute gmtime() for localtime() and get
an "absolute" time and date.
See: man perlfunc or the Camel book.
James
--
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 21 May 1997 15:45:58 GMT
From: marius@randomc.com (Richard Dows)
Subject: Unusual Sys::Syslog behaviour ?
Message-Id: <5lv5bm$8i6@news1.randomc.com>
I wanted to use Sys::Syslog, and so I tested it with a small script. I get
an error like so:
Undefined subroutine &Sys::Syslog::hostname called at /usr/local/lib/perl5/Sys/Syslog.pm line 92.
BEGIN failed--compilation aborted at stest line 3.
Now - in the Syslog.pm module it states that I can set the $host manually
via $Syslog::host, and I set it just after my 'use Sys::Syslog;' line,
yet I still get the same error.
I'm running Sparc10, with Solaris 2.5.1 and perl5.003 - has anyone else
noticed the same problem on the same platform (or even not on the same
platform), and if so - is there a quick solution to this ?
Thank you,
Richard Dows
marius@randomc.com
------------------------------
Date: Wed, 21 May 1997 17:00:26 GMT
From: Magius@Greenwood.net (Jeremy T. Elston)
Subject: Re: Variables In Data Structures.
Message-Id: <5lv9rl$lvn$1@bigdog.ais-gwd.com>
In article <5lur6b$sb9@snews5.zippo.com>, dharma@msys.net (Ron Picker) wrote:
$dom{Var1} is not defined yet. Appears the key-value pair is assigned
"simultaneously".
Suggestion would be to assign separately.
$dom{Var1} = "bar";
$dom{Var2} = "foo $dom{Var1}";
>I'm attempting to use variables, without success, in data structures
>as demonstrated in the following trivial test case.
>
>#!/usr/bin/perl
>%dom = (
> "Var1" => "bar",
> "Var2" => "foo $dom{Var1}"
>);
>
>print "$dom{Var1}\n"; #case 1
>print "$dom{Var2}\n"; #case 2
>
>I expected to have "foo bar" printed for print case 2 but only get
>foo.
>
>Please provide suggestions.
>
>Thank you.
>
>
>Ron Picker
>DharmaSystems
>dharma@msys.net
>Druid Hollow
>French Creek, WV.
>
------------------------------
Date: Wed, 21 May 1997 09:31:06 +0000
From: Mark Stokes <mstokes@nbn.com>
Subject: Webchat Perl Programmer Needed
Message-Id: <3382C0DA.5894@nbn.com>
Sterling Software, on a contract with NASA, is seeking a Perl
programmer to help build custom webchat and web interface software.
Optimized Perl experience is required.
The dates of work are June, July, and August, 1997. You must have Perl
experience, be able to work under deadlines, and English language
fluency is required. Geographic location doesn't matter.
Please send inquiries and letter of qualifications to:
Andrea McCurdy
andream@quest.arc.nasa.gov
Deadline for application is June 1, 1997.
------------------------------
Date: Wed, 21 May 1997 13:21:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nils Sowen <webmaster@rhein-ruhr.de>
Subject: Re: Webpage via CGI !
Message-Id: <Pine.GSO.3.96.970521131017.735F-100000@kelly.teleport.com>
On Tue, 20 May 1997, Nils Sowen wrote:
> Newsgroups: comp.lang.perl.misc, comp.lang.perl,
> comp.lang.infosystems.authoring.cgi
If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use comp.lang.perl.misc (and other valid Perl newsgroups)
instead.
news:news.announce.newgroups
[ Snipped: A description of a user filling out a form with a new username,
real name, and password, then submitting it. ]
> The user will be added to my passwd (linux).
As soon as you allow everybody in the world to add entries to your passwd
file, you'll have security problems. (Any person could enter a fake name,
get an account, and start exploring your system for ways to cause damage
or to access other things. One of the first things they are likely to do
is to download the passwd file and start trying to crack the root
password.)
One way to have better security is to simply e-mail the form info to a
human being, who can use the telephone to verify that, at least, the
person is somebody who is willing to give out their real telephone number.
Another is to request their mailing address, then mail them a postcard
with their password. If they don't give a valid mailing address, they
won't be able to log in, of course.
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 20 May 1997 16:53:03 GMT
From: wpollans@scrap.encore.com (Warren Pollans)
Subject: widget interface?
Message-Id: <EAHo8G.J1J@encore.com>
Is there a widget toolkit for perl? tk is to tcl as ??? is to perl? Right
now I'm using perl4 - planning to start learning perl5.
Thanks,
Warren
------------------------------
Date: Wed, 21 May 1997 13:35:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Year 2000 compliance
Message-Id: <Pine.GSO.3.96.970521133335.735J-100000@kelly.teleport.com>
On 20 May 1997, Eli the Bearded wrote:
> (Never overestimate the bandwidth of
> a stationwagon full of tapes in a battle against M$.)
I don't know. The folks increasing the density of storage media are
working pretty hard. I suspect that by the time the 2038 version of
Windows comes out, you'll be able to haul it around in a station wagon.
That is, without the docs. And using a 2038-technology station wagon, of
course.
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
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 509
*************************************