[7062] in Perl-Users-Digest
Perl-Users Digest, Issue: 687 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 1 02:07:21 1997
Date: Mon, 30 Jun 97 23:00:24 -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 Mon, 30 Jun 1997 Volume: 8 Number: 687
Today's topics:
Re: Any Module for TAR archives available? (Randy J. Ray)
CGI Checklist jlawrenc@acc.jc.edu
Development Proposals (Patrick n' Nicole Miller)
Empty loops... <dav@umiacs.umd.edu>
Re: EMULATING 'C' STRUCTURES <zenin@best.com>
Re: Exporting Variables... <rootbeer@teleport.com>
How do I (can I) compile a Perl script (David Gotz)
Re: How do I decipher Time format? (Matthew Burnham)
Re: How do I remove spaces (or other chars) from a stri (Craig Berry)
Re: How to add users to .htpasswd (David Bonner)
Looking for Chicago CGI Programmer <mvelasco@new2000.com>
Looking for text indexing scripts/modules (Woodrow Hill)
Need example of Tputs for single line terminal output (Jonathan Rozes)
Re: Pattern matching question (Tim Smith)
Re: PATTERN REPLACE (Steven Alexander)
Re: question about dupicate files when dynamically crea (Tim Smith)
Re: set-u-id perl script <qzyn64@tpc.natp.gmeds.com>
Re: simple open statement gives me error <psrc@corp.airmedia.com>
Simulating 401 Authorization <wrg2@isis.msstate.edu>
string to integer HELP !! <davidvr@redestb.es>
Subroutines as arguments problem <dwc3q@mamba.cs.Virginia.EDU>
Re: Subroutines as arguments problem <che@imsa.edu>
Re: Subroutines as arguments problem <jpm@iti-oh.com>
system(..) for Win32 apps. (CHAN TANG Eric-Aubert)
Re: Unsupported socket function <keys@babylon5fan.corn.on.the.cob>
Re: Update Access or Foxpro Database <coke@adrenalin.com>
Win32::Internet and firewall problems. <perrella@ehsn18.cen.uiuc.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jun 1997 10:44:19 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: Any Module for TAR archives available?
Message-Id: <uowlo3st50c.fsf@tremere.ecte.uswc.uswest.com>
Michael Schilli <mschilli@blacksun.com> writes:
> does anybody have a Perl Module to create, manipulate and read
> tar-Archives?
>
> Haven't found anything on CPAN so far ...
This shouldn't be too difficult of a task... are there any good pointers to
docs on the tar file format?
Randy
--
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS Phone: (303)595-2869
Denver, CO rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin
------------------------------
Date: Mon, 30 Jun 1997 15:38:25 -0600
From: jlawrenc@acc.jc.edu
Subject: CGI Checklist
Message-Id: <867702442.24034@dejanews.com>
I'm writing a CGI script that prompts the use for a key word to search a
database by. The results are then displayed in a table with a
checklistwhich allows the user to narrow down the list by checking the
recordsthey wish to keep. Those records are then displayed in another
table. Orat least that is what I hope will happen. What I can't figure
out is howto get the checked records to a second cgi script to redisplay
them. Isthis the right way to go about it, or is there an easier way
that I'mmissing? Thanks in advance for any light you can shed on this
one! :)foreach $key1 (sort {$slides{$a}{'NUMBER'} <=>
$slides{$b}{'NUMBER'}} keys %slides) {
$slides{$key1}{'NUMBER'}=sprintf("%.3f", $slides{$key1}{'NUMBER'});
$image = "n:/slides/images/" . substr ($slides{$key1}{'NUMBER'},0,1) .
"/" . substr ($slides{$key1}{'NUMBER'},0,2) . "/" . substr
($slides{$key1}{'NUMBER'},0,3) . substr ($slides{$key1}{'NUMBER'},4,3)
.".gif"; if ($slides{$key1}{'SCANNED'} eq 'X') { print
"<TR> <TD><center><input type=\"checkbox\"
name=\"checkbox\" value=\"1\"></c></TD> <TD><a
href=\"$image\">$slides{$key1}{'NUMBER'}</a></TD>
<TD>$slides{$key1}{'KEYFIELD'}</TD>
<TD>$slides{$key1}{'LOCAT'}</TD>
<TD>$slides{$key1}{'NOTES'}</TD> </TR>\n";}
else { print "<TR> <TD><center><input
type=\"checkbox\" name=\"checkbox\" value=\"1\"></c></TD>
<TD>$slides{$key1}{'NUMBER'}</TD>
<TD>$slides{$key1}{'KEYFIELD'}</TD>
<TD>$slides{$key1}{'LOCAT'}</TD>
<TD>$slides{$key1}{'NOTES'}</TD> </TR>\n";} }print
"</Table><p>\n";print <<END;<form method=POST
action="http://www.npsc.nbs.gov/cgi-bin/slidespk.cgi"><P>If you wish to
narrow your results, check the box next to the record(s) you wish to
keep, and a new list will be created for you.<P><input type=submit
value=" Submit Search "> <input type=reset value="Clear
Entries"></FORM>END $db->Close();
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 30 Jun 1997 16:01:05 GMT
From: support1@registerline.com (Patrick n' Nicole Miller)
Subject: Development Proposals
Message-Id: <5p8l81$3f2@chile.earthlink.net>
Regi$ter Online!'s "Design-YOURware" is a programming
proposal and creativity tool allowing you to design the specific type
of software you need and want.
The total package of "Design-YOURware" is summed up as a
group of programming proposals presented to programmers and
attracting bids for the compilation of your creations.
Within this package, you'll find 27 separate programming proposals
containing all the components you may ever want in a program with
options to add your own ideas. All coding and/or programming is
performed by the software developer who replies with an
appropriate bid, and signs a private "work-for-hire" contract with
you (sample included).
After you have edited and saved the proposal to read as you want it
to, copy and paste it into your email program or newsgroup
program to send it to where you will attract bids (areas listed in file)
and prepare your "work-for-hire" contract (sample included) while
you wait for responses.
Requires a Rich Text Format Editor and Unzipping Program.
Download Design-YOURware @ http://registerline.com/yourware.htm
or email yourware@registerline.com!
------------------------------
Date: Mon, 30 Jun 1997 13:53:27 -0400
From: "David J. Clark" <dav@umiacs.umd.edu>
Subject: Empty loops...
Message-Id: <33B7F297.60D694BE@umiacs.umd.edu>
In searching an array, I want to say something like:
while($array[$i++] ne $string_to_look_for);
I do this kind of thing all the time in C, but perl5.002 (what I have at
work) won't let me get away with it. I need to either use while as a
statement modifier or it needs to be followed by a block (unless I'm
missing something... if so clue me in). So I have two questions:
1) What is the reasoning behind requiring a block (or a preceeding
statement) for a loop?
2) What is the generally accepted way of handling a loop where nothing
is done internally?
Right now I just have:
while(...) {0}
which works, but seems kind of arbitrary.
Thanks,
Dav
------------------------------
Date: 30 Jun 1997 14:33:43 GMT
From: Zenin <zenin@best.com>
Subject: Re: EMULATING 'C' STRUCTURES
Message-Id: <5p8g47$mnc$1@nntp2.ba.best.com>
Ansa Sekharan <ansa@informatica.com> wrote:
> I have a structure defined in a C program as
> struct PACKET {
> long fld1,
> int fld2,
> char fld3;
> }
> HOW DO I EMULATE THIS STRUCTURE IN PERL..
Use a hash:
%PACKET = (
fld1 => 1.000000000000000,
fld2 => 42,
fld3 => 'a'
);
myFunction %PACKET;
## or
myFunction \%PACKET;
It depends if you want to call by value, or referance.
Perl is a losely typed language, so you don't really have
a way to force some fields to be ints, some to be longs, and
some to be strings. They can wonder back and forth at will.
This is perfectly valid:
$foobar = 42;
myFunction $foobar;
$foobar = "some string";
myFunction $foobar;
Yes, you can force it, but it's not easy and there is rarely
if ever a good reason to.
Flip through the Words of the Great Blue Camel. You'll be
glad you did.
> IN OTHER
> WORDS HOW CAN I WRITE THE SAME STRUCTURE IN PERL
> AND PASS IT TO A FUNCTION...
No need to yell. Please oil your caps lock key.
--
-Zenin
zenin@best.com
------------------------------
Date: Mon, 30 Jun 1997 16:40:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "D.Burdick" <burdick@fcs.netguard.net>
Subject: Re: Exporting Variables...
Message-Id: <Pine.GSO.3.96.970630163754.19121U-100000@kelly.teleport.com>
On Mon, 30 Jun 1997, D.Burdick wrote:
> I am having a problem with exporting variables, maybe
> someone can help. I have used the method as described
> in the Camel book, but am trying to export my variables
> using a different method.
What's wrong with the tried-and-true method? If you're trying a different
way that doesn't work, maybe that's the problem! :-)
> package MyPackage;
> @ISA = qw(Exporter);
I see that you haven't require'd Exporter. That might be part of the
problem. 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: 30 Jun 1997 17:00:48 GMT
From: gt1252a@acmex.gatech.edu (David Gotz)
Subject: How do I (can I) compile a Perl script
Message-Id: <5p8oo0$igd@catapult.gatech.edu>
Hello,
I've been learning Perl for the last week or so and have a question:
Is it possible to compile a perl script into an executable, and if so, how?
Right now, I have a text file with executable permissions, and the line
#! /usr/.../perl at the top.
Is there any way to make it an executable, similar to what happens with
a language like C?
Thanks,
Dave Gotz
gotz@cc.gatech.edu
--
\\|// David H. Gotz gotz@cc.gatech.edu
(o o) 150 4th Street \/ \|/
( ) Atlanta, GA 30313 /\ |
------------------------------
Date: Mon, 30 Jun 1997 17:25:59 GMT
From: danew@enterprise.net (Matthew Burnham)
Subject: Re: How do I decipher Time format?
Message-Id: <33bba9ee.3131280@194.72.192.4>
"mashfiel" <ashfield.matthew@miti.nb.ca> wrote:
>sorry if this was double posted
It wasn't, well at least it hasn't been yet (at least where i've picked
it up from.
>I have what I think to be a rather difficult question. I have a log of
>occurences of things, the log being updated every 5 minutes for 24 hours.
>Each entry in the log has a time entry given in the time() format ( ie.
>866575492, which would translate somewhow into Tue Jun 17 16:24:42 97). My
>question is how does Perl do this translation. I used the localtime()
>function to do it for me, but I think I need to know how it did this. This
>is because as mentioned before, my log polls every 5 minutes. However if I
>only want to extract the entries from say 8:30 am to 4:30 pm, I must have
>to figure out how the localtime() function deciphers hours, minutes and
>seconds. My program has to work for different days, so my extract has to be
>able to only extract based on hours minutes and seconds, not days or years.
>Any help/advice would be greatly appreciated. Note: I looked in the man
>page and it said that the time() function got broken down into:
>"9-element array" set up as
>"$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst"
>but how does 866575492 get broken into these 9 elements. Going by this,
>then $sec couldn't be bigger than 9 could it?
>Anyway this is probably all very confusing, but any help/advice would be
>greatly appreciated, preferably via email.
I think I know what you're trying to do and I think localtime() will do
it for you:
I've jsut tried the following script:
print "localtime:" . localtime() . "\n";
print "localtime(866575492):" . localtime(866575492);
which gives me:
perl test.pl
localtime:Mon Jun 30 13:48:52 1997
localtime(866575492):Tue Jun 17 20:24:52 1997
other functions that might accept the number in brackets are gmtime()
and time().
I hope that that helps.
--
Matthew Burnham, Manager, MindWeb | danew@enterprise.net
Commercial web design and hosting, reasonable rates
UKP24/Mb/Year for DIY space | mindweb@pobox.co.uk
FTP, CGI, password protection, etc. too!
http://www.mindweb.co.uk/
------------------------------
Date: 30 Jun 1997 18:24:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do I remove spaces (or other chars) from a string etc?
Message-Id: <5p8tki$2am$1@marina.cinenet.net>
X (eeiX@eei.ericsson.se) wrote:
: I'm only starting this language so no sniggering if this seems pityfully
: easy!!!
:
: For example say I wanted to remove the spaces from the following line:
:
: 152 41-cax 102 577
It is pitifully easy...which is why a two-minute look at the copious
online doc will answer it for you. Best of luck!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 30 Jun 1997 17:44:09 GMT
From: dbonner@cs.bu.edu (David Bonner)
Subject: Re: How to add users to .htpasswd
Message-Id: <5p8r99$fsc@news.bu.edu>
Vince Betro (vinbetro@vantek.net) wrote:
: How do I add users and passwords to an .htpasswd file using the htpasswd
: program? I am using a PERL script on a UNIX server.
Uhm...not exactly the right newsgroup to be posting to, unless it's a
specific question about Perl. All that aside, I'm assuming you're using
ncsa or apache. This comes from issuing a 'htpasswd -h' command:
Usage: htpasswd [-c] passwordfile username
The -c flag creates a new file.
Try looking at the server company's web site for more info on access
restriction.
--
------------------------------------------------------------------------
"it's the word's suppression that gives it the power, the violence,
the viciousness." -lenny bruce
------------------------------------------------------------------------
david bonner - dbonner@cs.bu.edu - http://www.cs.bu.edu/staff/TA/dbonner
------------------------------
Date: 30 Jun 1997 19:06:21 GMT
From: "Michael J. Velasco" <mvelasco@new2000.com>
Subject: Looking for Chicago CGI Programmer
Message-Id: <01bc8588$583d7380$a33cf1cf@WorldWideAccess.wwa.com>
I run a consulting practice and am looking for a freelance CGI programmer
(other talents also appreciated) that would like to partner with us on some
projects or work as our exclusive Perl source. Please email me back at
mvelasco@new2000.com. Thanks!
--
Michael Velasco
"The path of service leads from charity to justice."
------------------------------
Date: Tue, 01 Jul 1997 03:38:13 GMT
From: whill@mindspring.com (Woodrow Hill)
Subject: Looking for text indexing scripts/modules
Message-Id: <33b879cc.10780018@news.mindspring.com>
Keywords: index database script module
Greetings!
I'm a fairly new Perl programmer, and I have been given a
project to search through a set of archives from a mailing list, and
generate a index of the files. The basic idea is to keep the actual
files gzipped, and to search the index and then pop out the appropiate
file when necessary.
Well, actually, she wants to generate the article from the
index itself, if that might save space...anyway, does anyone know of a
place to go and find what I seek? I have the man pages, The Camel
book, and have looked in the CPAN archives as well as a couple of
other on-line archives, to no avail. (Would using DBM be an option
here? The archives are about 200-300 k each f a weeks worth of
compressed articles.)
Anyone who help will be noted and logged in the web site for
this archive!
----Woodrow Hill
------------------------------
Date: 30 Jun 1997 19:42:22 GMT
From: jrozes@gumbo.tcs.tufts.edu (Jonathan Rozes)
Subject: Need example of Tputs for single line terminal output
Message-Id: <5p926u$ocs$2@d2.tufts.edu>
Hi--
Sorry for the amibiguous subject heading, but I'm not quite sure what
the proper term is for what I want to do.
In short, I have a script that is going to do something several
thousand times and I want it to report its progress by printing the
percentage of work it has done as it runs. So what I need the script
to do is overwrite the same line on my screen over and over, updating
the numeric value as it progresses (as opposed to filling multiple
lines with new values). I think Tputs is what I need to use, but the
Term::Cap documentation assumes I know more than I do.
Can somebody give me an example of this or point me to a tutorial
that will help me figure it out?
Thanks,
jonathan
--
+++ Jonathan Rozes, Unix Systems Administrator, Tufts University
++ jrozes@tcs.tufts.edu, http://rozes.tcs.tufts.edu/
+ Remember, there's a difference between kneeling down and
bending over --FZ
------------------------------
Date: 30 Jun 1997 11:42:04 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: Pattern matching question
Message-Id: <5p8uls$c5o@web.azstarnet.com>
In article <33B75900.719E@icd.com.au>, P Nibbs <pnibbs@icd.com.au> wrote:
>Hi All,
>if ($ENV{REMOTE_ADDR} == /203.[0-63].[0-255].[0-255]/){
In addition to what others have said, you're misunderstanding what the
[...] does in a regular expression. It's a character class, meaning
"match one of any of these characters". So in the first character
class above you're matching ONE of 0, 1, 2, 3, 4, 5, 6 or 3. In the
second and third character classes you're matching ONE of 0, 1, 2, 5 or
5. In other words, the following string would match: "203.4.0.5".
Also, the '.' means "match any single character", so the following string
would also match: "203.111.56.11" (since you didn't anchor the regex
with '$' at the end, it doesn't have to match the whole string).
If you're sure that the string will be in dotted-quad format (I think
you can trust the web server for this one), just use split. If you don't
trust the format of the data, use a regex and make sure you anchor your
regex at the beginning and then end, escape any special characters (like
the period) and use character classes properly.
Enjoy,
Tim
------------------------------
Date: 30 Jun 1997 22:08:41 -0700
From: stevena@kelly.teleport.com (Steven Alexander)
Subject: Re: PATTERN REPLACE
Message-Id: <5pa3cp$sg0$1@kelly.teleport.com>
In article <33B83874.A8C59220@qntm.com>, Jay Weaver <jweaver@qntm.com> wrote:
>I would like to simplify my pattern replace process. I currently type
>the following command at the prompt:
>find . -print | xargs perl -pi -e 's#oldpattern#newpattern#g'
>This edits all files from . down.
>
>I would like to just type this:
>replace oldpattern newpattern
>
>I would also like to avoid this error when encountering directory names,
>locked files, etc.:
>Can't do inplace edit: file is not a regular file at replace line 8, <>
>chunk 25.
On the latter query, do a man find to learn the parameters
it needs to cause it to reject anything that's not a plain file.
Steven Alexander
stevena@teleport.com
http://www.teleport.com/~stevena/
------------------------------
Date: 30 Jun 1997 11:28:03 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: question about dupicate files when dynamically creating them
Message-Id: <5p8trj$6sc@web.azstarnet.com>
[cc'd to poster]
In article <33b753f7.38923033@news.tamu.edu>,
Shane 'Fishman' Sherman <fishman@vvm.com> wrote:
>I know that i can create a file only if it doesnt exist with the fcntl
>module but i am looking for a way to implement it without using any
>modules.
Just test to see if it exists before you create it:
if (-e $new_filename) {
warn "file $new_filename is already used, pick a different name\n";
return undef;
}
open NEWFH, "> $new_filename"
or warn("can't open > $new_filename: $!\n"), return undef;
# ...
------------------------------
Date: Mon, 30 Jun 1997 12:53:13 -0400
From: Scott Hammer <qzyn64@tpc.natp.gmeds.com>
To: Yuan-fang Wang <yfwang@cs.ucsb.edu>
Subject: Re: set-u-id perl script
Message-Id: <33B7E479.258@tpc.natp.gmeds.com>
Yuan-fang Wang wrote:
> However, the same script which runs fine as WWW developed problems
> when runs as me through the above set-u-id mechanism. I traced the
> problem to a line which says:
>
> $date = `date`;
>
Yuan-fang,
I have encountered the same type of problems many times. I write quite
a few setuid Perl scripts myself. I think the key to your problem is
that your PATH environment variable is insecure (contains a . or some
other problem). My workaround is to explicitly declare a minimal PATH
for my scripts. For example:
$ENV{'PATH'} = '/usr/bin:/usr/local/bin:/common/site/bin';
Also, use the "untainting" mechanism described on page 358 of
Programming Perl, second edition (page 258, first edition) for any
command-line arguments or environment variables use in system calls,
backtick commands or file operations.
--
Scott Hammer qzyn64@tpc.natp.gmeds.com
GM Truck Engineering (248) 753-4739 (8-238)
------------------------------
Date: Mon, 30 Jun 1997 13:47:53 -0400
From: Paul S R Chisholm <psrc@corp.airmedia.com>
To: SS <ss51@columbia.edu>
Subject: Re: simple open statement gives me error
Message-Id: <33B7F149.5858@corp.airmedia.com>
SS wrote:
> open(MOL1, "$ARGV[0]") || die "$ARGV[0] doesn't exist\n";
> Possible typo: "MOL1" at int_area line 3
Maybe this is the only reference to the identifier "MOL1"? (If you just
want to see if a file exists, try "-e $ARGV[0]" instead.) --PSRC
------------------------------
Date: Mon, 30 Jun 1997 12:35:57 -0500
From: "Roger a.k.a. Yoyodyn" <wrg2@isis.msstate.edu>
Subject: Simulating 401 Authorization
Message-Id: <Pine.SOL.3.96.970630123518.10406B-100000@Ra.MsState.Edu>
I am trying to simulate the user and password prompt that is generated
when the HTTP server asks for authorization. I can get the prompt to come
up if I used a full header and send the browser a 401 status.
However, I have no idea what happens next. Can someone tell me how to
capture the info from that dialog so that my perl program can use it.
this is basicly what I have right now :
#!/usr/local/bin/perl
$server_protocol = $ENV{'SERVER_PROTOCOL'};
$server_software = $ENV{'SERVER_SOFTWARE'};
print "$server_protocol 401 Authorization Required", "\n";
print "Server: $server_software", "\n";
print "Content-type: text/html", "\n\n";
I have also tried useing Java Script to create my own window and set a
Cookie, but I dont know how far I will get with that approach.
Any information would be helpful.
Roger
wrg2@ra.msstate.edu
Roger Garvin http://www2.msstate.edu/~wrg2
_ ,
' ) / /
/ / ____ , ______/ __ , ____
(__/_(_) (_/___(_) (_/_/ (_/_/ / <_
// / /
(/ ' '
Yay, though I walk through the valley in the shadow of Gates,
I will fear no windows.
------------------------------
Date: Fri, 27 Jun 1997 23:42:51 +0200
From: david <davidvr@redestb.es>
Subject: string to integer HELP !!
Message-Id: <33B433DB.2EFCF8A8@redestb.es>
Hello, I'm David.
I need that someone help me.
I want to convert a string into a integer number. How can i do it?
Thanks.
davidvr@redestb.es
------------------------------
Date: Mon, 30 Jun 1997 18:18:42 GMT
From: "David W. Coppit" <dwc3q@mamba.cs.Virginia.EDU>
Subject: Subroutines as arguments problem
Message-Id: <Pine.SOL.3.96.970630113208.23272A-100000@mamba.cs.Virginia.EDU>
Can someone explain the difference to me?
(relfield and uniq are subroutines that return an array.)
Why does this work:
@temp = relfield(@funcdefs,1);
@temp = uniq @temp;
@filenames = sort @temp;
..but this doesn't?:
@filenames = sort uniq relfield(@funcdefs,1);
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: 30 Jun 1997 13:47:03 -0500
From: Ben Gertzfield <che@imsa.edu>
Subject: Re: Subroutines as arguments problem
Message-Id: <y8shgeg6i8o.fsf@imsa.edu>
>>>>> "David" == David W Coppit <dwc3q@mamba.cs.Virginia.EDU> writes:
David> Can someone explain the difference to me?
David> (relfield and uniq are subroutines that return an array.)
David> Why does this work:
David> @temp = relfield(@funcdefs,1); @temp = uniq @temp;
David> @filenames = sort @temp;
David> ..but this doesn't?:
David> @filenames = sort uniq relfield(@funcdefs,1);
Sort can take a few different kinds of things as arguments. In your
first case, you're passing it a list -- @temp. That defaults to
sorting in alphabetical order. However, in your second case, you're
actually passing sort a *function* -- "uniq".
When you give sort a function and a list as arguments, it treats the
function as criteria for sorting the list.
Try using some parens. sort (uniq(relfield(@funcdefs, 1))) may work
better for you.
--
Brought to you by the letters L and S and the number 7.
"Someday, we will be." "For it has already begun." -- Akira
Ben Gertzfield <http://www.imsa.edu/~wilwonka/> Finger me for my public
PGP key. I'm on FurryMUCK as Che, and EFNet and YiffNet IRC as Che_Fox.
------------------------------
Date: 30 Jun 1997 19:27:57 GMT
From: "Joshua Marotti" <jpm@iti-oh.com>
Subject: Re: Subroutines as arguments problem
Message-Id: <01bc858b$ed4260f0$36601ec6@bach>
have you tried using braces like so...
@filenames = sort (@{uniq @{relfield(@funcdefs,1)}});
Don't know if it will work, but you have to tell perl that the sub will
return an array (@)...
Hope that helps,
--
Joshua Marotti
David W. Coppit <dwc3q@mamba.cs.Virginia.EDU> wrote in article
<Pine.SOL.3.96.970630113208.23272A-100000@mamba.cs.Virginia.EDU>...
>
> Can someone explain the difference to me?
>
> (relfield and uniq are subroutines that return an array.)
>
> Why does this work:
>
> @temp = relfield(@funcdefs,1);
> @temp = uniq @temp;
> @filenames = sort @temp;
>
> ..but this doesn't?:
>
> @filenames = sort uniq relfield(@funcdefs,1);
>
> 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: 30 Jun 1997 20:01:43 GMT
From: chantane@JSP.UMontreal.CA (CHAN TANG Eric-Aubert)
Subject: system(..) for Win32 apps.
Message-Id: <5p93b7$6ga@epervier.CC.UMontreal.CA>
I tried the following :
my $COMMAND = "wgnuplot.exe ";
my $parameters = "plot.cmd";
system($COMMAND.$parameters);
but the program (GNUplot for Win32) never exit by itself,
I have to "kill the task".
Executing directly the command (in a DOS window) :
wgnuplot.exe plot.cmd
works perfectly, the program exit as it should.
Then the problem can be from the GNUplot.
I tried with the DOS and Win16 version of GNUplot and
both works fine (with the "system(..)").
Any help would be appreciated.
--
____________________________________________________________
(3/1R&() Eric-Aubert Chan Tang <chantane@JSP.UMontreal.CA>
http://www.jsp.umontreal.ca/~chantane/
------------------------------
Date: Mon, 30 Jun 1997 21:46:22 -0600
From: Keys <keys@babylon5fan.corn.on.the.cob>
Subject: Re: Unsupported socket function
Message-Id: <33B87D8E.C2345AB0@babylon5fan.corn.on.the.cob>
KaushalSha wrote:
>
> Can anyone tell me what the following error message means.
> Unsupported socket function "getprotobyname" called at tmp.pl line 12
It means you don't have support for the socket function
"getprotobyname." Possibly, the system you're using doesn't fully
support sockets... If we knew what you're using, we'd have a better
idea.
--
Keys
Spam sucks. To reply, please change "corn.on.the.cob" to "com" in my
return address...
For my PGP key, mail me with "send PGP key for Keys" in the subject...
------------------------------
Date: 30 Jun 1997 17:28:52 GMT
From: "Chris Oke" <coke@adrenalin.com>
Subject: Re: Update Access or Foxpro Database
Message-Id: <01bc857b$428f7220$371c9bcf@pc10.adrenalin.com>
Win32::ODBC, available from CPAN or http://www.roth.net/odbc/, will allow
you to update the database.
Chris
Harold J. Fennell <harold@spectra.net> wrote in article
<5p6646$l22$1@usenet87.supernews.com>...
> I was wondering if there is a package that is available for updating a
Access
> of Foxpro program without having to program with it in Perl. The Perl
would
> be run on a windows machine and runs either Access or Foxpro(haven't
decided
> what machine to put it on).
------------------------------
Date: Mon, 30 Jun 1997 15:37:26 -0500
From: perrella andrew c <perrella@ehsn18.cen.uiuc.edu>
Subject: Win32::Internet and firewall problems.
Message-Id: <Pine.SOL.3.95.970630153416.9666C-100000@ehsn18.cen.uiuc.edu>
When I try to use the Perl Module Win32::Internet from behind my
corporate firewall I get an
error: [12007] server name not resolved
message.
However all of the commands work when I retreive files from within my
intranet.
DOes anyone know how to work around this?
Thanks,
Andrew Perrella
perrella@uiuc.edu
------------------------------
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 687
*************************************