[9044] in Perl-Users-Digest
Perl-Users Digest, Issue: 2662 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 21 14:07:19 1998
Date: Thu, 21 May 98 11:00:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 21 May 1998 Volume: 8 Number: 2662
Today's topics:
Re: Benchmark: local filehandle vs. Filehandle.pm <keithmur@mindspring.com>
CGI.pm/PERL question <korey@ncsu.edu>
determining if an array exists <falkenl@hotmail.com>
Re: determining if an array exists (Mike Stok)
Re: GNU attacks on the open software community. (Ken Fox)
Re: GNU attacks on the open software community. <sbo@nortel.ca_NO_SPAM>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 21 May 1998 12:00:48 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Benchmark: local filehandle vs. Filehandle.pm
Message-Id: <35645DC0.3A09F04F@mindspring.com>
My results, running on a Pentium 75 with Win95, Sarathy Perl
distribution, were:
Benchmark: timing 100 iterations of a, b...
a: 69 secs (69.33 usr 0.00 sys = 69.33 cpu)
b: 51 secs (51.21 usr 0.00 sys = 51.21 cpu)
Of course, I didn't use '/etc/passwd' for my file!
(Jari Aalto+mail.perl) wrote:
>
> After seeing the discussion about the slowness of Filehandle
> package I wanted to see just how slow it would make code.
>
> jari
>
> Benchmark Test
>
> 5.3 Local filehandle vs. Filehandle.pm
>
> In p.51 and p.194 in [camel] offer two ways to use filehandles
> Notice that you don't see close statement in the Filehandle
> package's test case, because the the object will automatically
> close itself when it goes out of scope.
>
> timethese( 100,
> {
> a => '
> use FileHandle;
> my $file = "/etc/passwd";
> for (1..100)
> {
> my $FH = new FileHandle;
> open $FH, $file;
> }'
> ,
> b => '
> my $file = "/etc/passwd";
> for (1..100)
> {
> local *FH;
> open FH, $file;
> close FH;
> }'
> });
>
> a: 27 secs (15.77 usr 10.95 sys = 26.72 cpu)
> b: 84 secs (68.53 usr 14.55 sys = 83.08 cpu)
>
> Maybe I was unfair: the "use FileHandle;" was inside the loop, but
> if I remove it and use the command before `timethese' the results
> look like this: It didn't matter, the relative difference is about
> the same
>
> a: 32 secs (19.93 usr 12.20 sys = 32.13 cpu)
> b: 88 secs (74.49 usr 14.64 sys = 89.13 cpu)
------------------------------
Date: Thu, 21 May 1998 12:12:35 -0400
From: Korey Kevin Klier <korey@ncsu.edu>
Subject: CGI.pm/PERL question
Message-Id: <35645272.604982A1@ncsu.edu>
I'm trying to use CGI.pm for the first time along with my limited perl
skills. Here is my problem. I want to take the -values and -labels
field from radio_group and popup_menu and combine them into one variable
so that I can reference them upon recalling the perl script, with out
having to retype it. Oh, and putting it in a format that either
radio_group and popup_menu can recognize.
I know the documentation said to create an anonymous array for the
values field (could not make it work) and to pass a reference to an
associative array in the labels section (this one either), however I
seem to be having trouble.
Examples
print $query->radio_group(-name=>'NAME1',
-values=>[qw/a b/],
-labels=>{'a'=>'something else for a',
'b'=>'something for b'},
-linebreak=>'true',);
print $query->popup_menu(-name=>'NAME2',
-values=>[qw/a b c/],
-labels=>{'a'=>'something for a',
'b'=>'something for b',
'c'=>'something for c',
-default=>'a');
If anyone can clue me in I would be most appreciative
--
Korey Klier
------------------------------
Date: 21 May 1998 16:26:22 GMT
From: "Lee Falkenhagen" <falkenl@hotmail.com>
Subject: determining if an array exists
Message-Id: <01bd84d5$4580a080$915c5093@lfalkenhagen.dhs.state.tx.us>
Keywords: array perl exists
I am trying to determine if an array exists...here is psuedo code:
subroutine main
@array = subroutine get_files
if no files, return error
do processing
subroutine get_files
@array = get list of files from directory
return @array
I have tried using exists and defined, but, I am missing something
somewhere...any help would be appreciated.
Thanks
--
Lee
------------------------------
Date: 21 May 1998 17:09:51 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: determining if an array exists
Message-Id: <6k1n4v$iou@news-central.tiac.net>
Keywords: array perl exists
In article <01bd84d5$4580a080$915c5093@lfalkenhagen.dhs.state.tx.us>,
Lee Falkenhagen <falkenl@hotmail.com> wrote:
>I am trying to determine if an array exists...here is psuedo code:
>
>subroutine main
> @array = subroutine get_files
> if no files, return error
> do processing
>
>subroutine get_files
> @array = get list of files from directory
> return @array
Using @array in a scalar context gives the vnumebr of elements in the
array, and perl will interpret 0 as false, so you can write code like
@array = get_files ();
unless (@array) {
handle error
}
...
or you can elide the two steps as the scalar value of a list assignment
is the number of elements which were available on the right hand sign of
the assignment, so the following style should work as perl knows unless
wants a scalar value to test:
unless (@array = get_files ()) {
error
}
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@colltech.com | Collective Technologies (work)
------------------------------
Date: 21 May 1998 16:05:48 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: GNU attacks on the open software community.
Message-Id: <6k1jcs$suv1@eccws1.dearborn.ford.com>
Zenin <zenin@bawdycaste.org> writes:
> Depends on what you meen by "free". If I have a GPLed program on my
> computer and decide to change a piece of it *for my own personal
> use* and don't publish this change to the entire world, I'm in
> direct violation of the GPL.
Wrong! Ford worked on (I'm not sure if the group does anymore as I've
switched positions) a re-targeted version of gcc to produce executables
for our electronic control systems. We are not required to distribute
the source code unless we distribute the binaries -- and that was never
planned.
> Is it still freedom when you've got a gun to your head?
Huh? What gun? You mean the same "gun" that Tom C. puts in his
documentation? It's the *author's decision* to decide what license,
if any, to place on his works.
- Ken
--
Ken Fox (kfox@ford.com) | My opinions or statements do
| not represent those of, nor are
Ford Motor Company, Powertrain | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section | "Is this some sort of trick
| question or what?" -- Calvin
------------------------------
Date: 21 May 1998 13:06:59 -0400
From: Stephane Boucher <sbo@nortel.ca_NO_SPAM>
Subject: Re: GNU attacks on the open software community.
Message-Id: <9xora1nd03w.fsf@bcarsf26.dpn>
Tom Christiansen <tchrist@mox.perl.com> writes:
> Perl has never told people what to do before, and it should not now.
Last I checked, Perl wasn't public domain, therefore it does "tell
people what to do" by imposing some restrictions on its use, albeit
small ones.
Also, people who use a licence without understanding it have only
themselves to blame. The FSF doesn't force anyone to use the GPL.
Rather than playing with words, why don't you either write a licence
that you like, or use one that you like, and do a run down of all the
points you like and dislike rather than talk about conspiracy and
such?
How about you give examples of things you want to do with free
software?
Do you want to allow people to do absolutely everything they want with
the software you write?
Or are you willing to impose certain restrictions?
If so, what are those restrictions?
What restrictions are you allowed to have, while retaining the moral
right to call the software free?
Rather than claim that Perl is free and Emacs isn't, why don't you
instead try to clear define what "Free" means for you?
--
,
Stephane Boucher, ing sbo@nortel.ca
- NORTEL - Tel: (613)763-9778
Bell-Northern Research / Recherches Bell-Northern
------------------------------
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 2662
**************************************