[18065] in Perl-Users-Digest
Perl-Users Digest, Issue: 225 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 6 18:06:23 2001
Date: Tue, 6 Feb 2001 15:05:28 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981500727-v10-i225@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Feb 2001 Volume: 10 Number: 225
Today's topics:
Re: "Average of List of Numbers" by Abigail <mischief@velma.motion.net>
Re: "Average of List of Numbers" by Abigail <mischief@velma.motion.net>
Re: "Average of List of Numbers" by Abigail <mischief@velma.motion.net>
Re: a bug in perl-5.6.0? <mischief@velma.motion.net>
Re: a web based database michellep@amuletc.com
Array and splits =help! <vivekvp@spliced.com>
Re: Array and splits =help! egwong@netcom.com
Re: Array and splits =help! aramis1631@my-deja.com
Re: Array and splits =help! <godzilla@stomp.stomp.tokyo>
Re: Cannot Decrement in For Loop? <Stephen.Mayer@oracle.com>
Re: Cannot Decrement in For Loop? (Eric Bohlman)
Re: Cannot Decrement in For Loop? (Craig Berry)
Re: date select (Rudolf Polzer)
Re: date select <uri@sysarch.com>
Re: Directory structure (Andy Dougherty)
Re: er, how? (Rudolf Polzer)
Re: Help with calling functions from dynamic/shared lib <jeff_nokes@yahoo.com>
Re: Help with headers in IE?? <blaqflame@hotmail.com>
Re: Help with simple Unix command script to delete some <aida@globalnet.co.uk>
Re: How to tell which perl is running? <mischief@velma.motion.net>
Image Magick manipulations jenhuebert@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Feb 2001 20:42:15 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: "Average of List of Numbers" by Abigail
Message-Id: <t80od7hpboeme3@corp.supernews.com>
In comp.lang.perl.misc Friedrich Dominicus <frido@q-software-solutions.com> wrote:
> Chris Stith <mischief@velma.motion.net> writes:
>>
>> Like I mentioned earlier, Abigail's knowledge of the language
>> impresses me, including in this example. I doubt, though, that
>> Abigail herself would call her example "strikingly elegant".
>> Impressive in how it's done, perhaps. Impressive in its length
>> or its speed, no.
>>
> From the mentioned page
> |Shown here is a strikingly elegant way to calculate the average of an array of numbers.
> |>Artiste: Abigail
> |Medium: Perl
And this site stating such is proof that this site should state such?
It seems the snake is swallowing its tail.
Chris
--
Christopher E. Stith
Parking for people we like only. All other vehicles will be vandalized.
------------------------------
Date: Tue, 06 Feb 2001 20:51:57 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: "Average of List of Numbers" by Abigail
Message-Id: <t80ovd7g20d6df@corp.supernews.com>
In comp.lang.perl.misc Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Mon, 05 Feb 2001 21:13:40 -0000,
> Chris Stith <mischief@velma.motion.net> wrote:
>> In comp.lang.perl.misc Terrence Brannon <brannon@lnc.usc.edu> wrote:
>>
>>> The Museum of Modern Programming is proud to present its first work:
>>
>>> "Average of List of Numbers" by Abigail.
>>
>>> The Museum of Modern Programming: http://www.momp.org
>>
>> www.momp.org
> Server: wula.comdyn.com.au
> Address: 172.18.240.18
> Non-authoritative answer:
> Name: www.momp.org
> Address: 209.132.1.73
>> server dns1.motion.net
> Default Server: dns1.motion.net
> Address: 216.1.104.12
>> www.momp.org
> Server: dns1.motion.net
> Address: 216.1.104.12
> *** dns1.motion.net can't find www.momp.org: Query refused
> Seems the problem is with your server.
Funny, Martien's post is about the time that my name server
could find the site. Previously, I used my server and two others
(not on my network) to check it, and couldn't find it. All three
update from the root servers. Is the site brand new? Perhaps it
was a propagation problem.
Anyway, I just posted the nslookup to let the site admin know,
and to confirm whether or not it should be working at that time.
It's been working for me since approximately 18:05 US CST 5 Feb.
(00:05 UCT 6 Feb I believe.)
I disagree with the label of "strikingly elegant", but Abigail's
example is interesting and somewhat impressive.
Chris
--
Christopher E. Stith
Try not. Do, or do not. The Force is binary. -- Yoda,
The Empire Strikes Back (paraphrased)
------------------------------
Date: Tue, 06 Feb 2001 21:44:06 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: "Average of List of Numbers" by Abigail
Message-Id: <t80s16i6mqoa0c@corp.supernews.com>
In comp.lang.perl.misc Bernie Cosell <bernie@fantasyfarm.com> wrote:
> Terrence Brannon <brannon@lnc.usc.edu> wrote:
> }
> } The Museum of Modern Programming is proud to present its first work:
> }
> } "Average of List of Numbers" by Abigail.
> }
> } The Museum of Modern Programming: http://www.momp.org
> I remember when this first went by and I had a meta question about the
> 'elegance' of it. I'd have done:
> eval(join("+", @nums))
So you mean this?
@nums = (1..10);
$avg = ( eval(join("+", @nums)) / @nums);
This is shorter and easier to understand than Abigail's method
using do(), but is nearly identical in speed tests. Great golf
score, but I don't want to use it in a tight loop.
> rather than messing with $". Is this way a LOT less elegant
> and striking that using local $"?
Elegance can mean lots of things to different people, sometimes
differing with context. In the context of programming, I've
always thought elegance had to do with doing something in a
way that is either conscise and fast or simple but not
necessarily obvious.
Here's Webster's take:
#----------------------------------------------------------------
Main Entry: el e gant
Pronunciation: 'e-li-g&nt
Function: adjective
Etymology: Middle French or Latin; Middle French, from
Latin elegant-, elegans; akin to Latin eligere
to select -- more at ELECT
Date: 15th century
1 : marked by elegance
2 : of a high grade or quality : SPLENDID <elegant gems priced at
hundreds of thousands of dollars>
synonym see CHOICE
- el e gant ly adverb
#----------------------------------------------------------------
#----------------------------------------------------------------
Main Entry: el e gance
Pronunciation: 'e-li-g&n(t)s
Function: noun
Date: circa 1510
1 a : refined grace or dignified propriety : URBANITY
b : tasteful richness of design or ornamentation <the
sumptuous elegance of the furnishings>
c : dignified gracefulness or restrained beauty of style :
POLISH <the essay is marked by lucidity, wit, and
elegance>
d : scientific precision, neatness, and simplicity <the
elegance of a mathematical proof>
2 : something that is elegant
#----------------------------------------------------------------
Abigail's averaging program fits 1b of "elegance" and maybe 1a,
but others fit 1c and 1d much better. That's all referenced through
"elegant", entry 1. As for "elegant", entry 2, what one considers
a high grade or quality of code may differ from what another
considers to be a high grade or quality based on certain criteria.
If we're judging quality on novelty and conciseness, then Abigail's
program scores highly in this respect. If we judge by execution
speed compared to equivalent code, it scores lowly (at least in my
environment). If we look for something concise yet maintainable,
I'd score Bernie's higher than Abigail's.
In the case of "elegance" entry 1d, I'd score the control case I
mentioned in one of my other posts highest I've seen in this
thread, because it is as precise as the rest and is the simplest.
As for entry 1c, I'd say that's a hard call.
Of course, all of these presuppose using a particular dictionary
and are from my point of view. I don't claim these ramblings
should reflect the opinions of others in the group. They are just
a bit of an explanation why I, personally, do not find the mentioned
program "strikingly elegant". Others may have different opinions,
which is good since variety is the spice of life.
Chris
--
Christopher E. Stith
Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental. -- nobull, clp.misc
------------------------------
Date: Tue, 06 Feb 2001 20:25:52 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: a bug in perl-5.6.0?
Message-Id: <t80neg2vtmjg21@corp.supernews.com>
Alexey Morozov <morozov@novosoft.ru> wrote:
> Look at two sample scripts:
> -----------------------------------------------------
> use strict;
> my @array = ('a','b',undef,'c','d');
> my @results = map {
> ;
> SWITCH:
> {
> $_.'null', last SWITCH unless defined $_;
> $_.$_, last SWITCH if ($_ eq 'a');
> $_.", wow!", last SWITCH if ($_ eq 'b');
> $_." default";
> }
> } @array;
> print "Results: ('".join("', '",@results)."')\n";
> -----------------------------------------------------
The above does not run with warnings turned on. You are
using a concatenation in a void context, as the warning
would have mentioned. Strictures are a good addition to
warnings, not a replacement.
Perhaps you meant this:
#------------------------------------------------------
#!/usr/bin/perl -w
use strict;
use diagnostics;
my @array = ('a','b',undef,'c','d');
my @results = map {
;
SWITCH:
{
$_ .= "null", last SWITCH unless defined $_;
$_ .= $_, last SWITCH if ($_ eq 'a');
$_ .= ", wow!", last SWITCH if ($_ eq 'b');
$_ .= " default";
}
} @array;
print "Results: ('".join("', '",@results)."')\n";
#------------------------------------------------------
Note the use of q<.=> as opposed to q<.>, which makes a
big difference.
------------------------------------------------------
> my @array = ('a','b',undef,'c','d');
> my @results = map {
> ;
> SWITCH:
> {
> 'null', last SWITCH unless defined $_; # this line was changed
> $_.$_, last SWITCH if ($_ eq 'a');
> $_.", wow!", last SWITCH if ($_ eq 'b');
> $_." default";
> }
> } @array;
> print "Results: ('".join("', '",@results)."')\n";
> -----------------------------------------------------
This doesn't join "null" to anything. Turn on warnings.
This is more broken than the already broken code above.
The map() function expects its code block to return
something. Altering q<$_> is somewhat equivalent to
returning something, which is why my code above works
even with warnings and why your original version works
if you don't enable warnings.
This second example of yours complains about a constant
in a void context.
> Do you see the significant difference between these two?
> I don't.
Not much difference under warnings.
> Nevertheless, the first is compiled and work properly,
> the second can not even be compiled.
Neither can be if you turn on warnings.
> If we change that line to, say
> ''.'null', last SWITCH unless defined $_;
> we even get result, but the _wrong_ result
> (Results: ('aa', 'b, wow!', 'c default', 'd default')).
Those are the right results. You don't assign anything to
q<$_> on that line, so it is still undefined. If you map
an undefined value to an array element, it makes sense
(at least to me) that the array element wouldn't be defined.
This program is doing the closest thing it can to the
correct behavior from perl's understanding of your code.
> I can't explain this. Please suggest.
Warnings are your friend. The diagnostics module can help
you, too, but warnings should come first in troubleshooting,
then strictures. These two should also be used in your
production code most of the time. Diagnostics can provide
additional help when troubleshooting, but I don't leave them
enabled for production use (it's just one line to change in
the source).
Chris
--
Christopher E. Stith
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Tue, 06 Feb 2001 22:29:01 GMT
From: michellep@amuletc.com
Subject: Re: a web based database
Message-Id: <95ptqt$6b$1@nnrp1.deja.com>
You might try the system on www.ecriteria.ws - it walks you through
setting up your web database and linking it to your site. You don't
have to do any programming for it, and it allows you to set up your
query options.
Hope this helps!
MP
In article <93kl4e$7t1$1@nnrp1.deja.com>,
Maccer01 <maccer01@my-deja.com> wrote:
> I wish to set up a database on my web server, and then query it from a
> web browser. What is the best method to do this?
> I have been told PHP and SQl is commonly used, also, is ASP worth
> considering?
> Finally, can a databse be queried using any other methods such as
> cgi/perl, or DHTML?
>
> Thanks in anticipation
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 20:54:17 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Array and splits =help!
Message-Id: <95po9k$qmd$1@nnrp1.deja.com>
I am trying ot take and array and split it in 2 arrays:
basically the array @pairs should split into 2 arrays - @names and
@values - but it never works - printing @name only give the last record
and the @values is blank.
If the @pairs is (a=1&b=2&c=3&d=4) (the '&'s are already gone)
I want to get:
@name=(abcd)
@value=(1234)
How do I do that?
Thanks,,
V
Confusing code below:
@pairs = split(/&/, $buffer);
print "Content-type: text/html\n\n";
print "<html>";
#***TEST PRINT***
print "<br> buffer contents: $buffer \n";
print "<br> @pairs \n";
foreach $pair (@pairs)
{
(@name, @value) = split(/=/, $pair);
print"<br> name: $name, value: $value \n";
print"<br> $pair \n";
}
#****
--
He who fights and runs away, lives to run another day!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 22:38:49 GMT
From: egwong@netcom.com
Subject: Re: Array and splits =help!
Message-Id: <Z1%f6.128$pA1.14761@news.flash.net>
vivekvp <vivekvp@spliced.com> wrote:
> I am trying ot take and array and split it in 2 arrays:
> basically the array @pairs should split into 2 arrays - @names and
> @values - but it never works - printing @name only give the last record
> and the @values is blank.
> If the @pairs is (a=1&b=2&c=3&d=4) (the '&'s are already gone)
If you're doing cgi, do yourself a huge favor and download and use
something like CGI.pm (http://search.cpan.org/search?dist=CGI.pm) or
CGI::Lite (http://search.cpan.org/search?dist=CGI-Lite) to decode
forms for you.
If you're not doing cgi, what you want is a hash (see perldata), not
parallel arrays. You *don't* want to remove the ampersands from your
buffer, otherwise you have no delimiter. Use split (see perlfunc)
to divide up your buffer string.
my $buffer = 'a=1&b=2&c=3&d=4';
my %hash = split(/[=&]/, $buffer ); # split on both '&' and '='
while ( my ($k, $v) = each %hash ) {
print "$k: $v\n";
}
foreach my $key ( keys %hash ) { # or
print "$key: $hash{$key}\n";
}
Remember, if you have two data fields with the same key (e.g.
$buffer='a=1&b=2&a=3'), the second one will overwrite the first.
Use warnings, use strict, use taint and use CGI.
HTH.
------------------------------
Date: Tue, 06 Feb 2001 22:28:36 GMT
From: aramis1631@my-deja.com
Subject: Re: Array and splits =help!
Message-Id: <95ptq5$60$1@nnrp1.deja.com>
I see a couple of mistakes...
In article <95po9k$qmd$1@nnrp1.deja.com>,
vivekvp <vivekvp@spliced.com> wrote:
> I am trying ot take and array and split it in 2 arrays:
>
> basically the array @pairs should split into 2 arrays - @names and
> @values - but it never works - printing @name only give the last
record
> and the @values is blank.
>
> If the @pairs is (a=1&b=2&c=3&d=4) (the '&'s are already gone)
> I want to get:
> @name=(abcd)
> @value=(1234)
>
> How do I do that?
>
> Thanks,,
>
> V
>
> Confusing code below:
>
> @pairs = split(/&/, $buffer);
>
> print "Content-type: text/html\n\n";
> print "<html>";
>
> #***TEST PRINT***
> print "<br> buffer contents: $buffer \n";
> print "<br> @pairs \n";
> foreach $pair (@pairs)
> {
> (@name, @value) = split(/=/, $pair);
#aramis both name and value get stuffed in the first array -- you
should expect this
> print"<br> name: $name, value: $value \n";
#aramis here you are referencing a scalar $name, $value when you want
an element of the array, as in $name[0], $value[0]
> print"<br> $pair \n";
> }
> #****
>
consider the following...
$i=0;
foreach $pair (@pairs)
{
($nam, $val) = split(/=/, $pair);
$name[$i]=$nam;
$value[$i]=$val;
print" name: $name[$i], value: $value[$i] \n";
print"$pair \n";
$i++;
}
I'm sure there's a better way - but this should be clear.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 14:56:02 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Array and splits =help!
Message-Id: <3A808102.DABF1D2F@stomp.stomp.tokyo>
vivekvp wrote:
> I am trying ot take and array and split it in 2 arrays:
> basically the array @pairs should split into 2 arrays - @names and
> @values - but it never works - printing @name only give the last record
> and the @values is blank.
> If the @pairs is (a=1&b=2&c=3&d=4) (the '&'s are already gone)
> I want to get:
> @name=(abcd)
> @value=(1234)
> How do I do that?
(snipped)
Your two arrays display only one element each.
My presumption is this is not what you want.
Godzilla!
--
TEST SCRIPT:
___________
#!perl
print "Content-type: text/plain\n\n";
$buffer = "a=1&b=2&c=3&d=4";
@Pairs = split(/&/, $buffer);
print "Array Pairs Contains:\n @Pairs\n\n";
print "Your Method:\n\n";
foreach $pair (@Pairs)
{ (@Name, @Value) = split(/=/, $pair); }
print " Array Name Contains: @Name\n",
" Array Value Contains: @Value\n\n";
@Name = ();
@Value = ();
print "My Method:\n\n";
foreach $pair (@Pairs)
{
($name, $value) = split (/=/, $pair);
push (@Name, $name);
push (@Value, $value);
}
print "Array Name Contains: @Name\n",
"Array Value Contains: @Value\n\n";
exit;
PRINTED RESULTS:
________________
Array Pairs Contains:
a=1 b=2 c=3 d=4
Your Method:
Array Name Contains: d 4
Array Value Contains:
My Method:
Array Name Contains: a b c d
Array Value Contains: 1 2 3 4
------------------------------
Date: Tue, 06 Feb 2001 11:03:37 -0800
From: Steve Mayer <Stephen.Mayer@oracle.com>
Subject: Re: Cannot Decrement in For Loop?
Message-Id: <3A804A89.502FCE26@oracle.com>
Gabriel Richards wrote:
>
> This works fine:
>
> for (my $i=1; $i<$num+1; $i++) {
> my $j = ID('pollans', 'ansid', $dbh);
> $answers{$j} = $cgi->param("ans$i");
> }
>
> The problem is, I need the answers saved in %answers in reverse order so I
> tried this:
>
> for (my $i = $num; $i<1; $i--) {
> my $j = ID('pollans', 'ansid', $dbh);
> $answers{$j} = $cgi->param("ans$i");
> }
>
> But $i is not decrementing (I've tested by printing $i in the loop). Help?
>
> Gabe
> --
> Ender Technology
> Website and Database Development for Small Business
> http://www.endertechnology.com
> 310-532-7455
The problem here is your statement "$i<1". The loop will only
complete as long as $i is less than 1. If you are trying to count
down from some number to zero then maybe you
want $i>0.
Steve
------------------------------
Date: 6 Feb 2001 19:28:34 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Cannot Decrement in For Loop?
Message-Id: <95pj92$aau$1@bob.news.rcn.net>
Gabriel Richards <grichards@endertechnology.com> wrote:
> The problem is, I need the answers saved in %answers in reverse order so I
> tried this:
> for (my $i = $num; $i<1; $i--) {
> my $j = ID('pollans', 'ansid', $dbh);
> $answers{$j} = $cgi->param("ans$i");
> }
> But $i is not decrementing (I've tested by printing $i in the loop). Help?
As others have pointed out, the problem was the $i<1 condition. What I
find interesting is what apparently happened cognitively (everybody, if
you haven't already done so, read Gerald Weinberg's _The Psychology of
Computer Programming_. It is a *classic*). It looks like when you
decided to reverse the order of the loop, your mind unconsciously decided
that since you were doing things backwards, the loop conditional should
now be a *termination* condition rather than a *continuation* condition.
I'm pretty sure I've done similar things myself, but I can't remember the
exact details. It's sort of as if you're looking at the situation through
a mirror and you have to mentally rotate the details and you wind up
rotating some of them twice.
Anyone else have examples of constructs that seem to induce this sort of
double-negation (forgetting deMorgan's theorem when negating compound
conditionals would be a common example)?
------------------------------
Date: Tue, 06 Feb 2001 21:59:21 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Cannot Decrement in For Loop?
Message-Id: <t80stpj7irr1e2@corp.supernews.com>
Eric Bohlman (ebohlman@omsdev.com) wrote:
[snip]
: It's sort of as if you're looking at the situation through
: a mirror and you have to mentally rotate the details and you wind up
: rotating some of them twice.
:
: Anyone else have examples of constructs that seem to induce this sort of
: double-negation (forgetting deMorgan's theorem when negating compound
: conditionals would be a common example)?
Not sure if this is close enough to qualify, but it reminds me strongly of
the infamous Atari BASIC 'jumping edit bug'. In rev A of their ROM BASIC
for the 800 platform, any attempt to add a source line exactly 256
characters long would lock up the machine. This was very quickly traced
to an assembly-code test in the insert-line routine which should have
been "less than or equal" but had been coded as "less than". But, being
ROM code, there was no easy way to patch over the problem.
Needless to say, this was high on the fix list for the eagerly awaited rev
B. As the problem was so simple and straightforward, they gave the actual
task of changing the assembly source to a relatively inexperienced
developer. He made the change from "less than" to "less than or equal".
Then his eyes wandered to the delete-line routine, just following the
insert-line routine. It looked very similar, almost symmetric with
insert-line. But there the test was "greater than". "Uh oh, it
got in here, too," thought the developer to himself, and proceeded to
recode it as "greater than or equal".
As I'm sure you can all guess, in ROM BASIC rev B, *deleting* a line
exactly 256 characters long locked the machine.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Tue, 6 Feb 2001 21:39:12 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: date select
Message-Id: <slrn980o7g.4h2.rpolzer@rebounce.rpolzer-lx>
Phyllis Choate <choate@spot.colorado.edu> schrieb Folgendes:
> I cannot get the select day...as in 6th or 31st of the month to show in my
> html. can anyone help?
Please post URLs to such big beasts and NEVER post attachments in
newsgroups.
> begin 666 calendar.pl
^^
Why is everybody allowed to write to your files? Windoze?
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: Tue, 06 Feb 2001 22:48:24 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: date select
Message-Id: <x766inqvgq.fsf@home.sysarch.com>
please don't post encoded text. why did you do that? we can all read
text just fine. and in the future don't use mime either. just cut and
paste in the code. and don't post large whole programs, just the
relevent code.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 06 Feb 2001 20:24:07 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: Directory structure
Message-Id: <slrn980ndm.d1p.doughera@maxwell.phys.lafayette.edu>
In article <3A801051.3741A9D4@eyup.org>, John Poltorak wrote:
>Can someone give a pointer to what a typical directory structure looks
>like wrt PERL?
Yes. See the section
=head2 Installation Directories
in perl's INSTALL file.
--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
------------------------------
Date: Tue, 6 Feb 2001 18:41:36 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: er, how?
Message-Id: <slrn980dqg.3no.rpolzer@rebounce.rpolzer-lx>
Géry <ducateg@info.bt.co.uk> schrieb Folgendes:
> Hi
>
> I have a config file that looks like
>
> package mypackage;
>
> $FOO = "Hello";
> $BAR = "Yadayada";
>
> ...
>
> I would like to be able to update the config file. I can manage that, the
> problem is that the script does not pick up the changes. I guess it is
> because it compiles the code once and then every variable is in the
> "mypackage" variable table. How do I get Perl to compile the config file
> again?
Why not change the variables at the same time?
sub ChangeConfig
{
my $name, $value = @_;
# ...
no strict 'refs';
$name = "mypackage::$name";
$$name = $value;
}
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: Tue, 06 Feb 2001 12:14:49 -0800
From: "Jeffry A. Nokes" <jeff_nokes@yahoo.com>
Subject: Re: Help with calling functions from dynamic/shared libraries
Message-Id: <3A805B39.B113676@yahoo.com>
Thanks for the response. I've actually thought of doing that, but
basically, I'm making platform specific executable applications using
perl2exe. I'm trying to find a way to just update shared object files and
thus update my application. I'm also trying to use the same code for all
platforms. I'm writing the exe's in Perl and the shared libraries in GNU
C. I've looked at Dynaloader, and from what I've read, I don't think this
will do the trick. Also, I'm looking at the new FFI (Foreign Function
Interface) module, but it's too new and there is barely in documentation on
it, that I can find anyway. Would you happen to know if the Perl 6 effort
is tackling these issues?
Thanks,
- Jeff
jimjim123@my-deja.com wrote:
> My advice is read the perlxs man pages.... There are tutorials around
> which show you how to include C functions in your PERL code. In fact,
> I have a problem with this right now, but no-one answered my message
> about it :-(
>
> Cheers!
>
> Hamish Rickerby.
>
> In article <3A7F9E04.1F238A77@yahoo.com>,
> "Jeffry A. Nokes" <jeff_nokes@yahoo.com> wrote:
> > Greetings,
> > I was wondering if anyone new of a way to call functions from a ".so"
> > file in Linux/Unix from a Perl script? I currently use Perl on Win32
> > and call functions from DLLs using Win32::API. Is there an equivalent
> > Perl module I can use to call functions from the Linux/Unix
> > environments? Or even better, a single Perl module that will work
> bothe
> > with DLLs in Win32, and .so files in Linux/Unix? This would save me a
> > lot of time.
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 19:51:08 GMT
From: Rowan Blaqflame <blaqflame@hotmail.com>
Subject: Re: Help with headers in IE??
Message-Id: <95pkj5$mji$1@nnrp1.deja.com>
I found I had to first get rid of the attachment; part of the statement
but only if they are running IE5.5. Then you need to change the
content type to "Content-type: application/binary" so that IE has to
download it. This worked only because I was sending a binary XLS
file. I'm not sure what he means by path info.
Don't forget to remove the "attachment;" part.
My Perl code now looks like this...
my $filename ="cgitest.xls";
if ($ENV{'HTTP_USER_AGENT'} =~ "MSIE 5.5") {
print "Content-type: application/binary\n";
print "Content-Disposition: filename=$filename\n\n";
} else {
print "Content-type: application/vnd.ms-excel\n";
print "Content-Disposition: attachment; filename=$filename\n\n";
}
In article <3a7992a3_1@news.pacifier.com>,
Jason Hurst <variant@shell.pacifier.com> wrote:
>
> > IE doesn't have a clue what Mime headers are. You have to
> > learn to trick it with /path info.
>
> whats the '/path' info, i'm not sure i understand... I should point
out
> that i works fine in IE4.0, but not in ie5.5, is this a recent problem
> with ie?
>
> Maggert <perl@imchat.com> wrote:
> > On Thu, 01 Feb 2001 01:01:04 GMT, Jason Hurst
<gorgano@altavista.com>
> > wrote:
>
> >>ok, here is a fun one. I've got these binary files i want to send to
> >>the browser. Now because of sercurity stuff i'm using a perl
script to
> >>read in the file and then send it on it's way. Pretty basic, open
the
> >>file, bindmod it and stdout, then do a read() and simply print out
the
> >>data a little bit at a time. Works fine in netscape, but for some
> >>reason when i'm using IE, it First prompts if i want to save or open
> >>the script file, if you hit open, it then asks if you want to save
or
> >>open the script file AGAIN, hit open, and THEN it asks if you want
to
> >>save the file. Anyone seen anything like this? the headers i'm
using
> >>are like this:
> >>
> >>Content-Disposition: attachment; filename="addbook-1.0.tar.gz"
> >>Content-Type: application/octet-stream
> >>
> >>NOte this also happens on text/plain, but not with text/html..
> >>
> >>any guesses? Thanks for your help!
> >>
>
>
--
He Breaths, Eats, and Takes up Space
http://www.blaqflame.com
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 6 Feb 2001 22:04:48 -0000
From: "Dr. Eldon D. Lehmann" <aida@globalnet.co.uk>
Subject: Re: Help with simple Unix command script to delete some temp files...
Message-Id: <t80tf6d0a0nod9@xo.supernews.co.uk>
Hi Pat,
Thanks for this. Your help / suggestions are much appreciated.
My key problem was that I didn't know about the #!/usr/bin/ksh command, to
generate a Unix script. So thanks for pointing me in the direction of this.
With best wishes,
Dr. Eldon Lehmann
aida@globalnet.co.uk
Pat Smith wrote in message <20010204224641.15257.00000803@ng-ct1.aol.com>...
>Dr Lehmann,
>
> I have never subscribed to a usenet mailgroup before so I may not be up
on
>ettiquette. If ( as your previous message seems to indicate ) you are
running
>on a UNIX based platform, than most likely a simple shell script put into a
>crontab will fit your needs rather nicely.
>
> You will want begin this script thusly...
>
>#!/usr/bin/ksh
>#
># /dirname would equal the exact path to the directory you wished to
operate
>on.
># you may type "man find" at the command line to get a rundown of what the
>rest of this script is doing.
>#
>#
>find /dirname -type f -name "*.dat" -mtime +1 -exec rm -f {} \;
>#
>find /dirname -type f -name "*.gif" -mtime +1 -exec rm -f {} \;
>#
># EOF
>
> If you vi this simple script and simply include it in roots crontab to
run
>once a day (say at 01:00) you should achieve the desired effect. I would
>highly recommend reading the man pages of these various (and very powerful)
>commands.
>
> A very wise man once told me that not only will unix allow a person to
shoot
>themselves in the foot, it will helpfully take three quarters of your leg
as
>well!! Read those man pages!
------------------------------
Date: Tue, 06 Feb 2001 21:47:16 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: How to tell which perl is running?
Message-Id: <t80s74ceqrn742@corp.supernews.com>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "CS" == Chris Stith <mischief@velma.motion.net> writes:
> CS> Calling perl from Perl might not be the most glamourous way to do
> CS> things, but until/unless a variable from within the language returns
> CS> the string that would be returned by the q<-v> option, it may help.
> use Config ;
> all the -v/-V stuff is generated from %Config.
Gee, ya learn something every day. I'll look into that myself if
I ever have this need.
Chris
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Tue, 06 Feb 2001 21:14:11 GMT
From: jenhuebert@my-deja.com
Subject: Image Magick manipulations
Message-Id: <95ppep$rqs$1@nnrp1.deja.com>
Greetings. I'm using Image Magick (PerlMagick), and am having a problem.
Wonder if anyone knows anything about converting an images' colorspace?
I have a batch of tiff files to preform various checks/conversions on.
Here's an idea of what I'm doing:
read file, trim, resize, convert colorspace to cmyk (all ifs), write
file
This produces an image - whether the input is rgb or cmyk - with the
Black channel's color map inverted.
I've resorted to using the command line to churn through many of the
options, and as far as I can tell, performing any conversion on a file,
converting to cmyk, and then saving to tiff has this same result.
convert -colorspace CMYK inrgb.tif outcmyk.tif
OR
convert -colorspace CMYK incmyk.tif outcmyk.tif
--
convert -colorspace CMYK -colors 5000 -treedepth 4 inrgb.tif
outcmyk.tif
--
convert -profile cmykprofile.icm inrgb.tif outcmyk.tif
Any help or suggestions would be appreciated. Does anyone know if
there's any way to access the c,m,y,k channels? I could probably to the
inversion if I had at least that.
Thanks...
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 225
**************************************