[17652] in Perl-Users-Digest
Perl-Users Digest, Issue: 5072 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 9 11:05:29 2000
Date: Sat, 9 Dec 2000 08:05:07 -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: <976377907-v9-i5072@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 9 Dec 2000 Volume: 9 Number: 5072
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: Anything wrong with this code? (Tim Hammerquist)
Re: Anything wrong with this code? (Martien Verbruggen)
Re: Anywhere to put my scripts? <carvdawg@patriot.net>
Re: compiling scripts with Active State perl (Stephen Patterson)
cookie expire <a.v.a@home.nl>
Re: count number of occurrences in string <bart.lateur@skynet.be>
Re: count number of occurrences in string (Daniel Chetlin)
Re: dynamic require & new on variable package <simonmcc@nospam.nortelnetworks.com>
Re: dynamic require & new on variable package <simonmcc@nospam.nortelnetworks.com>
Re: How do you compress an entire file with Compress::Z <abe@ztreet.demon.nl>
Re: kill and security (suid) (M.J.T. Guy)
Re: number vs string <mjcarman@home.com>
Re: number vs string (Garry Williams)
Re: parsing canned response <bart.lateur@skynet.be>
Re: parsing canned response <cburwel1@ic3.ithaca.edu>
Re: PLEASE CHECK MY CODING! (Fryar386)
Re: Protecting my Perl script? <brian+usenet@smithrenaud.com>
Re: Sort Question <abe@ztreet.demon.nl>
Translate pixel colors into hex codes <eager@curious.com>
Re: Uploading file via CGI <g.soper@soundhouse.co.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 09 Dec 2000 11:21:49 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage976361045.13788@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://www.cpan.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
For an alternative way to get answers, check out the Perlfaq website.
http://www.perlfaq.com/
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://www.cpan.org/
http://www.perl.com/CPAN/
http://www.cpan.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 09 Dec 2000 11:05:12 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Anything wrong with this code?
Message-Id: <slrn9344is.3gj.tim@degree.ath.cx>
Fryar386 <fryar386@aol.com> wrote:
> My server keeps giving me errors for this code, all it says is premature end.
> I don't see anything wrong with it, do you?
>
> print &PrintHeader;
> open FILE, ">> /serverfiles/test.txt"
> or die "Error, Please contact Fryar386@aol.com\n";
> flock FILE, 2
> or die "Couldn't acquire an exclusive lock on test.txt: $!\n";
> print FILE <<ENDOFTEXT;
> <P>
> Username: $input{username}
> Password: $input{password}
> E-mail: $input{e-mail}
> Attacks: $input{basic1}
> Main Goal: $input{main_goal}
> Planet: $planet
> AIM: $input{aim}
> Race: $input{race}
> Speed: $speed
> Defence: $defence
> Attack: $attack
> KI: $KI
> Health: $health
> MaxHealth: $maxhealth
> Intellegence: $intellegence
> Peri(money): $peri
> Power Level: $powerlevel
> ENDOFTEXT
> close FILE
> or warn "test.txt didn't close nicely: $!\n";
>
>
> All I know is that the error is in those lines of programming
There may not be an error in your code. Like the other post stated, a
filehandle failing to initialize won't be reported in the browser.
This can be helped by running the script from the command line to make
sure you see all the errors.
--
-Tim Hammerquist <timmy@cpan.org>
Big egos are big shields for lots of empty space.
-- Diana Black
------------------------------
Date: Sat, 9 Dec 2000 22:11:06 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Anything wrong with this code?
Message-Id: <slrn9344qa.20m.mgjv@martien.heliotrope.home>
On 09 Dec 2000 04:25:30 GMT,
Fryar386 <fryar386@aol.com> wrote:
> My server keeps giving me errors for this code, all it says is premature end.
> I don't see anything wrong with it, do you?
Yes. And so does Perl. Have you ever heard of the Perl FAQ? It has 9
sections, and the ninth section starts with a few questions that you
should read.
You should use the CGI.pm module.
You should use -w.
You should use strict.
But above all: You should always run your scripts from the command line
_before_ trying to run them in a web server.
> print &PrintHeader;
> open FILE, ">> /serverfiles/test.txt"
> or die "Error, Please contact Fryar386@aol.com\n";
This makes me think that your web server log probably contains a few
lines that say something like:
In string, @%s now must be written as \@%s
I copied that from the perldiag documentation.
Maybe you should have a look at the documentation. The FAQ is also
installed in the same place Perl is installed. On a unix system,
# man perl
will get you started reading. On Macs use Shuck. On Win32 and others,
use perldoc.
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Sat, 09 Dec 2000 08:36:31 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Anywhere to put my scripts?
Message-Id: <3A32355F.11933CB7@patriot.net>
duh
Richard Zilavec wrote:
> On Fri, 08 Dec 2000 17:38:26 -0500, H C <carvdawg@patriot.net> wrote:
>
> >yourscripts | /dev/null ?
> >
> Data written on a null or zero special file is discarded.
>
> ./program.pl > /tmp/gooddata.txt 2> /dev/null
>
> Just don't fill it all the way up!
>
> --
> Richard Zilavec
> rzilavec@tcn.net
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Sat, 09 Dec 2000 14:17:27 GMT
From: spam@s.patterson.freeuk.com (Stephen Patterson)
Subject: Re: compiling scripts with Active State perl
Message-Id: <X9rY5.29639$eT4.2388392@nnrp3.clara.net>
In article <slrn932eb8.1v7.tim@degree.ath.cx>, Tim Hammerquist wrote:
>Stephen Patterson <spam@s.patterson.freeuk.com> wrote:
>> I need to compile a perl script on windows 95, which compiler would you
>> recommend (free/GPL only please).
>
>I'd just like to wish you luck in finding a free/GPL Perl compiler on the
>Win32 platform. All the solutions I've heard about involve changing
>either your price range or your platform.
Which solutions would these be then?
>
>--
>-Tim Hammerquist <timmy@cpan.org>
>I respectfully decline the invitation
>to join your hallucination.
> -- Dilbert
--
To craunch a marmoset.
-- Pedro Carolino, "English as She is Spoke"
-- -- -- -- -- -- -- -- -- --
Stephen Patterson s.patterson@SPAMOFFfreeuk.com (Remove SPAMOFF to reply)
------------------------------
Date: Sat, 09 Dec 2000 15:02:25 GMT
From: AvA <a.v.a@home.nl>
Subject: cookie expire
Message-Id: <3A324AAA.2BB76F93@home.nl>
does anyone know how i can set the cookie expire date to 4 hours after
its created?
i tried : expires=(time + 14400) , but that doesnt work.
thanks
------------------------------
Date: Sat, 09 Dec 2000 11:20:29 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: count number of occurrences in string
Message-Id: <18543t8vdqvmjiqcqfkm80qt354vqunk7p@4ax.com>
Linc Madison wrote:
>tr/SEARCHLIST/REPLACEMENTLIST/cds
>If the REPLACEMENTLIST is null, the SEARCHLIST is replicated.
>
>In other words, tr/@// and tr/@/@/ do exactly the same thing.
Well, actually, they shouldn't. Only their effect should be the same.
tr/@/@/ tries to alter the string, only to replace everything by itself,
and complains if the string is read-only. tr/@// should not. I don't
know if this has been fixed, but in pretty recent Perl versions, this
still complains.
--
Bart.
------------------------------
Date: 9 Dec 2000 12:40:10 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: count number of occurrences in string
Message-Id: <90t97a02mde@news2.newsguy.com>
On Sat, 09 Dec 2000 11:20:29 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Linc Madison wrote:
>
>>tr/SEARCHLIST/REPLACEMENTLIST/cds
>>If the REPLACEMENTLIST is null, the SEARCHLIST is replicated.
>>
>>In other words, tr/@// and tr/@/@/ do exactly the same thing.
>
>Well, actually, they shouldn't. Only their effect should be the same.
>tr/@/@/ tries to alter the string, only to replace everything by itself,
>and complains if the string is read-only. tr/@// should not. I don't
>know if this has been fixed, but in pretty recent Perl versions, this
>still complains.
Mike Guy fixed this on 31 Jul 2000. It's in 5.7.0 and has already been
integrated into the 5.6.1 track (which is not yet out).
For your reference: (watch the long line)
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-07/msg01023.html
-dlc
------------------------------
Date: Sat, 9 Dec 2000 11:06:21 -0800
From: "simonmcc" <simonmcc@nospam.nortelnetworks.com>
Subject: Re: dynamic require & new on variable package
Message-Id: <90t3ms$h3g$1@bcrkh13.ca.nortel.com>
Thanks for the insight into eval, makes sense (probably should have figured
it out myself if it wasnt 11:30 pm;)
And yes I have since discovered the abstract factory, and the factory method
pattern, which also suggest that what i am doing is ok
Regards
simon.
------------------------------
Date: Sat, 9 Dec 2000 11:09:31 -0800
From: "simonmcc" <simonmcc@nospam.nortelnetworks.com>
Subject: Re: dynamic require & new on variable package
Message-Id: <90t3tl$h8l$1@bcrkh13.ca.nortel.com>
>
> This seems to be workiing for me
>
> $a = "Net::FTP";
> eval "use $a;";
> $x = $a->new('ftp.uu.net');
> print "$x\n";
>
>
> I don't see anything wrong with using something like this. It
> looks a like a Perl implementation of the abstract factory pattern.
> I suppose that the "eval police" might point out that you might
> not want to take a class name from user input in some cases.
>
> Good Luck
> chris
this also works for me, i had not thought of trying the new() outside the
eval, thanks
simon.
------------------------------
Date: Sat, 09 Dec 2000 13:06:00 +0100
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: How do you compress an entire file with Compress::Zlib
Message-Id: <kg743tsdb1nqighv8dk6o8cepfpqgl5boe@4ax.com>
On Sat, 02 Dec 2000 05:24:03 GMT, mark_ingalls@my-deja.com wrote:
> i'm trying to replace a batch file on a windows
> nt system that is calling gzip.exe to compress
> iis log files for transferring to another machine
> with a perl script that does all of the work
> internally.
...
> the files i'm compressing are ~200 MB in size and
> i would think passing in a file handle or file
> name would be more efficient than reading the
> file line by line, compressing each line, then
> writing that line back to the compressed file.
>
> i've tried using deflate and compress functions,
> but cannot get either to work correctly. the
> compressed files need to be readable by WinZip as
> that is the program that my customers will be
> using. i can continue to launch gzip.exe from
> the perl script, but i'd like to remove that
> dependency if possible.
Look at Archive::Zip
http://search.cpan.org/search?module=Archive::Zip
--
Good luck,
Abe
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'
------------------------------
Date: 9 Dec 2000 14:23:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: kill and security (suid)
Message-Id: <90tf9e$6tg$1@pegasus.csx.cam.ac.uk>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
>Hmm... the specification of kill() has indeed changed from "kill LIST"
>to "kill SIGNAL, LIST". However,
>
> perl -e '$SIG{ TERM} = sub {print "TERM\n"}; kill $$'
>
>prints nothing. (This is also a Linux system.)
Nope. The specification of Perl's kill() hasn't changed at all. It's
just that the wording has been clarified.
Perl 4 says
kill LIST
Sends a signal to a list of processes. The first
element of the list must be the signal to send.
Returns the number of processes successfully sig-
naled.
whereas bleadperl says
kill SIGNAL, LIST
Sends a signal to a list of processes. Returns the
number of processes successfully signaled ...
The first argument to kill() is and always has been a signal name or number.
Mike Guy
------------------------------
Date: Fri, 08 Dec 2000 09:40:28 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: number vs string
Message-Id: <3A3100EC.3690A3D1@home.com>
"Daniel W. Burke" wrote:
>
> What is the best, most warning-free method of testing if a scalar
> is a number or a string?
Usually, you can just use it however you want and let Perl do the rest,
but I agree that this is a situation where you really want to know.
> I have a situation where I'm pulling data from a database, and
> based on some conditions, the field I need to compair could be
> a number or a string. I don't appear to have a way of knowing
> ahead of time what kind of value it is, so compairsons I do
> like this give warnings on character fields:
>
> if (length($var) == 0 || ($var < 1)
>
> Is there a way ahead of time to check that... like,
I'd use a regex:
if ($var =~ /^\d+$/) {
print "Value is purely numeric\n";
}
or
if ($var =~ /\D/) {
print "Value contains non-numerics\n";
}
-mjc
------------------------------
Date: Sat, 09 Dec 2000 14:51:45 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: number vs string
Message-Id: <5GrY5.208$uF3.18883@eagle.america.net>
On Fri, 08 Dec 2000 09:40:28 -0600, Michael Carman <mjcarman@home.com> wrote:
>"Daniel W. Burke" wrote:
>>
>> What is the best, most warning-free method of testing if a scalar
>> is a number or a string?
>
>Usually, you can just use it however you want and let Perl do the rest,
>but I agree that this is a situation where you really want to know.
>
>I'd use a regex:
>
>if ($var =~ /^\d+$/) {
> print "Value is purely numeric\n";
>}
Why answer a FAQ incorrectly?
See the perlfaq4 manual page, "How do I determine whether a scalar is
a number/whole/integer/float?"
--
Garry Williams
------------------------------
Date: Sat, 09 Dec 2000 11:15:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: parsing canned response
Message-Id: <rd443tos5pob05rbfm1g3m0gjf7dpmppk1@4ax.com>
Mike Gardner wrote:
>I have a form that posts data to a server. It returns with a canned
>response. (I grab the page with LWP.) Amongst the garbage spit back are
>multiple instances of Content-Type and Content-Length. The idea is to
>separate that data from the rest and save those variables.
HTTP headers are very much like e-mail headers. Er... guess what: HTTP
headers ARE e-mail headers. So treat them as such. Randal once wrote a
very clever way of stuffing e-mail headers into a hash. I'd do that, and
get out the hash entries you're interested in. Only, I can only vaguely
remember how it went. I bet it's in the standard documentation
somewhere.
E-mail headers may contain CRLF pairs. Simplest is to drop the returns,
and keep the newlines:
tr/\r//d;
Secondly, an e-mail header may be wrapped. In that case, the continued
line starts with whitespace (space/tab). So get rid of those.
s/\n[ \t]+/ /g;
And finally: split on newlines, and then on colons (plus whitespace).
This is what I can make of what I remember of Randal's code:
%header = map { split /: */, $_, 2 } split /\n/;
To be on the safe side, the headers (hash keys) should have been turned
into consistent case. Titlecase (every word uppercased) is the common
thing.
%header = map { my($key, $value) = split /: */, $_, 2;
$key =~ s/(\w+)/\u\L/g; ($key, $value) } split /\n/;
A simple lc($key) or uc($key) would have worked just as well, really.
--
Bart.
------------------------------
Date: Sat, 09 Dec 2000 15:26:52 GMT
From: cheryl burwell <cburwel1@ic3.ithaca.edu>
Subject: Re: parsing canned response
Message-Id: <3A3250D4.78F9942C@ic3.ithaca.edu>
All of this data returned back (canned response garbage, content-type and
content-length data) ends up in the browser body. Does this make a
difference to the approach?
Thanks again,
Mike Gardner
mike@a2zcables.com
http://www.a2zcables.com
Bart Lateur wrote:
> Mike Gardner wrote:
>
> >I have a form that posts data to a server. It returns with a canned
> >response. (I grab the page with LWP.) Amongst the garbage spit back are
> >multiple instances of Content-Type and Content-Length. The idea is to
> >separate that data from the rest and save those variables.
>
> HTTP headers are very much like e-mail headers. Er... guess what: HTTP
> headers ARE e-mail headers. So treat them as such. Randal once wrote a
> very clever way of stuffing e-mail headers into a hash. I'd do that, and
> get out the hash entries you're interested in. Only, I can only vaguely
> remember how it went. I bet it's in the standard documentation
> somewhere.
>
> E-mail headers may contain CRLF pairs. Simplest is to drop the returns,
> and keep the newlines:
>
> tr/\r//d;
>
> Secondly, an e-mail header may be wrapped. In that case, the continued
> line starts with whitespace (space/tab). So get rid of those.
>
> s/\n[ \t]+/ /g;
>
> And finally: split on newlines, and then on colons (plus whitespace).
> This is what I can make of what I remember of Randal's code:
>
> %header = map { split /: */, $_, 2 } split /\n/;
>
> To be on the safe side, the headers (hash keys) should have been turned
> into consistent case. Titlecase (every word uppercased) is the common
> thing.
>
> %header = map { my($key, $value) = split /: */, $_, 2;
> $key =~ s/(\w+)/\u\L/g; ($key, $value) } split /\n/;
>
> A simple lc($key) or uc($key) would have worked just as well, really.
>
> --
> Bart.
------------------------------
Date: 09 Dec 2000 14:33:39 GMT
From: fryar386@aol.com (Fryar386)
Subject: Re: PLEASE CHECK MY CODING!
Message-Id: <20001209093339.23191.00003791@ng-fv1.aol.com>
>So on your page, do you get to choose a character to play as? Will you
>be implementing Sensu beans at all? Do you get to talk trash to the
>other player? That's half the fun of the show. ;)
Yep, all that and more 8-P
------------------------------
Date: Sat, 09 Dec 2000 08:27:35 -0500
From: brian d foy <brian+usenet@smithrenaud.com>
Subject: Re: Protecting my Perl script?
Message-Id: <brian+usenet-243716.08273509122000@news.panix.com>
In article <kyjX5.646$n3.8984@news.globetrotter.net>, "Neb"
<berube@odyssee.net> wrote:
> So, beside executables, is there an other way to be able to run the script,
> but with some encryption of the source code?
it's trivial to deparse Perl, so there's no point in even trying to
hide the source code.
--
brian d foy
Perl Mongers <URL:http://www.perl.org>
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Sat, 09 Dec 2000 12:54:55 +0100
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Sort Question
Message-Id: <mm543t86li60v9kge4ggth8s3mu9fkte10@4ax.com>
On Sat, 02 Dec 2000 02:25:50 GMT, Ned <ned911@home.com> wrote:
> I am trying to do a descending sort of a flat (text) file. The sort
> below should act on the second field in the file (date) and was working
> until today when 12-1-2000 was entered into the file. It appears the
> that the sort is working on the second character in the second field
> therefore putting 12-1-200 at the bottom of the list. The problem is
> probably within the ($item) line but I can't find any documention in the
> Perl Man/Faq docs to tell what that is doing. Any help would be
> appreciated.
If "12-1-2000" is the date format, you should change it to a sortable
format, like CCYYMMDD: 20001201.
> @idx = ();
> for (@file) {
> ($item) = /\d+\s*(\S+)/;
I'd use split() to get the second field.
my $item = (split)[1];
and then maybe use split() again to get the individual date parts and
change the format:
$item = sprintf '%04d%02d%02d', (split /-/, $item)[2, 0, 1];
> push @idx, uc($item);
^^
Why would you uc() numbers?
> }
> @file = @file [sort{$idx[$b] cmp $idx[$a]}0..$#idx];
You could also write it as a GRT (leave out the @idx):
my @sorted = map substr($_, 8) => sort
map { sprintf('%04d%02d%02d',
((split)[1] =~ /(\d+)/g)[2, 0, 1]) ^
"\xFF" x 8 . $_
} @file;
perldoc -q sort
perldoc -f sort
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html
http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html
--
Good luck,
Abe
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'
------------------------------
Date: Sat, 9 Dec 2000 16:03:47 +0100
From: "Niek" <eager@curious.com>
Subject: Translate pixel colors into hex codes
Message-Id: <OnWsuFfYAHA.305@net025s>
Hi people,
Let me start off by saying:
This is a cross posting that has relevance to all of the groups posted to,
to some extend. Hope you don't mind the less relevant bit.
I have no acceptable technical knowledge of image processing or image
compression techniques. I do for instance know that jpeg compression is
lossy, and that it is best used for compressing fotograph type images, etc.,
etc. Compression algorythms and that sort of stuff however is not my thing
(yet ;-).
My end goal is to process images (bitmaps, jpegs or gif), preferably in
Perl, to get the hexadecimal representation off each and every pixels color
of that particular image. I can imagine that this would be easier for bitmap
images, then for compressed images, since the bitmap doesn't need to be
uncompressed first, right? My questions are:
- Does anyone know of any existing algorythms, modules, etc. that can do
this already, and can also be ported to Perl without to much hastle, or even
exist in Perl already?
If not:
- Could anyone give an estimate of the complexity of reaching this endgoal
for an average programmer with my degree of knowledge about image
processing?
For instance:
- Is reading and parsing a bitmap as easy as I would imagine, i.e. read in
information about every pixel and convert it to a hex code?
Thanx a great deal!!
Niek
------------------------------
Date: Sat, 09 Dec 2000 11:43:26 +0000 (GMT)
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Re: Uploading file via CGI
Message-Id: <4a2a2be8c4g.soper@soundhouse.co.uk>
In article <slrn9343q6.3l5.efflandt@efflandt.xnet.com>, David Efflandt
<efflandt@xnet.com> wrote:
> If you define an 'upload' function in your 'use CGI ..." statement then
> upload('upload_1') would be a custom function translated to the string
> "<upload>upload_1</upload>" which when printed to your browser is
> probably an unknown tag and therefore hidden. As far as I know, all
> field values including uploaded file name and handle are passed as
> param('fieldname').
I'm very probably wrong but that seems to conflict with the documentation
of CGI.pm from which I got the following:
Start quote - - -
To be safe, use the upload() function (new in version 2.47). When called
with the name of an upload field, upload() returns a filehandle, or undef
if the parameter is not a valid filehandle.
$fh = $query->upload('uploaded_file');
while (<$fh>) {
print;
}
This is the recommended idiom.
End quote - - -
And I was using the code:
use CGI qw(:standard upload);
$fh = upload('upload_1');
while (<$fh>) {
print;
}
Does that help?
Thanks for your ongoing help!
--
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/
------------------------------
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 V9 Issue 5072
**************************************