[7956] in Perl-Users-Digest
Perl-Users Digest, Issue: 1581 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 5 09:17:32 1998
Date: Mon, 5 Jan 98 06:01:01 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 5 Jan 1998 Volume: 8 Number: 1581
Today's topics:
Re: **1A Please Help, Perl is harrassing me ** (Joshua J. Kugler)
Re: **1A Please Help, Perl is harrassing me ** (brian d foy)
Re: **1A Please Help, Perl is harrassing me ** (Clay Irving)
[Help?] Feasible in PERL? <bentery@shell5.ba.best.com>
Re: [Help?] Feasible in PERL? <ebohlman@netcom.com>
Re: `Free Live Saucy Chat! <dha@panix.com>
Re: Camel Critiques: PERL: THE PROGRAMMER'S COMPANION (Chris Nandor)
Carriage Return Error <jhnyreb@gnt.net>
Re: Fast Suggestions for this string manipulation probl (Bart Lateur)
Re: GD for Win32 (Martien Verbruggen)
Re: HELP ME How I can to compare two date 01/12/1997>=0 (brian d foy)
Re: HELP ME How I can to compare two date 01/12/1997>=0 (Clay Irving)
Help! "%1 is not a valid Windows NT application." <neil@mail.cqit.qld.edu.au>
Re: i am a newbie (Abigail)
Re: i need perl5.0** (Joshua J. Kugler)
ISP selling equipment equipment@miworld.net
Javascript error on CGI perl application using Comunica (Henri Irla)
Multiple field sorting not working <dundee@ccnet.com>
Re: Multiple field sorting not working (Clay Irving)
Re: Need script to preview form data prior to submittin (Michael Budash)
Re: Need script to preview form data prior to submittin <tedgren@ford.com>
Re: Perl Trick? (brian d foy)
Re: PERLIPC - FIFO: parent, child, stalled! <jbattikha@highsynth.com>
strangest Q you've seen regarding storing entire binary (William Byrd)
Re: strangest Q you've seen regarding storing entire bi <scribble@pobox.com>
Re: Use modem as voice speed dialer? <AWebb@Ford.com>
Web Database Survey REPOST (Steph Thornton)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Jan 1998 04:56:09 GMT
From: jkugler@inreach.com (Joshua J. Kugler)
Subject: Re: **1A Please Help, Perl is harrassing me **
Message-Id: <34b067e1.1039016@news.inreach.com>
On Sun, 04 Jan 1998 20:37:19 -0700, David Martinez
<dmartine@cu.campus.mci.net> wrote:
()I have a form that takes information and an email address is one of
()them. I then write this information to another file.
()
()Perl thinks that the @ symbol is the beginning of an array
obviously.
()Can anyone show me some code that would search the $form{'email'}
()variable for the @ symbol and then stick the \ (backslash) symbol in
()front of it so it takes it as a literal?
()
()Would this be an 'if' statement kind of thing?
()
If the @ sign is already in a string, perl shouldn't interpret it as
the beginning of an array. Are you trying to hard code the @?
Could you post your script?
j----- k-----
I read this group. Sometimes my ISP doesn't. Please e-mail too.
Joshua J. Kugler
Computer Consultant--Web Developer
jkugler@inreach.com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
------------------------------
Date: Mon, 05 Jan 1998 04:49:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: **1A Please Help, Perl is harrassing me **
Message-Id: <comdog-0501980449090001@news.panix.com>
Keywords: just another new york perl hacker
In article <34B0556F.CA9B7CCE@cu.campus.mci.net>, David Martinez <dmartine@cu.campus.mci.net> posted:
> I have a form that takes information and an email address is one of
> them. I then write this information to another file.
>
> Perl thinks that the @ symbol is the beginning of an array obviously.
> Can anyone show me some code that would search the $form{'email'}
> variable for the @ symbol and then stick the \ (backslash) symbol in
> front of it so it takes it as a literal?
what are you doing to $form{'email'} to causes the error? are you
sure that the problem isn't somewhere else? to add the backslash,
try
s/@/\@/g;
but it's likely to behave in ways that you don't expect.
search for other parts of teh script that have double quotish strings
with @'s in them. they might be the swource of the warning.
--
brian d foy <http://computerdog.com>
------------------------------
Date: 5 Jan 1998 08:09:04 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: **1A Please Help, Perl is harrassing me **
Message-Id: <68qm1g$c1p@panix.com>
Keywords: just another new york perl hacker
In <comdog-0501980449090001@news.panix.com> comdog@computerdog.com (brian d foy) writes:
>In article <34B0556F.CA9B7CCE@cu.campus.mci.net>, David Martinez <dmartine@cu.campus.mci.net> posted:
>> I have a form that takes information and an email address is one of
>> them. I then write this information to another file.
>>
>> Perl thinks that the @ symbol is the beginning of an array obviously.
>> Can anyone show me some code that would search the $form{'email'}
>> variable for the @ symbol and then stick the \ (backslash) symbol in
>> front of it so it takes it as a literal?
>what are you doing to $form{'email'} to causes the error? are you
>sure that the problem isn't somewhere else? to add the backslash,
>try
> s/@/\@/g;
>but it's likely to behave in ways that you don't expect.
>search for other parts of teh script that have double quotish strings
>with @'s in them. they might be the swource of the warning.
Brian, you forgot to tell him:
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that
your requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: 5 Jan 1998 05:37:49 GMT
From: <bentery@shell5.ba.best.com>
Subject: [Help?] Feasible in PERL?
Message-Id: <68prjd$647$1@nntp1.ba.best.com>
Hello,
I'm fairly new to PERL, and was wondering if PERL could associate
arrays as follows:
e.g. My database file: (n rows, by m colums)
field1 field2 field3 field4 field5 ... fieldm [return]
r1_field1 r1_field2 ... r1_fieldm [return]
r2_field1 r2_field2 ... r2_fieldm [return]
.
.
rn_field1 rn_field2 ... rn_fieldm [return]
The database is dynamic so it can have an arbitrary n rows and
m columns. What I would to know is how to use PERL to:
(1) read in first line, determine how many "fields" (columns) there are.
(2) use these fields as keys to the data section that immediately
so we can access data by:
data[row_m][column_n]
-or-
data[row n]{"field name"} ## somehow use associate array?
(3) Modify and/or delete a whole row?
Greatly appreciate any help on this. This would allow me to avoid
writing a C program to deal with this.
Thanks,
Eric
--
eric@bentery.com
------------------------------
Date: Mon, 5 Jan 1998 07:35:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: [Help?] Feasible in PERL?
Message-Id: <ebohlmanEMAvrE.1Io@netcom.com>
bentery@shell5.ba.best.com wrote:
: I'm fairly new to PERL, and was wondering if PERL could associate
: arrays as follows:
[snip]
: The database is dynamic so it can have an arbitrary n rows and
: m columns. What I would to know is how to use PERL to:
: (1) read in first line, determine how many "fields" (columns) there are.
: (2) use these fields as keys to the data section that immediately
: so we can access data by:
: data[row_m][column_n]
: -or-
: data[row n]{"field name"} ## somehow use associate array?
: (3) Modify and/or delete a whole row?
Yes, this can be done in Perl, and in fact someone has already done it
for you. Go over to CPAN and grab sprite.pm, which is designed to handle
this very sort of flat-file database. It provides a (limited) SQL interface.
------------------------------
Date: 5 Jan 1998 01:26:36 -0500
From: David Adler <dha@panix.com>
Subject: Re: `Free Live Saucy Chat!
Message-Id: <vx9vhvz77xh.fsf@panix.com>
comdog@computerdog.com (brian d foy) writes:
> In article <34aea4a0.0@london.netkonect.net>,
> Ian<ianc@atlantic-brands.com> posted:
> >I thought readers might like to know of a great site I've found.
> >It is free and fun.
>
> cool! Perl does all of that?
Uh, yeah. Perl *is* free and fun!
--
David H. Adler - <dha@panix.com>
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: Mon, 05 Jan 1998 08:45:46 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Camel Critiques: PERL: THE PROGRAMMER'S COMPANION
Message-Id: <pudge-0501980845460001@ppp-9.ts-1.kin.idt.net>
In article <34A9DD41.687@forte.com>, Peter Prymmer <pvhp@forte.com> wrote:
# Your comments induced me to go purchase the volume and I must say
# that it is indeed a fine book and rather entertaining. I am
# nevertheless inclined to think that Nigel has done himself and Perl a
# disservice by saying things such as:
#
# "...Perl is unlikely ever to be the language of choice for digital
# video capture or 3D scene rendering." (pg. 263)
Well, if this is a sociological perspective, then I see nothing wrong with
it. Chances are, Perl won't be the language of choice for these
applications. If it is a statement of Perl's abilities (which does not
appear to be the case), then yes, it is a disservice.
# One other tiny technical problem I have with the text is the fixed
# width font used for source code samples which suffers from the same
# problem as Paul Hoffman's B<Perl 5 for Dummies> in that one cannot
# distinguish between the backticks `` and the foreticks '' (Nigel's
# book was apparently written up in LaTeX).
Funny, I mentioned I did not like his monospaced font just the other day
as well, though I did not notice that problem (I just leafed through the
book for a minute or two). I simply think it is an ugly font. :)
# Such minor quibbles aside, Nigel Chapman's book *is* a pleasant read
# and I like it too. It is certainly amusing to see the IBM-doc style
# syntax diagrams for perl.
Yes, I think I might pick up a copy soon.
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Sun, 04 Jan 1998 23:20:04 -0600
From: "Jack M. King" <jhnyreb@gnt.net>
Subject: Carriage Return Error
Message-Id: <34B06D84.A92E5B96@gnt.net>
I'm attempting to setup a webshop (written by someone else) and keep
getting the following error:
Did you forget to remove the carriage returns following a network
transfer?
Needless to say there was no network transfer, and outside of changing
some configurations as needed, I've added nothing to the config or the
cgi file. Can anyone help me sort out this problem? Tell me what I can
look for?
Thanks,
Jack King.
p.s. I'm also looking for a Perl tutor to assist me in implementing this
webshop. Someone who won't mind answering a few questions now and then.
------------------------------
Date: Mon, 05 Jan 1998 12:51:23 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Fast Suggestions for this string manipulation problem
Message-Id: <34b4d111.3722212@news.tornado.be>
hermit@cats.ucsc.edu (William R. Ward) wrote:
>Rhodri James <rhodri@wildebst.demon.co.uk> writes:
...
>> elsif (/\.co\./) { ....
>These regular expressions are pretty inefficient. They should be
>anchored. I suggest /\.co\.??$/ and /\.mil$/ respectively, instead.
I think you ment
/\.co\...$/
That was a DOS wildcard you used.
Bart.
------------------------------
Date: 5 Jan 1998 05:57:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: GD for Win32
Message-Id: <68psp4$78i$1@comdyn.comdyn.com.au>
In article <68n7bu$585@bigblue.montana.net>,
"Clifford R. Conover" <RConover@wyellowstone.com> writes:
> To all,
>
> I am having problems obtaining the latest version of GD for Win32. When I
> try to connect to ftp.roth.net I get a site not found error.
>
> I would appreciate it if you could inform me where I could obtain a version
> of the Win32::GD for build 314.
I don't know.. The version I tried last came from CPAN (when I was
porting GIFgraph to NT), and that was oldish. When I tried to contact
Dave Roth, I didn't get any replies from him about his GD port. His GD
port doesn't behave the same way as the original from Lincoln Stein
anyway. The perl version from Gurusamy Sarathy comes with a working
GD, that does behave exactly the same way as the original. Apart from
that, it's a much more recent version of perl than the ActiveState
one.. Maybe you should download that?
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Mon, 05 Jan 1998 04:54:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: HELP ME How I can to compare two date 01/12/1997>=01/01/1997
Message-Id: <comdog-0501980454450001@news.panix.com>
Keywords: just another new york perl hacker
In article <68p9r8$q4i$1@talia.mad.ibernet.es>, "Jose Carrasco Clemente" <jcc@sodefesa.es> posted:
> Help me i can not to compare two date.
perhaps with one of the nifty Date modules available at CPAN
<URL:http://www.perl.com>?
--
brian d foy <http://computerdog.com>
------------------------------
Date: 5 Jan 1998 08:00:03 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: HELP ME How I can to compare two date 01/12/1997>=01/01/1997
Message-Id: <68qlgj$bf8@panix.com>
In <68p9r8$q4i$1@talia.mad.ibernet.es> "Jose Carrasco Clemente" <jcc@sodefesa.es> writes:
>Help me i can not to compare two date.
Perl Modules are your friend.
Date::Manip is a friend in this case (untested):
#!/usr/local/bin/perl
use Date::Manip;
$date1 = ParseDate("01/12/1997");
$date2 = ParseDate("01/01/1997");
if ($date1 lt $date2) {
# date1 is earlier
} else {
# date2 is earlier (or the two dates are identical)
}
You could alway do something hokey like reformat the date to yymmdd format:
#!/usr/local/bin/perl
$date1 = "01/12/1997";
$date2 = "01/01/1997";
($m1,$d1,$y1) = split /\//, $date1;
$ymd1 = "$y1$m1$d1";
($m2,$d2,$y2) = split /\//, $date2;
$ymd2 = "$y2$m2$d2";
if ($ymd1 > $ymd2) {
print "$date1 is greater than $date2\n";
} elsif ($ymd1 == $ymd2) {
print "The dates are the same\n";
} else {
print "$date1 is less than $date2\n";
}
Just make sure your dates are in the format you expect. One of the nice
things about the ParseDate function in Date::Manip is it understands date
strings like:
- today
- tomorrow
- next Thursday
- three weeks ago
- first Wed in Aug
For example (Note: these are old examples -- that's why the dates aren't
current):
#!/usr/local/bin/perl -w
use Date::Manip;
$leaving = UnixDate(ParseDate("next Thursday"), "%F");
$returning = UnixDate(ParseDate("Monday in 2 weeks"), "%F");
print "I'm leaving on $leaving and returning on $returning.\n";
$payment_date = UnixDate(ParseDate("first Wed in Aug"), "%D");
print "The payment is due on $payment_date.\n";
$three_weeks_ago = UnixDate(ParseDate("3 weeks ago"), "%D");
print "Three weeks ago was $three_weeks_ago.\n";
This program outputs:
I'm leaving on Thursday, July 10, 1997 and returning on Monday, July 21, 1997.
The payment is due on 08/06/97.
Three weeks ago was 06/16/97.
HTH,
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Mon, 05 Jan 1998 19:52:58 +1000
From: Neil Barker <neil@mail.cqit.qld.edu.au>
Subject: Help! "%1 is not a valid Windows NT application."
Message-Id: <34B0AD79.8572E307@mail.cqit.qld.edu.au>
I have an IIS 4 pentium server with perl working fine. I just installed
the Dec 31 release OK as well.
I am trying to add a discussion BBS. There are a few written for Unix
that should work. However, I get the following error when my browser
calls the cgi file.
"%1 is not a valid Windows NT application. "
I can't see the %1 used anywhere in the cgi file nor am I using it as a
parameter.
Any clues?
Neil
--
+----------------------------------------------------------------+
| /\ / /--- / / Neil Barker neil@cqit.qld.edu.au |
| / \ / /-- / / Ph 61 79 403335 Fax 61 79 403319 |
| / \/ /___ / /___ Central Queensland Institute of TAFE |
| http://www.cqit.qld.edu.au Mackay, Queensland, Australia |
+----------------------------------------------------------------+
------------------------------
Date: 5 Jan 1998 06:41:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: i am a newbie
Message-Id: <68pvb3$fr2$1@client2.news.psi.net>
Fabrice Scemama (fabrice.scemama@gesnet.net) wrote on 1588 September 1993
in <URL: news:34afc017.4221670@news.hol.fr>:
++
++ Your present script can only work within
++ your local compiler (assuming you replace the
++ if ($name eq "lisa")
++ line with
++ if ($name == "lisa").
++
You are wrong.
== is for numerical comparison.
eq is for string comparison.
if ($name eq "lisa")
makes much more sense than
if ($name == "lisa")
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: Mon, 05 Jan 1998 04:54:23 GMT
From: jkugler@inreach.com (Joshua J. Kugler)
Subject: Re: i need perl5.0**
Message-Id: <34b0668c.697931@news.inreach.com>
On Mon, 5 Jan 1998 10:16:11 +0900, "jea kwnag lee"
<webmaster@www.synergy.co.kr> wrote:
()hi there
()i need windowNT perl5.0**
www.perl.com/CPAN/ports/winNT/
I read this group. Sometimes my ISP doesn't. Please e-mail too.
Joshua J. Kugler
Computer Consultant--Web Developer
jkugler@inreach.com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
------------------------------
Date: Sun, 04 Jan 1998 13:53:38 -0700
From: equipment@miworld.net
Subject: ISP selling equipment
Message-Id: <040198135338@miworld.net>
Please visit our ISP yard sale at:
http://www.miworld.net/forsale
We have Ascend Max 56k , Livingston Portmasters, US Robotics, Adtrends TSU's and cases for sale at reasonable prices.
For answers to questions regarding the sale and the equipment, e-mail to equipment@miworld.net.
Thanks for your time.
Webmaster
equipment@miworld.net
------------------------------
Date: 5 Jan 1998 06:57:50 GMT
From: hi@univ-perp.fr. (Henri Irla)
Subject: Javascript error on CGI perl application using Comunicator 4.x
Message-Id: <68q09e$ici$3@ws41.cnusc.fr>
hi,
I obtain currious error in javascript program on Communicator 4.x
JAVASCRIPT error http:/.......cv-manager.pl?view
forms.elements[0] has no properties !!!
on the other navigator i'ts fine ( Navigator 3 , IE 3-4,) programm run correctly .
this is program organisation :
Perl program is called by html form with post method.
CGI Perl program generate dynamic html page and call javascript module on it .
Perl program build dynamic page ( data table ) and initialise HIDDEN variable like this:
print "<TR>","<TD ALIGN=CENTER>", "<FORM NAME=View >" ,
"<INPUT TYPE=HIDDEN VALUE =\"$nom1\">",
.....
"<INPUT TYPE=HIDDEN VALUE =\"$info\">",
"<INPUT TYPE=button VALUE=$nbr_enr MAXLENGTH=2 SIZE=2 onClick=\"affiche_detail_cv(this.form)\">",
"</FORM>", .... ;
Javascript module is called and generate new window witch display contents of var for each row selected on master window ( click on selected button ...). javascript module load first var like this :
function affiche_detail_cv(form) {
select_nom = form\.elements[0].value; <--- # [ Line 53 ]
........
select_numero = form\.elements[19].value;
afficher = affiche (\"Window0\")\;
}
and print var contents on new window generated :
function affiche () {
.....
Window0\.document\.write(\"<TD>\" + select_niveau_etude + \"</TD>\" + \"<TD>\" + select_diplome + \"</TD>\" + \"<TD>\" + select_info_diplome + \"</TD>\" + \"<TD>\" + select_etablissement + \"</TD>\" + \"<TD>\" + select_obtention + \"</TD>\" + \"<TD>\" + select_info_etude + \"</TD></TABLE>\");
.....
}
this run fine on all navigators except on communicator that display error message :
Javascript error
http:................;cv_manager.pl?View
line 53
Forms.elements[0] has no properties
I d'ont understand what happen !
any one can help me ?
we can view application on : http://www.univ-perp.fr/creufop
Menu Icon : Recherche de CV
select 1 or any criterion
and click on button row selected
Thank in advance .
Henri Irla <hi@univ-perp.fr>
------------------------------
Date: 5 Jan 1998 07:54:16 GMT
From: "Sean Scannell" <dundee@ccnet.com>
Subject: Multiple field sorting not working
Message-Id: <01bd19ae$85246240$4fcdb5cf@fritz.ccnet.com>
I've read the Camel and "How do I sort anything" examples, but can't get
my sorted array to look any different from the unsorted array. I've played
with <=> and cmp as operators. I also tried to set a variable in the sub to
make sure the sub was being used, but bombed. The essence:
foreach $_ (@ansdata) {
($ansid, $ans_text, $max_points, $ded_points, $sectid, $sect_descr,
$chosen) = split(/:/);
### some criteria here ####
push(@display, join(":", $sectid, $sect_descr, $max_points, $ansid,
$ans_text, $chosen, $y, $n));
}
@display_sort = sort order @display;
sub order {
$max_points{$b} <=> $max_points{$a} ### descending value
or
$ansid{$a} cmp $ansid{$b} ;
}
------------------------------
Date: 5 Jan 1998 08:47:25 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Multiple field sorting not working
Message-Id: <68qo9d$edn@panix.com>
In <01bd19ae$85246240$4fcdb5cf@fritz.ccnet.com> "Sean Scannell" <dundee@ccnet.com> writes:
>I've read the Camel and "How do I sort anything" examples, but can't get
>my sorted array to look any different from the unsorted array. I've played
>with <=> and cmp as operators. I also tried to set a variable in the sub to
>make sure the sub was being used, but bombed. The essence:
>foreach $_ (@ansdata) {
>($ansid, $ans_text, $max_points, $ded_points, $sectid, $sect_descr,
>$chosen) = split(/:/);
>### some criteria here ####
>push(@display, join(":", $sectid, $sect_descr, $max_points, $ansid,
>$ans_text, $chosen, $y, $n));
>}
>@display_sort = sort order @display;
>sub order {
> $max_points{$b} <=> $max_points{$a} ### descending value
> or
> $ansid{$a} cmp $ansid{$b} ;
> }
Did you run the script with warnings enable (with the -w switch)? Like this:
#!/usr/local/bin/perl -w
Do you get "Use of uninitialized value"? -- I'm wondering, because I don't
see where you've defined the hash in your subroutine. For example:
Suppose we are producing a monthly disk report. We have an associative
array, %usage, which is keyed by user name and stores total disk usage
information in MBytes. We would like to have a list of user names in
descending order of disk usage so we can send nasty-grams to the top
ten or so. We need to sort the list of keys in the array by the values
referenced by those keys:
@sorted = sort { $usage{$b} <=> $usage{$a}; } keys %usage;
Since the granularity of our data is MBytes, we may have several users
with the same amount of disk usage. We can refine our sort to
alphabetize user names with equivalent disk usage
@sorted = sort { $usage{$b} <=> $usage{$a} || $a <=> $b; } keys%usage;
This is an example of a multifield sort. It relies on the short-circuit
evaluation of the logical OR to only do the second comparison if the
disk usage values are equal (i.e., if the "spaceship operator," <=>,
returns zero).
Perl Practicum: Out of Sorts
<http://www.usenix.org/publications/perl/perl01.html>
Several references to sorting in Perl are found in Perl Reference at:
http://reference.perl.com/query.cgi?sort
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Mon, 05 Jan 1998 00:41:01 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Need script to preview form data prior to submitting
Message-Id: <mbudash-0501980041010001@d172.pm5.sonic.net>
In article <comdog-ya02408000R0201980511170001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
>> In article <mbudash-0201980107460001@d91.pm2.sonic.net>,
mbudash@sonic.net (Michael Budash) posted:
>>
>> >In article <comdog-ya02408000R0201980121100001@news.panix.com>,
>> >comdog@computerdog.com (brian d foy) wrote:
>> >
>> >>> >part 2 (optional)
>> >>> >------
>> >>> >validate input if "confirm" or "ok" have been passed in, noting any
>> >>> >errors. (more on these two values later)
>> >>>
>> >>> this part is a really bad idea. the user can change the data
>> >>> in the HTML file and submit anything he likes in the field. i don't
>> >>> like to give the user that much flexibility. i suggest a string of
>> >>> CGI scripts:
>> >
>> >i don't follow you, brian. there _is_ no "HTML file"...
>>
>>
>> from where is the form data coming?
>>
it's in the script (uh, oh, did i say "hard-coded"??)
--
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736
------------------------------
Date: Mon, 05 Jan 1998 08:29:53 -0500
From: Tim Edgren <tedgren@ford.com>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Need script to preview form data prior to submitting
Message-Id: <34B0E051.7182@ford.com>
brian d foy wrote:
>
> In article <mbudash-0101981739410001@d67.pm9.sonic.net>, mbudash@sonic.net (Michael Budash) wrote:
>
> >
> >part 1
> >------
> >parse input (if any). use CGI.pm or <god forbid> cgi-lib.pl
> >
> >part 2 (optional)
> >------
> >validate input if "confirm" or "ok" have been passed in, noting any
> >errors. (more on these two values later)
>
> this part is a really bad idea. the user can change the data
> in the HTML file and submit anything he likes in the field. i don't
> like to give the user that much flexibility. i suggest a string of
> CGI scripts:
>
> form generator -> HTML FORM -> form checker script ->
> PREVIEW PAGE -> process/email script
>
> each step must go on to the next. i usually integrate some sort
> of checksum (generated by the form checker and checked by the
> final script) to see if the data were mucked with between them.
> it's still possible to muck with the data, but most people won't
> go through the trouble to figure out the checksum stuff, and those
> that do are going to find a way to play with your scripts
> regardless.
>
> this technique has the great advantage of letting one work on
> peices of the system without messing up everything with a single
> syntax error. use of a consistent naming scheme for such a string
> of scripts, such as
>
> guestbook_form_maker.cgi
> guestbook_form_checker.cgi
> guestbook_form_processer.cgi
>
> makes them easy to manage, especially if you have several applications
> that use this technique. everyone in your <buzzword>enterprise</buzzword>
> knows which script does what function in the grand scheme of things.
>
> >part 3
> >------
> >if "confirm" passed in and there were no validation errors, process the
> >form data and exit the program
> >
>
> --
> brian d foy <comdog@computerdog.com>
> Institute For the Organically-Challenged
> <URL:http://computerdog.com/brian/Institute.html>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Brian --
I understand how someone could muck with the output HTML from your form
generator and resubmit it to your form checker; and the need for a
checksum to prevent (or at least know about) the fact that the form had
been modified. Can you provide a code or pseudo-code example of how you
would implement the checksum?
------------------------------
Date: Mon, 05 Jan 1998 04:44:23 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Trick?
Message-Id: <comdog-0501980444230001@news.panix.com>
Keywords: just another new york perl hacker
In article <68poon$22c$1@winter.news.erols.com>, wcb4@erols.com posted:
> On Sun, 4 Jan 1998 04:37:06 -0600, "Sam Iron" <persoft@cris.com>
> wrote:
>
> >Reading between the lines, my guess is that you should be looking into
> >server side INCLUDES in your (s)html code.
> >
> >>Besides having a java program execute a perl prog: does anyone know
> >>of a way of having a perl program execute as soon as a page is accessed?
To avoid returnign a broken
> graphic link though you would have to return a Content:x-image/gif and
> a redirection a real gif file though. I could be compeltely wrong on
> this
not completely wrong. one has to return an image (not redirect).
the proper header to specify image data would be
Content-type: image/whatever-format-it-is
--
brian d foy <http://computerdog.com>
------------------------------
Date: Mon, 05 Jan 1998 01:02:08 -0500
From: Jihad Battikha <jbattikha@highsynth.com>
Subject: Re: PERLIPC - FIFO: parent, child, stalled!
Message-Id: <34B07760.13BBE6F2@highsynth.com>
Tom Phoenix wrote:
> The == test (like all math operators in Perl) will turn undef into 0
> before testing. The only way to check for undef is to use the defined()
> function. So the usual code checks defined() first, then if it was
> defined, it checks true/false (which, in this case, is the same as
> checking non-zero/zero).
Well, then it's a good thing I called:
defined($pid = fork) || &error('fork');
to actually create the fork. :-)
I assume if I didn't fork that way, the child would be taken as an
error.
I've finally been able to grasp what's going on with this stuff much
better thanks to all the folks who have responded. The code is getting
much more complex now & I've even devised a way to create multiple FIFOs
within a single script without causing any process to hangs. Now I'm
fiddling with Justin's sample code to make sure I don't screw myself if
any of the processes fail.
Anyway, once the PGP folks fix their STDIN bug, I can go back to the
IPC::Open(2/3) modules and save myself a headache. I just need to have
*something* working for the time being.
BTW, Tom, I've been successfully "de-tainting" my scripts...I'm starting
to understand what this means (not fully, but enough to give me much
protection).
Finally, I understand that a FIFO is not as secure as directly piping to
STDIN/STDOUT but it's also more secure than an actual temp file since
the data doesn't get written to the FIFO until there's a READ on it
(which brings up it's own security issues, but I can deal with those
creatively). I actually enjoyed the challenge, even if a month from now
all of it will probably be moot...it's nice stuff to understand for
other things down the line.
Thanks all.
--
_JIHAD_BATTIKHA___________
| jbattikha@highsynth.com `\
| http://www.highsynth.com |
| ====================== __H__
| - graphics | | |
| - 2d/3d animation |__|__|
| - illustration ) |
| - interface design / |
:.. . . . . . . . \_____/
------------------------------
Date: Mon, 05 Jan 1998 06:51:59 GMT
From: wcb4@erols.com (William Byrd)
Subject: strangest Q you've seen regarding storing entire binary file as a hex dump in a varaible.
Message-Id: <68pq1i$kap$1@winter.news.erols.com>
Okay folks, This is probably the strangest thing you've ever seen
anyone want to do with a perl script. The question really is a perl
question even though its for a CGI,but to understand what I am talking
about, you need to know something about the CGI. Even if you don't do
or write CGI's, you might know this one.
I want a perl script to generate an html page, simple enough, but I
also want the perl script to generate a graphic on the page so that no
external file would be needed for the graphic itself. Seems like a
waste, but I would eventually like to compile this program so no one
sees the source, but the graphic is included.
This is stricly conjecture on my part, so someone stop me if I am
completely off the deepend (If I'm just nuts, let me go on, but stop
me at the deep end)
I can make a perl script open a gif file
convert all of the values to hex
write them to a file
open this file and start writing me script right in the file
set a variable (say $graphic) = to all this hex information (this is
why I am assuming I should do this as hex information, so it
can be included in the plain text file I am writing as a
script)
have my CGI perl script convert this back from hex (so it is now store
internally correctly)
have my perl script return the correct content type header and then
print $graphic.
anyone ever done anything this crazy? will it work? anyone got any
ideas? I've got the camel book so I can look up how to make it convert
the values to hex (I thing I even have a text editor that can open
binar files directly and show them to you as a hex dump. For any
DOS/win3.1/win95/Win NT folks out there, TextPad is probably the best
programming editor I've found for this platform)
Any help again appreciated.
wcb4@erols.com
----Pres. ISSTLI "International Support Society for the Tag Line
Impaired"
------------------------------
Date: 5 Jan 1998 00:42:56 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: strangest Q you've seen regarding storing entire binary file as a hex dump in a varaible.
Message-Id: <68pvdg$18r@tekka.wwa.com>
wcb4@erols.com writes:
>Okay folks, This is probably the strangest thing you've ever seen
>anyone want to do with a perl script.
If you insist...
It's not clear what you want to do. If you want to keep your gif in
a printable ascii string, that's easy enough. Look up pack("u", ...)
and unpack("u", ...); that's one way to do it.
If you are talking about producing HTML and an inline graphic on the
same stream -- I think that's not how HTML works, but you will have
to ask the experts, who are on another group.
------------------------------
Date: Mon, 05 Jan 1998 10:36:32 -0800
From: Andy Webb <AWebb@Ford.com>
Subject: Re: Use modem as voice speed dialer?
Message-Id: <34B12830.24D9@Ford.com>
I may be wrong here - but try putting a semicolon after the phone
number.
Andy
doug a blaisdell wrote:
>
> Hi Everybuddy!
> I'd like to use my modem to do my voice telephone dialing for me.
> I know there's a win95 utility for this, but I wanted to do it on
> Linux, preferably using Perl. I've gotten to the point where I can
> do the dialup OK, but I don't know how to tell the modem to give
> control to the telephone, after somebody answers the phone.
>
> Anybuddy know how to do this?
>
> thanks,
> doug
------------------------------
Date: 5 Jan 1998 11:43:33 GMT
From: in1036@wlv.ac.uk (Steph Thornton)
Subject: Web Database Survey REPOST
Message-Id: <68qh15$g07@ccuh.wlv.ac.uk>
Hi,
I am studying for my M.Sc. in Advanced Software Technology and have
chosen the topic of web databases for my project.
I have created a short survey of 11 questions at this URL:
http://www.wlv.ac.uk/~in1036/java/websurv.htm
and I would be so grateful if you could fill in a valid response for me before the
end of January 1998.
The results will be posted at the same site once compiled.
Thanks in advance,
Steph :-)
======
Stephanie Thornton
Support Analyst, University of Wolverhampton, England
in1036@wlv.ac.uk http://www.wlv.ac.uk/~in1036
======
"Education is a wonderful thing. If you couldn't sign your name
you'd have to pay cash." Rita Mae Brown
======
------------------------------
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 1581
**************************************