[13384] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 794 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 14 15:17:30 1999

Date: Tue, 14 Sep 1999 12:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 14 Sep 1999     Volume: 9 Number: 794

Today's topics:
        Active Perl on NT <me@here.net>
    Re: ceiling a decimal number <makkulka@cisco.com>
        CGI Hosting? <exagone@starlynx.com>
    Re: challenge results <jerrad@networkengines.com>
    Re: challenge results (Matthew Bafford)
    Re: challenge results (Kragen Sitaker)
        cookbook: nonforker <SternSZ@gmx.de>
    Re: Deleting spaces in a string (Philip 'Yes, that's my address' Newton)
        funky explicit package name variable problem <jerrad@networkengines.com>
    Re: Help with compiling a list <jamie@mccarthy.org>
    Re: I want to exit my script without sending anything b <mike@crusaders.no>
    Re: I want to exit my script without sending anything b (Philip 'Yes, that's my address' Newton)
    Re: I want to exit my script without sending anything b (Kragen Sitaker)
    Re: installing perl modules (Gabor)
        loading a hash into access db <michaelw@palawnet.com>
    Re: newbie help: getpwnam (Kragen Sitaker)
        perl to shell <hmpeng@ppserver.tamu.edu>
    Re: PLEASE HELP! - Symbolic References <cublai@earthlink.net>
    Re: Rcp (remote copy) in Win32 Perl? <dthusma@home.com>
    Re: REQ: tell-a-friend script (Abigail)
    Re: Sort Multidimentional array? <aqumsieh@matrox.com>
    Re: UNCRAP project proposal <jeff@vpservices.com>
    Re: UNCRAP project proposal <AgitatorsBand@yahoo.com>
    Re: Usefulness of CGI.pm (Was Re: UNCRAP project propos <jeff@vpservices.com>
    Re: Usefulness of CGI.pm (Was Re: UNCRAP project propos <uri@sysarch.com>
    Re: Usefulness of CGI.pm (Was Re: UNCRAP project propos (Chris Nandor)
    Re: win32 disk formatting (Philip 'Yes, that's my address' Newton)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 15 Sep 1999 01:28:00 -0400
From: Not me <me@here.net>
Subject: Active Perl on NT
Message-Id: <37DF2E60.24155CC3@here.net>

Anyone using this version of Perl on NT?  I cannot seem to get the
permissions (or something) correct to allow scripts to create
files/directories.  I've set the Write permission for the web on IIS 4,
and also edit the permissions on the directories that should be
writable.  I don't get any error or anything it just  doesn't do it.
Anyone have any experience with this?

Thanks,

Craig



------------------------------

Date: Tue, 14 Sep 1999 11:31:58 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: ceiling a decimal number
Message-Id: <37DE949E.B59C49F6@cisco.com>

[ dVoon wrote:

> How to take the 'ceiling' of a decimal number in Perl?

use ceil() in POSIX module.
--



------------------------------

Date: Tue, 14 Sep 1999 19:23:12 +0200
From: "_mDe_" <exagone@starlynx.com>
Subject: CGI Hosting?
Message-Id: <7rm2te$e4d$1@news.news-service.com>

Is there a free webspace provider with cgi support without all the banners
and popups?
mDe





------------------------------

Date: Tue, 14 Sep 1999 13:27:11 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: Re: challenge results
Message-Id: <37DE856F.FDBA962D@networkengines.com>

okay, here's a "challenge"
the smallest script to random the case of it's input
optionally make one that's efficient
(minimize all numbers reutrned by time [script])


------------------------------

Date: Tue, 14 Sep 1999 18:11:46 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: challenge results
Message-Id: <slrn7tt389.1rf.*@dragons.duesouth.net>

On Tue, 14 Sep 1999 13:27:11 -0400, jerrad pierce
<jerrad@networkengines.com> enriched us with: 
: [snip]

Two that come to me immediately:

> perl -ne 'print "$_"x100' > file
okay, here's a "challenge"
the smallest script to random the case of it's input
optionally make one that's efficient
(minimize all numbers reutrned by time [script])
> time perl -pe '$_=join"",(map{rand(2)<1?uc:lc}split/(.)/)' file > /dev/null
0.93user 0.00system 0:00.93elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (265major+40minor)pagefaults 0swaps
> time perl -pe 's/./rand(2)<1?uc$&:lc$&/ge'                 file > /dev/null
0.43user 0.00system 0:00.43elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (266major+39minor)pagefaults 0swaps
>

--Matthew


------------------------------

Date: Tue, 14 Sep 1999 18:44:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: challenge results
Message-Id: <RHwD3.10713$N77.805019@typ11.nn.bcandid.com>

In article <37DE856F.FDBA962D@networkengines.com>,
jerrad pierce  <jerrad@networkengines.com> wrote:
>okAY, hERE'S a "chAlLENgE"
>THe sMALlest SCrIpT to rANDom tHE CasE OF iT'S INpuT
>OptiOnALlY mAke One THat'S efFicienT
>(MiNImIZE AlL NuMbers REutRnEd By TIme [sCriPT])

Here's my starting place.
#!/usr/bin/perl -wn
print map{(int rand 2)?lc$_:uc$_}split//

And since lc and uc take $_ as their argument by default, you can omit that:
perl -wne 'print map{(int rand 2)?lc:uc}split//'

And there's a shorter way to do the randomization:
perl -wne 'print map{rand>.5?lc:uc}split//'

But wait!  I can do the split with a command-line flag:
perl -F// -wane 'print map{rand>.5?lc:uc}@F'

But that doesn't save me any characters.  In fact, I lose one.

Oh well.  Anyone else want to try?

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 14 Sep 1999 18:57:39 +0200
From: Benjamin Schweizer <SternSZ@gmx.de>
Subject: cookbook: nonforker
Message-Id: <m3vh9dwhvg.fsf@anthrax.local.net>

Hello,

I´ve got a non forking daemon which is pretty nice. If I mark the
following code as a comment it runs pretty nice, else Perl reports
that IO::Select has no method has_exception.
The problem now is, that a Windows-client who is shut down kills the
server. I hope that this method can prevent this.

---<nonforker>---
    foreach $client ($select->has_exception(0)) {  # arg is timeout
        # Deal with out-of-band data here, if you want to.
    }
---<nonforker>---


Has anybody a hint or knows this script?






regards
  -Benjamin

-- 
              MICROSOFT (MSFT) announced today that the official
              release date for the new operating system "Windows 2000"
              will be delayed until the second quarter of 1901


------------------------------

Date: Tue, 14 Sep 1999 18:42:11 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Deleting spaces in a string
Message-Id: <37ddcf5c.551756641@news.nikoma.de>

On Mon, 13 Sep 1999 12:56:44 GMT, Dick Latshaw <latsharj@my-deja.com>
wrote:

>What you have will delete the first space(s). To delete all, you need
>=~ s/\s+//g; Or better for individual characters: =~ tr/ //d; if all you
>are trying to delete is space characters, not tabs or other whitespace.

Even then, it's as simple as tr/ \t\r\n//d; .

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


------------------------------

Date: Tue, 14 Sep 1999 13:05:28 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: funky explicit package name variable problem
Message-Id: <37DE8058.C22D220F@networkengines.com>

okay so if:
$var = 'bar';
$val = 'quux';

Then
$$var = eval($val)

is the same as:
$bar = 'quux';

But
$main::{$var} = eval($val)
Which seems as though it should be the same equates too:
*main::bar = 'quux'
making bar a reference to the value in quux.
Hardly the same

I've tried all sorts of stuff but can't get an expression which does the same thing while specifying the package (@#$#@$ references, that's why I don't use C )


Any help would be greatly appreciated, thanks!


------------------------------

Date: Tue, 14 Sep 1999 12:23:22 -0400
From: Jamie McCarthy <jamie@mccarthy.org>
Subject: Re: Help with compiling a list
Message-Id: <37DE767A.8A077861@mccarthy.org>

jsilve1@my-deja.com wrote:

> group   firstn  lastn   email
> =============================
> PI      John    Smith   js@blah.edu
> STAFF   Jane    Doe     jdoe@fun.place.edu
> PI      Betty   Tooth   Btooth@school.edu

> How could I have a person with more than one group be listed as having
> more than one group, without having multiple entries for that person in
> the database?
> I tried something like:
> STAFF,COMMITTEE_A       Fred    Beagle  fbeagle@usa.school.edu
> 
> but I am having trouble getting the script to recognize this first field
> as containing two separate groups.
> 
> Please reply with pseudocode, real perl code, or other insight or
> suggestions, Thanks!!

It sounds like your data structure should be a hash table
whose key value is the email address, thus (if it were
hard-coded).  I would suggest storing the "group" field as
an anonymous array reference.  You might parse it from the
above data as:

while (defined($line = <FILE>)) {
   my($group, $firstn, $lastn, $email) = split " ", $line;
   my @group = split ",", $group;
   $mydb{$email}{firstn} = $firstn;
   $mydb{$email}{lastn} = $lastn;
   $mydb{$email}{group} = [ @group ];
}

The "split" separates a single comma-separated field into
an array of multiple scalars.  The "[ @group ]" converts
that array into an anonymous array reference suitable for
storing in a hash table.

You might print this information back out as:

for $email (sort keys %mydb) {
   my @group = @{$mydb{$email}{group}};
   my $group = join(",", @group);
   my $firstn = $mydb{$email}{firstn};
   my $latn = $mydb{$email}{lan};
   print "$group $firstn $lastn $email\n";
}

--
 Jamie McCarthy


------------------------------

Date: Tue, 14 Sep 1999 19:34:44 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: I want to exit my script without sending anything back to the users   browser
Message-Id: <0HvD3.415$ai7.1537@news1.online.no>


Kragen Sitaker <kragen@dnaco.net> wrote in message
news:ynjD3.9453$N77.726489@typ11.nn.bcandid.com...
> In article <LDLC3.1273$rf1.7749@news1.online.no>,
> Trond Michelsen <mike@crusaders.no> wrote:
> >Well, onSubmit is at least a bit more friendly than
onClick=this.form.submit
> >(or something similar)
> You don't understand.  Some of us think JavaScript is brain-dead.
Some

It was not my intention to sound javascript-friendly by my post. I just
wanted to point out that if you (well, obviously, /you/ won't use it :)
use onSubmit on a <FORM> it will work on browsers without
javascript-support, while the incredibly stupid solution of using an
image with onClick won't.

I don't use javascript myself (OK, I sinned once - it won't happen
again), and the only reason why I haven't disabled javascript in the
browsers I use, is that I'm infinately naïve.

> onSubmit and onClick are equally unfriendly, because NEITHER ONE RUNS.

??
onSubmit is triggered by submitting a form, so if javascript is
disabled, you will submit the form and live happily with whatever the
targeted cgi-script has to offer.

--
Trond Michelsen





------------------------------

Date: Tue, 14 Sep 1999 18:41:57 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: I want to exit my script without sending anything back to the users   browser
Message-Id: <37ddca57.550471146@news.nikoma.de>

On Tue, 14 Sep 1999 03:34:54 GMT, kragen@dnaco.net (Kragen Sitaker)
wrote:

>Some of us don't like popup ad windows and image rollovers and the
>other "cool" things people like to do with JavaScript.
>
>For those of us who are like this (I'm tempted to say "those of us who
>aren't total morons", but that would be slightly inaccurate -- there
>are people who leave JavaScript on because they're uninformed, or
>because they aren't the ones who use the browser), onSubmit and onClick
>are equally unfriendly, because NEITHER ONE RUNS.

Um, yes. I usually have JavaScript turned off at home because of the
annoying scrolltext in the status line. (It's a status line! It's
supposed to show you the status, not saying "Welcome to bla bla bla"!
And I like pointing at a link and having the URL show in the status
line. And I also hate OnMouseOver's that say something uninformative
like "Product Information" rather than a URL -- especially when they
forget the OnMouseOut.)

This got me recently when I wanted to download some software. I had to
go through a nice registration procedure, click from one screen to
another, and finally reached the final screen... which read "Your
program is now downloading" -- but it wasn't. Reading the screen's
source revealed (IIRC) something with OnLoad which sent you the
program. How about posting a hyperlink to the setup binary? How about
having, at least, a button that you click on to start the download
(even though this makes it more difficult to use a download manager to
resume the download later on)? How about catering to people who don't
use JavaScript? I finally resorted to using "Previous Page" -- turning
JavaScript on -- "Next Page". But it still stunk.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


------------------------------

Date: Tue, 14 Sep 1999 18:47:21 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: I want to exit my script without sending anything back to the users   browser
Message-Id: <ZKwD3.10720$N77.805383@typ11.nn.bcandid.com>

In article <0HvD3.415$ai7.1537@news1.online.no>,
Trond Michelsen <mike@crusaders.no> wrote:
>Kragen Sitaker <kragen@dnaco.net> wrote in message
>news:ynjD3.9453$N77.726489@typ11.nn.bcandid.com...
>I don't use javascript myself (OK, I sinned once - it won't happen
>again)

I have used JavaScript.  I think it's a pretty nifty scripting
language.  I just don't like the idea of people going around
promiscuously running software written by random people they don't
know, in an insecure fashion, and without even knowing it.

>onSubmit is triggered by submitting a form, so if javascript is
>disabled, you will submit the form and live happily with whatever the
>targeted cgi-script has to offer.

Right -- I didn't understand what you were saying.

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 14 Sep 1999 14:12:14 -0400
From: gabor@vmunix.com (Gabor)
Subject: Re: installing perl modules
Message-Id: <slrn7tt3vu.aei.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, mikej <mikej@1185design.com> wrote :
# Hi,
# 
# Im trying to install some perl modules, and I got the perl Makefile.PL
# command to work by entering the full path to perl (BTW how do I set it
# up so I can just type perl and not the whole path, is there some config
# file in Apache?) but now I try to do the make test and make install
# commands to finish installing the module but it gives me this error:
# 
# make: not found
# 
# do I have to set up a full path to this or something? Shouldnt it just
# work like a normal unix command? Thanks for any help.

It works like most Unix commands.  Unless the directory where make
lives is in your path, how's your shell going to find it?  It cannot
just divine it out of thin air.
To set your path

PATH=/foo:/bar

and so on


------------------------------

Date: Tue, 14 Sep 1999 17:38:52 GMT
From: gregarine <michaelw@palawnet.com>
Subject: loading a hash into access db
Message-Id: <7rm17b$s18$1@nnrp1.deja.com>

How does one load a hash into MS Access using ODBC on a winnt system.
What I am doing is tranferring a single record from one table to another
in the same ODBC source.

I have the table in a hash

$db->FetchRow();
%rec = $db->DataHash;

I know I could convert the hash into an insert statement, but there is
probably an easier, more elegant, and efficient way.  Isn't there?

-Mike




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Tue, 14 Sep 1999 17:05:07 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: newbie help: getpwnam
Message-Id: <7fvD3.10354$N77.794734@typ11.nn.bcandid.com>

In article <CPeB3.127$Dn2.420@198.235.216.4>,
LOG ON Tech <dwayne@log.on.ca> wrote:
>#include <pwd.h>
>
>($use,$pass,$uid,$gid,$info,$home,$shell)  = getpwnam(username);
>print $use;
>print $pass;
>print $uid;
>print $gid;
>print $info;
>print $home;
>print $shell;

Don't #include .h files in Perl.
use strict.
Use -w.

This code works correctly on my Solaris machine:

#!/usr/bin/perl -w
use strict;

my (@fields)  = getpwnam('kragen');
print ((join ':', @fields), "\n");

In particular, my gecos field (which I guess is the one you want) is in
there.  The output is:

kragen:##kragen:1117:12::Kragen Sitaker:Kragen Sitaker:/home/kragen:/bin/csh

According to perldoc -f getpwent:

    ($name,$passwd,$uid,$gid,
       $quota,$comment,$gcos,$dir,$shell,$expire) = getpw*

So you're getting $quota, $comment, and $gcos and calling them $info,
$home, and $shell.

>Except only the first 4 vars contain data.  $info on return null.
>Of corse the info feild is the one I require for the job.

Now you know why.

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Tue, 14 Sep 1999 13:34:33 -0500
From: "Mei" <hmpeng@ppserver.tamu.edu>
Subject: perl to shell
Message-Id: <7rm4ja$noe$1@news.tamu.edu>

Hello,

I would like to incorporate some of my perl scripts in one shell script.  So
when I use “pipeline.sh”, my data will go through perl scripts one by one.
How do I do that?

Thanks,

Mei





------------------------------

Date: Tue, 14 Sep 1999 11:25:34 -0600
From: "Zach Thompson" <cublai@earthlink.net>
Subject: Re: PLEASE HELP! - Symbolic References
Message-Id: <7rm0d5$2sf$1@birch.prod.itd.earthlink.net>

The first line of the error message says it all.  Remove the "my" in front
of ${$key}.   Symbolic refs access the symbol table and lexical variables
are not stored there.

<makau@multimania.com> wrote in message news:7rltqu$pki$1@nnrp1.deja.com...
> The actual code is a lot more complicated but to summarize, here's what
> I want to do :
>
> ---------------------------------
> #!/usr/local/bin/perl -w
>
> use strict;
>
> my $key;
> my %hash = (
>         hello => 'world',
>         perl  => 'rOckz',
> );
> foreach $key (keys %hash) {
>         my ${$key} = $hash{$key};
> };
>
> print "The $hello $perl !";
> ---------------------------------
>
> but the Perl interpreter prints out :
>
> ---------------------------------
> Can't declare scalar deref in my at ./a.pl line 11, near "} ="
> Global symbol "$hello" requires explicit package name at ./a.pl line 14.
> Global symbol "$perl" requires explicit package name at ./a.pl line 14.
> Execution of ./a.pl aborted due to compilation errors.
> ---------------------------------
>
> Without the 'strict' subs, it works just fine.
> But the problem is I do NOT want to remove it (since some warnings are
> not displayed otherwise)!
>
> And YES, I want to get $$key and not a hash.
> I have my reason.
>
> Is there a work-around, or can't Perl handle this when 'use strict' is
> mentionned?
>
> Please help...
> I'm desperate!
>
> Makau.
>
> makau@multimania.com
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.





------------------------------

Date: Tue, 14 Sep 1999 18:56:30 GMT
From: Darrin H <dthusma@home.com>
Subject: Re: Rcp (remote copy) in Win32 Perl?
Message-Id: <37DE9DC5.7BCBAD41@home.com>

Jeff wrote:

> Hi all,
>
> I wonder if there is a remote copy (rcp) unit for Perl Win32 version?
> Since rcp is not a Win32 "shell" command, I can't use the system()
> method as
> using Perl on UNIX.
>
> Thanks,
>
> Jeff

I know of many methods to perform this.
Within tcl/tk (not perl) . it allows the send command to actually exec
DDE's on win32 and rcp/rpc's on unix.
Within perl, there is the pure RPC module, which I am sure could do
that, the libnet ftp module, which always helps.

However, I use the a modified version of the RPC module defined in
chapter 14 of advanced perl programming to perform remote copy.  I just
have it open an rpc channel and send the data across.  Its about 8 lines
(client and server combined) to do this, so its pretty simple. The best
thing is performance: Timer::HiRes shows this RPC is about 3OM
(orders of magnitude) faster than the tcl dde call.

You just download the FreezeThaw from CPAN, then MSG.pm & RPC.pm from
oreilly, and follow the examples.
hope this helps.  if not, gimme more specs and I can send you some
examples.



------------------------------

Date: 14 Sep 1999 13:51:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: REQ: tell-a-friend script
Message-Id: <slrn7tt6ff.g83.abigail@alexandra.delanet.com>

chetohevia@my-deja.com (chetohevia@my-deja.com) wrote on MMCCV September
MCMXCIII in <URL:news:7rlluq$jud$1@nnrp1.deja.com>:
'' 
'' The actual non-trivial technical issue in the question, and in the
'' referral scripts, makes the question a legitimate one, although perhaps
'' poorly phrased.  but it is a question I share: does anyone know how to
'' identify referring page from a script? I'm looking for something
'' equivalent to the javascript document.referrer object.  does anyone
'' know how to do that in perl?

That's not a Perl question. That's something between your server and your
program. If your server uses CGI, you can find in the CGI specification
where to find the referer URL - if any at all.

IT IS NOT A PERL QUESTION!



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Tue, 14 Sep 1999 11:26:26 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Sort Multidimentional array?
Message-Id: <x3y1zc1fra6.fsf@tigre.matrox.com>


nospam@nospam.com (Ryan Briggs) writes:

> I have a multidimentional array, that is fed from a file like:
> 
> field1|field2|field3
> field1|field2|field3
> 
> etc., and have the data stored in a multidimentional array so I can
> access it via $items[0][1] and so on.  However I am having trouble
> sorting the array based on one of the fields.  Ideally I would like to
> sort it by field 3, which is a category, then by field 2, to sort the
> items within the category, so it all outputs in order to a web page.

I would usually point the poster to the correct part of the
documentation for the answer (since this question is a FAQ), but for
some unknown reason I don't feel like it. So here it is.

It depends if your data fields contain numbers or characters. In the
former you would probably sort numerically, and the latter
alphabetically. You didn't mention if you want to sort in ascending or
decending order, so I will assume ascending.

Assuming field3 is a word, field 2 is another word, and field one is
an integer, something like the following will do for you:

	my @sorted = sort {
			$a->[2] cmp $b->[2]
				||
			$a->[1] cmp $b->[1]
				||
			$a->[0] <=> $b->[0]
			  } @items;

Having said that, you should take a look at the sort() entry in
perlfunc. Also, have a look at perlfaq4:

     How do I sort an array by (anything)?

HTH,
--Ala



------------------------------

Date: 14 Sep 1999 16:41:38 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: UNCRAP project proposal
Message-Id: <37DE79C1.C6D1860F@vpservices.com>

Chris Nandor wrote:
> 
> Of course, CGI.pm creates illegal HTML anyway by itself, since it does not
> give you a DOCTYPE, so who knows WHAT version of HTML you are using?
> 

Yes, CGI.pm lets you get away without including a DTD.  Lincoln's book
gives the arguable rationale for this as "Unfortunately, the DTD
confuses a few poorly written browsers including the AOL browser"
[p.256].  I won't defend that choice, but it wasn't done simply on whim.

OTOH, one can easily add the DTD with, for example:

	start_html(-dtd=>'-//W3C//DTD HTML 3.2//EN',-title=>'Duh!');

Which is 8 characters less typing than if you just wrote that in a here
doc, so it must be worth it :-).

-- 
Jeff


------------------------------

Date: Tue, 14 Sep 1999 17:52:06 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: UNCRAP project proposal
Message-Id: <aXvD3.557$n82.92064@news.shore.net>

Larry Rosler <lr@hpl.hp.com> wrote:

: On the other hand, CGI.pm never emits a newline (to conserve 
: transmission time, 15% to 20% according to the docs), though that makes 
: the output unreadable on a browser. 

Interesting. I've found some non-standard behavior in
poorly-written-yet-widely-used web browsers that seemed to be related to
extremely long lines of HTML. 

--Art

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


------------------------------

Date: 14 Sep 1999 16:25:59 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Usefulness of CGI.pm (Was Re: UNCRAP project proposal)
Message-Id: <37DE7612.8AEECC9C@vpservices.com>

Chris Nandor wrote:
> 
> In article <37DDC159.B39F7410@vpservices.com>, Jeff Zucker
> <jeff@vpservices.com> wrote:
> 
># 1) writing extensions, e.g. I have extensions for all the list type
># methods to combine CGI.pm and DBI.pm so that $q->popup_menu(sql=>"SELECT
># id,partname FROM parts") gives me a nice HTML formated select list based
># on the contents of a database column with the first column as the values
># list and the second as the labels list for the CGI.pm popup_menu.
> 
> I am not attacking you here, just trying to understand.

Sure, thanks.  That's why I posted, so you could help me try to
understand.

> What is $q here?
> If it is a CGI object that you are overriding, then it is unneccessary ...
> you could just have your own popup_menu function that does the same
> thing.  If it is your own object, then it doesn't apply here, because we
> are talking about CGI.pm objects.  :)

Well, in my understanding, I am inheriting the CGI.pm object's methods
with ISA so $q in this example is simultaneously an object I created and
a CGI.pm object, not one or the other as your question implies.  This
new object has methods that take parameters I have designed having to do
with DBI and also accepts all CGI.pm parameters.  So, for example one
could have something like

	$q->popup_menu(
		sql     => "SELECT partID,partname FROM parts",
		default => 'superWidget',
		force   => 1
	);

That way a) I can just use the stickiness and other features already
built in to the CGI.pm object without creating/learning any new syntax;
this becomes even more important with more complex methods like
$q->table() which have a number of useful CGI.pm parameters as well as a
bunch of new database ones I have added; and b) so that my code can
automatically grow as CGI.pm grows i.e. the next time Lincoln adds some
parameters to one of these methods, they can instantly be used in my new
object because my object inherits all the methods of the CGI.pm object. 
I just install the new version of CGI.pm and start using the new
parameters without having to touch my method that does the overriding.

-- 
Jeff


------------------------------

Date: 14 Sep 1999 14:02:51 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Usefulness of CGI.pm (Was Re: UNCRAP project proposal)
Message-Id: <x7u2oxjrqs.fsf@home.sysarch.com>

>>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:

  JZ> Well, in my understanding, I am inheriting the CGI.pm object's
  JZ> methods with ISA so $q in this example is simultaneously an object
  JZ> I created and a CGI.pm object, not one or the other as your
  JZ> question implies.  This new object has methods that take
  JZ> parameters I have designed having to do with DBI and also accepts
  JZ> all CGI.pm parameters.  So, for example one could have something

so how do you make sure you don't overwrite some of CGI's values in the
object? 

  JZ> i.e. the next time Lincoln adds some parameters to one of these
  JZ> methods, they can instantly be used in my new object because my
  JZ> object inherits all the methods of the CGI.pm object.  I just
  JZ> install the new version of CGI.pm and start using the new
  JZ> parameters without having to touch my method that does the
  JZ> overriding.

as i said above, if he changes the object to overlap with your new member
names, you will have a nice bug to solve. you have to work on data
encapsulation to make sure this won't happen.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


------------------------------

Date: Tue, 14 Sep 1999 18:12:18 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Usefulness of CGI.pm (Was Re: UNCRAP project proposal)
Message-Id: <pudge-1409991412230001@192.168.0.77>

In article <37DE7612.8AEECC9C@vpservices.com>, Jeff Zucker
<jeff@vpservices.com> wrote:

# Chris Nandor wrote:
# > What is $q here?
# > If it is a CGI object that you are overriding, then it is unneccessary ...
# > you could just have your own popup_menu function that does the same
# > thing.  If it is your own object, then it doesn't apply here, because we
# > are talking about CGI.pm objects.  :)
# 
# Well, in my understanding, I am inheriting the CGI.pm object's methods
# with ISA so $q in this example is simultaneously an object I created and
# a CGI.pm object, not one or the other as your question implies.

No, Perl objects belong to one class.  It can access methods in various
classes, but it blessed into only one class.  But that may be merely
pedantic.

# This
# new object has methods that take parameters I have designed having to do
# with DBI and also accepts all CGI.pm parameters.  So, for example one
# could have something like
# 
#         $q->popup_menu(
#                 sql     => "SELECT partID,partname FROM parts",
#                 default => 'superWidget',
#                 force   => 1
#         );
# 
# That way a) I can just use the stickiness and other features already
# built in to the CGI.pm object without creating/learning any new syntax;
# this becomes even more important with more complex methods like
# $q->table() which have a number of useful CGI.pm parameters as well as a
# bunch of new database ones I have added; and b) so that my code can
# automatically grow as CGI.pm grows i.e. the next time Lincoln adds some
# parameters to one of these methods, they can instantly be used in my new
# object because my object inherits all the methods of the CGI.pm object. 
# I just install the new version of CGI.pm and start using the new
# parameters without having to touch my method that does the overriding.

You can do the exact same thing with popup_menu() the function instead of
popup_menu() the object method, though.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


------------------------------

Date: Tue, 14 Sep 1999 18:42:02 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: win32 disk formatting
Message-Id: <37ddcb98.550792016@news.nikoma.de>

On Mon, 13 Sep 1999 03:30:17 GMT, "David Clarke"
<clarked@hunterdon.csnet.net> wrote:

>$results = `type c:\input.txt | command.com /c format a:`;

This might qualify for UUOC if it weren't couched in Windows terms.
AFAIK Windows doesn't have proper pipes but creates a temporary file
for the first command to write to, and on completion feeds the
temporary file to the second command. Since you've got a file already,
why create another one? Why not just tell command.com "here's a nice
tasty file called c:\input.txt; please read your STDIN from it because
I put a < in front of it"? (That is, something along the lines of
`command.com /c format a: <c:\input.txt`, and I'm not even sure you
need the command.com /c in front, since you're not calling internal
commands such as DIR and CD).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.net>


------------------------------

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 794
*************************************


home help back first fref pref prev next nref lref last post