[17315] in Perl-Users-Digest
Perl-Users Digest, Issue: 4737 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 21:05:32 2000
Date: Thu, 26 Oct 2000 18:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972608711-v9-i4737@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 26 Oct 2000 Volume: 9 Number: 4737
Today's topics:
2001 USENIX Annual Technical Conference - Announcement <andrea+nospam@usenix.org>
Re: 5.6 make test fails on solaris 8 tltt@my-deja.com
Re: add a line once only <nospam@david-steuber.com>
Re: add a line once only (Martien Verbruggen)
Re: bidirectional communication <juex@deja.com>
Re: bidirectional communication (Martien Verbruggen)
Re: concatenation txt files in one file <fe8x025@public.uni-hamburg.de>
Re: concatenation txt files in one file <jeff@vpservices.com>
Re: get the second line out of a file ?????? <jeff@yoak.com>
giving , another name, like "and" for && (was: renaming <ren.maddox@tivoli.com>
Re: help with GD (Martien Verbruggen)
Re: Hey guys... can you lend an ear? <godzilla@stomp.stomp.tokyo>
Re: How can I word wrap on STDOUT? (Chris Fedde)
Re: How can I word wrap on STDOUT? <lr@hpl.hp.com>
Re: How to output to printer <elephant@squirrelgroup.com>
Re: How to output to printer <lr@hpl.hp.com>
Re: jpeg image manipulation (Martien Verbruggen)
Re: jpeg image manipulation (Martien Verbruggen)
Re: Legal email addresses... (Al)
Re: Linux: Perl readline... <fe8x025@public.uni-hamburg.de>
LWP remote file size <me@privacy.net>
Open URL as file <jeano@my-deja.com>
Re: perl not resolving dns in a cgi script <lr@hpl.hp.com>
Re: Perl on NT <fe8x025@public.uni-hamburg.de>
Re: Problemi con Perl !! <lr@hpl.hp.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Oct 2000 17:26:32 -0700
From: Andrea Galleni <andrea+nospam@usenix.org>
Subject: 2001 USENIX Annual Technical Conference - Announcement and Call For Papers
Message-Id: <andrea+nospam-023191.17263226102000@reader.news.uu.net>
Keywords: USENIX, FREENIX, technical conference,
research, unix, Linux, Windows NT, Open Source, Tutorials, training,
Invited talks, Refereed Papers, Distributed caching, Embedded systems,
Extensible operating, storage, kernel, BSD, resource management,
virtual memory, Personal digital assistants, device driver, Security
privacy, Ubiquitous messaging, remote access, Web technologies,
network administration, Java, Perl, scalability, Programming tools,
Portability, Client-server design development, Sendmail, DNS, GUI
builders, CGI, Freely distributable software, Operating system design,
Robotics and automation, High-speed networking, Windows NT,
e-commerce, electronic commerce, CORBA, Tck/tk, Intranet, Extranet,
0bject oriented, POSIX, ActiveX, software, hardware, Apache, GNOME,
Samba, FreeBSD, GNU, design, development
Call for Papers
========================================================================
2001 USENIX Annual Technical Conference Announcement and Call for
Papers June 25-30, 2001 Marriot Copley Place Hotel Boston,
Massachusetts USA http://www.usenix.org/events/usenix01
Sponsored by USENIX, the Advanced Computing Systems Association
Best Paper Awards Awards will be given for the best paper and best
student paper within the Refereed Paper Submissions.
1) Important Dates
=====================================================================
FREENIX Refereed Track: November 27, 2000 General Session Refereed
Track: December 1, 2000 Notification to authors: January 31, 2001
Camera-ready papers due: May 1, 2001
=====================================================================
Program Chair: Yoonho Park, IBM Research
2) Overview
=====================================================================
USENIX is the Advanced Computing Systems Association. For over 25
years, its members have come from a broad community of developers,
researchers, system administrators and engineers with interests
spanning the full range of technology. As the core conference of this
community, the USENIX Annual Technical Conference is the premier forum
for computing professionals to share the results of their latest and
best work, develop new ideas and solutions, and connect with their
colleagues.
Three days of tutorials start the conference with practical tutorials
on timely topics. The three-day technical session of the conference
follows and includes a track of General Session Refereed Papers
selected by the Program Committee; a track of Invited Talks by experts
and leaders in the field; and FREENIX, a track of refereed papers on
freely available POSIX-based software and systems.
3) Topics
======================================================================
Topics of interest include, but are not limited to: * Cluster
computing * Complexity management * Distributed caching and
replication * Extensible operating systems * File systems and storage
systems * Interoperability of heterogeneous systems * Mobile code *
Networking and network services * Multimedia * Pervasive computing *
Reliability and QoS * Security and privacy * Web technologies
====================================================================
USENIX Conference Office
2560 9th Street, Suite 215
Berkeley, CA 94710
USA Phone 510-528-8649;
Fax 510-548-5738 email: conference@usenix.org
------------------------------
Date: Fri, 27 Oct 2000 00:11:17 GMT
From: tltt@my-deja.com
Subject: Re: 5.6 make test fails on solaris 8
Message-Id: <8tah70$e14$1@nnrp1.deja.com>
Unless someone else can help you fix this (I can't...) you can always
download and install the precompiled package from:
http://www.sunfreeware.com/programlistsparc8.html#perl
(or a mirror listed at: http://www.sunfreeware.com/ftp.html)
They also have some notes on how they compiled it.
hth,
tltt
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 22:55:39 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: add a line once only
Message-Id: <m37l6vyzyw.fsf@solo.david-steuber.com>
tchrist@perl.com (Tom Christiansen) writes:
' perl -i.orig -pe '?tub_54? && s//added line here/' inputfile
Whoa! Apart from perlrun, what other docs do I need to understand
this sucker?
--
David Steuber | Perl apprentice. The axe did not stop the
NRA Member | mops and buckets from flooding my home.
ICQ# 91465842
*** http://www.david-steuber.com/ ***
------------------------------
Date: Thu, 26 Oct 2000 23:09:23 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: add a line once only
Message-Id: <slrn8vhed0.ksa.mgjv@verbruggen.comdyn.com.au>
On Thu, 26 Oct 2000 22:55:39 GMT,
David Steuber <nospam@david-steuber.com> wrote:
> tchrist@perl.com (Tom Christiansen) writes:
>
> ' perl -i.orig -pe '?tub_54? && s//added line here/' inputfile
>
> Whoa! Apart from perlrun, what other docs do I need to understand
> this sucker?
Not much. See perlop for ?PATTERN? (similar to /PATTERN? but with
slightly different behaviour). The same document will give you s///
and &&, but I suspect you already understood those.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd. | later I can ask him what he meant -
NSW, Australia | Steven Wright
------------------------------
Date: Thu, 26 Oct 2000 15:54:15 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: bidirectional communication
Message-Id: <39f8b61c@news.microsoft.com>
"AndreasKleiner" <AndreasKleiner@compuserve.de> wrote in message
news:39F7F99C.4D1F347F@compuserve.de...
> I have a C-program which takes multi-line input and produces multi-line
> output. I have to run it in the background - as it compiles some info
> into the memory which takes some seconds - and now and then feed it with
> input and read and interpret the output - with some perl-skript of
> course.
>
> Under which headwords do I have to look for a solution:
Falls auch eine nicht-Perl-Loesung in Frage kommt dann sieh dir mal "expect"
an, das macht genau das bereits (tut mir leid, URL habe ich momentan nicht
zur Hand).
Uebrigens: in DE.clpm kannst du ruhig auf Deutsch posten
jue
------------------------------
Date: Thu, 26 Oct 2000 23:10:53 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: bidirectional communication
Message-Id: <slrn8vhefq.ksa.mgjv@verbruggen.comdyn.com.au>
On Thu, 26 Oct 2000 15:54:15 -0700,
Jürgen Exner <juex@deja.com> wrote:
> "AndreasKleiner" <AndreasKleiner@compuserve.de> wrote in message
> news:39F7F99C.4D1F347F@compuserve.de...
> > I have a C-program which takes multi-line input and produces multi-line
> > output. I have to run it in the background - as it compiles some info
> > into the memory which takes some seconds - and now and then feed it with
> > input and read and interpret the output - with some perl-skript of
> > course.
> >
> > Under which headwords do I have to look for a solution:
>
> Falls auch eine nicht-Perl-Loesung in Frage kommt dann sieh dir mal "expect"
> an, das macht genau das bereits (tut mir leid, URL habe ich momentan nicht
> zur Hand).
And, in case you want to use Perl anyway: Expect.pm is available from
CPAN :)
> Uebrigens: in DE.clpm kannst du ruhig auf Deutsch posten
There was a crosspost to other, non-german, groups. English was more
appropriate.
Martien
--
Martien Verbruggen |
Interactive Media Division | The four horsemen of the apocalypse
Commercial Dynamics Pty. Ltd. | are called Abort, Retry, Ignore and
NSW, Australia | Fail.
------------------------------
Date: Fri, 27 Oct 2000 00:48:51 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: concatenation txt files in one file
Message-Id: <jccat8.r11.ln@sokrates2.hagenbeck.uni-hamburg.de>
Jeff Zucker <jeff@vpservices.com> wrote:
Hello again...
I have another problem. I actually did ask for Perl under
NT because of it...
So regarding your advice of cygwin - I ask myself if I would be able
then to write a unix-like api on a NT workstation (with cygwin). (of
course I'm able... I should better say - can I -)
So what exactly is the way to reach that goal ? Do I have to compile
the source again on a NT system ? (slightly modificated I guess) ..and
just run it ? Or what's the deal exactly ?
Alex
> Why don't you go to http://www.cygwin.com/ and get a copy of "cat" (and
> many other common Unix utilities) that can run on windoze. You don't
> need to install the bash environment to use cat and the rest, you can
> use them straight from a DOS console.
> --
> Jeff
------------------------------
Date: Thu, 26 Oct 2000 16:36:48 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: concatenation txt files in one file
Message-Id: <39F8C010.4969544A@vpservices.com>
Alex Fitterling wrote:
>
> So regarding your advice of cygwin - I ask myself if I would be able
> then to write a unix-like api on a NT workstation (with cygwin). (of
> course I'm able... I should better say - can I -)
>
> So what exactly is the way to reach that goal ? Do I have to compile
> the source again on a NT system ? (slightly modificated I guess) ..and
> just run it ? Or what's the deal exactly ?
I am not sure whether you are asking about Perl or about cygwin so I'll
try to answer both. For Perl, scripts are just text files so they do
not need to be recompiled for different OSs. Most things in Perl work
the same on Win and on Unix so, for example, I write and test all my
scripts on my win box, then ftp them to Unix servers, do a chmod on
them, and they run without any changes. That is using plain DOS, not
cygwin bash or anything else.
For cygwin, there are two ways to go. One is if you just need some of
the utilities like cat, ls, cp, mv, more, diff, sort, and others. You
can just use those on a win box in DOS so that when your brain forgets
which OS you are on, you can still work -- for example you see a list of
files regardless of whether you type "dir" or "ls". OR you can install
cygwin bash and run a unix-like environment on the windows box. I
haven't ever really had the need to do that so I've only tried a few
things with it but I've heard from others it can be very good.
Personally, I think Perl is the way to go because then you can write
truly cross-platform scripts that will run on windoze or unix or lots of
other places and not have to worry about platform specifics. (well, not
too much worrying, there are some gotchas, but mostly well documented)
--
Jeff
------------------------------
Date: Thu, 26 Oct 2000 15:09:04 +0700
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: get the second line out of a file ??????
Message-Id: <8taa2q01vp7@news2.newsguy.com>
[posted and emailed]
In article <39f88e92.14943903@news.one.net.au>, "Christopher James"
<chris@hitsquad.com> wrote:
> Hi all , How do you get the second line out of a file using $_ by NOT
> using a loop ????
>
> I want to throw the first line into an array , split this array in to
> fields... then grab the second line and put that into another array..
> and split this one into fields as well then i want to compare certain
> fields....
If you are saying you want to use $_ explicitly for some reason, you
could do something like this:
$_ = <FILE>;
my @arr1 = split /something/;
$_ = <FILE>;
my @arr2 = split /something/;
But that's a little clumsy. It would be a little more natural to do
something like:
my @arr1 = split /something/,<FILE>;
my @arr2 = split /something, <FILE>;
Hope this helps!
Cheers,
Jeff
------------------------------
Date: 26 Oct 2000 10:46:18 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: giving , another name, like "and" for && (was: renaming local())
Message-Id: <m3og07zjud.fsf_-_@dhcp11-177.support.tivoli.com>
While reading through the thread on a list assignment in a scalar
context, particularly the part about the comma operator being the list
generator and not the parenthesis, I had a thought.
In scalar context, the comma operator is really a lot like a boolean
operator that simply doesn't care about the result of its operands.
Because of this, it never short-circuits, which is why it is
occasionally used for flow control:
handle_error($error), exit if defined $error;
(where you don't want to rely on the return value of handle_error()
being true (or false), so you cannot use "and" (or "or").
The trouble is that if you leave have a list operator and you leave
out the parens, you don't get what you want, as in this common error:
print "Error: $error\n", exit if defined $error; # BUG!
(Of course, you could probably get away with "and" here...)
So it occurred to me that perhaps a word version of the comma operator
could have precedence lower than list operators. The first thing that
came to mind was "then", which may be problematic because of its use
in other languages. But I'll use it for this discussion at least.
So, it is just a comma operator with precedence lower than list
operators. I haven't considered how its precedence should compare to
the other boolean word operators.
With this, you get:
print "Error: $error\n" then exit if defined $error; # Bug fixed!
Yeah!
At first, I thought this was going to help another situation where the
precedence of the comma operator is annoying, but unfortunately it
just makes it break in the opposite way. That is:
print map "VALUE: $_, ", @array then "\n";
The "then" protects "\n" from "map", but unfortunately, it protects it
>From "print" as well... :(
Still, it can help in other situations:
@array = (grep /\d/, @values then map lc, @others);
So, what does everyone think? To frivolous? To confusing? Perhaps
there is some additional semantic that would be useful in a list
context?
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 26 Oct 2000 22:46:58 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: help with GD
Message-Id: <slrn8vhd2v.ksa.mgjv@verbruggen.comdyn.com.au>
On Thu, 26 Oct 2000 22:04:19 GMT,
EM <me@privacy.net> wrote:
> i was making a counter server script but ran into problems
> the code i have for a gif image doesnt work on the latest version of GD
> because they removed gif support
> so i coverted all the gifs to jpeg but i cannot get it to work
> i either get a 500 error or i get a bad image icon (a small box with an X in
> the corner)
You do not do enough error checking in your program. The error
checking that you do isn't informative enough.
no use strict.
no use warnings.
> $count = "111";
> $dtype = "1";
>
> use GD;
> print "Pragma: no-cache\n";
> print "Content-type: image/jpeg\n\n";
> $imy = 20;
> $imx = 15;
> $startx = 0;
> $endx = 14;
> $dig = length($count);
> $digs = $dig - 1;
> @numbers = split(//, $count);
> $imx = $imx + $digs * 15;
That's a lot of variables for this relatively simple task.
> $im = new GD::Image($imx,$imy);
Check that the GD::Image->new() succeeds.
> for ($i = 0; $i <= $digs; ++$i) {
> $each_digit = @numbers[$i];
> open (TILE,"./digits/1/$each_digit.jpg") || die;
Fix the die after the open to include more information.
> $tile = newFromJpeg GD::Image(TILE);
But most importantly: heck that the GD::Image->newFromJpeg() succeeds.
maybe you didn't compile in JPEG support?
> close TILE;
> $im->setTile($tile);
> $startx = $startx + 15;
> $endx = $endx + 15;
Why are you keeping track of these numbers?
> }
> binmode STDOUT;
You should binmode STDOUT _before_ you do any I/O on it. That means
before the first print.
> print $im->jpeg;
> exit;
You might want to run this from a command line, or use CGI::Carp while
debugging, so that you can see what, if anything, goes wrong. But do
try this from a command line. make sure it works outside the CGI
environment first. Then move it to your web server.
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Thu, 26 Oct 2000 16:42:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Hey guys... can you lend an ear?
Message-Id: <39F8C169.8B6C138A@stomp.stomp.tokyo>
Logan Shaw wrote:
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> > webbgroup wrote:
> >> I am writing a script that is querying a series of routers.
> >> When I execute the snmp command alone I get output, but when
> >> I execute the script, nothing appears on the screen.
> >A blank screen is a fairly decent hint your script
> >is not printing. Could it be something is wrong
> >with your print commands?
> A blank screen is a fairly decent hint your script
> is not scripting. Could it be something is wrong
> with your script?
> My answer is better: it's more general, and yet it's
> still just as helpful.
Taking into consideration you are a beginner at
Perl programming, I will overlook your serious
logic flaw.
Godzilla!
------------------------------
Date: Thu, 26 Oct 2000 23:07:37 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <ZO2K5.176$7rc.170585600@news.frii.net>
In article <39f86ff2@cs.colorado.edu>, Tom Christiansen
<tchrist@perl.com> wrote:
>
>And the visual appeal of a convenient WYSIWIG layout is not to be
>easily discarded, either.
>
One thing that has always bugged me about formats is that there is
no obvious way to format text into a scalar or an array. Maybe it is
just my lack of creativity but if there is a way without tying a
file handle or other 'wrapperization' I've missed it. I guess
that's why when things get a bit beyond the scope of an awk style
reporting program I tend to jump to Text::Wrap and it's ilk. It's
not as pretty but it is a lot more general.
chris
--
This space intentionally left blank
------------------------------
Date: Thu, 26 Oct 2000 16:48:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <MPG.1462629cd20b079098ae74@nntp.hpl.hp.com>
In article <81u29zmpq6.fsf@wgate.com> on 26 Oct 2000 14:17:37 -0400,
Doug Perham <dperham@dperham.eng.tvol.net> says...
>
> "Eric" <eric.kort@vai.org> writes:
>
> > I have a Perl program that reads a BibTex bibliography and returns the
> > abstracts and reference keys matching search criteria I specify at the
> > prompt. However, when it prints the abstract(s) to the screen, I wish it
> > would word wrap rather than just wrap at the terminal boundary (makes it a
> > little distracting to read).
> >
> > I could split the abstract into words and print the abstract to stdout word
> > by word, keeping track of the line length as I go. But is their a less
> > labor intensive way?
> >
> > Thanks,
> > Eric
> >
> >
> >
>
>
> # -- this function wraps its argument (in place!)
> # -- the line wrap occurs at 79 characters or at any
> # -- embedded newline
> sub wrap {
> return $_[0] =~ s/([^\n]{0,79})\s/$1\n/g;
> }
1. Why do you use 'return' when you really aren't returning anything
useful?
2. '[^\n]' is a longwinded way of writing '.' (as there is no /s
modifier).
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Oct 2000 09:37:25 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: How to output to printer
Message-Id: <MPG.14636b3e144cef2498985d@localhost>
ra jones wrote ..
>I want to be able to send reports generated by a Perl script to a
>printer. One way to do this would be to get the script to write to a
>temporary file, then print it. Is there a system command or alternative
>way to output a file's contents to printer rather than screen?
this is system dependant .. but usually for Windows the following will
work
open OUTPUT, 'LPT1:' or die "Bad open: $!";
print OUTPUT "What you want printed\n";
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 26 Oct 2000 17:06:17 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to output to printer
Message-Id: <MPG.146266d87e05b77e98ae75@nntp.hpl.hp.com>
In article <MPG.14636b3e144cef2498985d@localhost> on Fri, 27 Oct 2000
09:37:25 +1000, jason <elephant@squirrelgroup.com> says...
> ra jones wrote ..
> >I want to be able to send reports generated by a Perl script to a
> >printer. One way to do this would be to get the script to write to a
> >temporary file, then print it. Is there a system command or alternative
> >way to output a file's contents to printer rather than screen?
>
> this is system dependant .. but usually for Windows the following will
> work
>
> open OUTPUT, 'LPT1:' or die "Bad open: $!";
> print OUTPUT "What you want printed\n";
Can you print on a stream opened for input?
open OUTPUT '>LPT1:' ...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Oct 2000 22:24:59 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: jpeg image manipulation
Message-Id: <slrn8vhbpp.ksa.mgjv@verbruggen.comdyn.com.au>
On Thu, 26 Oct 2000 18:47:17 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> ejehoel@my-deja.com wrote:
>
> >I'd like to manipulate (jpeg) images using perl. For example to
> >generate thumbnails of large images or to increase the
> >compression ratio.
>
> Image::Magick and Perl::Magick.
Just a nit, and you can blame Cristy for the names and the confusion :)
The whole product is called ImageMagick. The Perl interface to it is
called Perlmagick, but the module that you actually use is
Image::Magick. There are also Magick++ for C++, JMagick for Java, and
there are also Python and Macintosh Script interfaces.
But yes. For any serious image manipulation in Perl, use it. For the
specific task at hand, Image::Magick is the easiest way to go,
although, if you really can't use Image::Magick, you can do it with
GD.
> <http://www.wizards.dupont.com/cristy/ImageMagick.html>
or http://www.imagemagick.org/
> I've not used this just yet, but I probably will, very soon.
You'll enjoy it :)
Martien
--
Martien Verbruggen |
Interactive Media Division | True seekers can always find
Commercial Dynamics Pty. Ltd. | something to believe in.
NSW, Australia |
------------------------------
Date: Thu, 26 Oct 2000 23:26:06 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: jpeg image manipulation
Message-Id: <slrn8vhfcb.ksa.mgjv@verbruggen.comdyn.com.au>
On Thu, 26 Oct 2000 23:13:48 GMT,
Al <nospamapgraham@ispchannel.com---> wrote:
> On Thu, 26 Oct 2000 22:24:59 GMT, mgjv@tradingpost.com.au (Martien
> Verbruggen) wrote:
>
> >But yes. For any serious image manipulation in Perl, use it. For the
> >specific task at hand, Image::Magick is the easiest way to go,
> >although, if you really can't use Image::Magick, you can do it with
> >GD.
> >
> Which should I use to check the pixel width of a jpg uploaded with
> CGI.pm? I wrote a web page generation script which allows users to
> fill in a form, chose a template, and have the page made for the. It
> allows them to upload a logo in the form and I'd like to check to make
> sure that the image is max 300 pix wide.
If all you're ever going to do is look at width and height of image
files, use Image::Size.
If you need to do more than that, you can use Image::Magick's Ping()
method, or GD's getBounds() method. All are usable. Image::Size will
have a lower impact than Image::Magick, although the developers are
working on making Image::Magick less demanding. Image::Size will need
less memory than GD, because it doesn't have to read (and parse) in
the whole image to get that information. Both Image::Size and
Image::Magick->Ping() just look at the file's signature. GD will need
to read the image.
What you use depends mainly on what else you need to do besides
looking at the size. If you're going to load it in IM or GD anyway,
you might as well get the size from them. If not, Image::Size is the
way to go.
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
Date: Thu, 26 Oct 2000 22:55:10 GMT
From: nospamapgraham@ispchannel.com--- (Al)
Subject: Re: Legal email addresses...
Message-Id: <39f9b593.25104824@news.ispchannel.com>
On 26 Oct 2000 08:15:14 +0100, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:
>
>>>> ' may not appear in an e-mail address. None. This is a valid address:
>>>> '
>>>> ' myname@( system('rm -rf /*'); print("Gotcha!\n") )foo.com
>>>>
>>>> Pardon my ignorance, but since when can spaces appear in a host name?
>>>
>>>Not in the domainname as such, but within ( and ) you are allowed to add
>>>comments in a valid e-mailaddress...
>>>
>>>Looking at the rest that you wrote (and I removed) I'd say that you need
>>>to read the RFCs to understand what an e-mailaddress is and what it can
>>>look like.
>>>
>> I believe we're getting confused between a valid email address and a
>> valid mailto URL.
>> I'd like to see Sean try to register
>> "( system('rm -rf /*'); print("Gotcha!\n") )foo.com"
>> as a domain name.
>
>Read the RFC. foo.com is a perfectly valid domain name - the rest of it
>is a comment as has been pointed out. This can form part of a perfectly
>valid e-mail address without having to invoke the URL deux ex machina.
>
>
I re-read the RFC (I actually managed to stay awake) and couln't find
anything allowing comments in the domain part of an email address.
Comments ARE allowed in the local part (before the @).
Please educate my with a more specific ref.
------------------------------
Date: Fri, 27 Oct 2000 01:16:24 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: Linux: Perl readline...
Message-Id: <80eat8.r11.ln@sokrates2.hagenbeck.uni-hamburg.de>
Hi! (..to everybody in this thread)
Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov> wrote:
>> $LINE=readline(FILE); #where FILE is a file handle
>
> 1) Did you mean to change filehandles? (TEST vs. FILE)
ups.. seems I mixed these two up.. of course I am using only one in my script.
> You should really post a small, self-contained script with inputs and
> expected outputs, so that people can see your problem, rather than just
> guessing.
Oh yes, i keep this in mind for future postings.... I'll might bug you
sometime again... ;
Thanx to you all for your helpfull explanations - due these, I finally
did get my script to work... :)
Alex
------------------------------
Date: Thu, 26 Oct 2000 22:12:06 GMT
From: "EM" <me@privacy.net>
Subject: LWP remote file size
Message-Id: <W_1K5.330$Nw6.1566@news.iol.ie>
i use lwp to transfer files from one server to another
the problem is that sometimes the server doesnt transfer the entire file
is there a way to get the file size on the remote server so i can compare to
the transferred file to see if its all there
thanks
------------------------------
Date: Fri, 27 Oct 2000 00:50:12 GMT
From: jay <jeano@my-deja.com>
Subject: Open URL as file
Message-Id: <8tajg2$ft5$1@nnrp1.deja.com>
I am trying to do something LIKE:
#!/usr/local/bin/perl
open SESAME, "http://www.somedomain.com/this.gif";
while (<SESAME>)
{
print "$_";
}
Is there a way that I can do something like this? Is there some perl
module that I can use? Thanks.
-j
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 15:43:37 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: perl not resolving dns in a cgi script
Message-Id: <MPG.14625378e9c9eaec98ae71@nntp.hpl.hp.com>
In article <8ta471$p9n$3@nntp9.atl.mindspring.net> on Thu, 26 Oct 2000
15:25:55 -0500, D.W. <dpalmeNOSPAM@unitedtraffic.com> says...
...
> my $hostname = $ENV{'REMOTE_HOST'};
>
> if the REMOTE_HOST is a straight IP address the variable $hostname is blank,
> a null value.....however the raw access log shows the IP address correctly.
I don't know which of your many posts to respond to.
If $ENV{REMOTE_HOST} is empty, you can use gethostbyaddr() on the IP
address, which will probably be found in $ENV{REMOTE_ADDR}. In other
words, you do your own reverse DNS lookup. This may fail to resolve
into a hostname also, of course.
perldoc -f gethostbyaddr
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Oct 2000 00:33:06 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: Perl on NT
Message-Id: <2fbat8.r11.ln@sokrates2.hagenbeck.uni-hamburg.de>
Alex Fitterling <fe8x025@public.uni-hamburg.de> wrote:
> Daniel van den Oord <danielxx@bart.nl> wrote:
>> LOL haha a microsoft Perl Version OMG.. that's just like www.mslinux.org
>> Sorry just made me smile when I read it !!!
> Heck.. if I understood you right - this is just another peace of
... what I ment is "piece" instead of "pease" of course... :)
> Billschr**ts Dreamfactory...??? Hell. I can't believe...
------------------------------
Date: Thu, 26 Oct 2000 15:58:29 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Problemi con Perl !!
Message-Id: <MPG.146256ec20c463e498ae72@nntp.hpl.hp.com>
In article <8t7ago$4ll$1@pegasus.tiscalinet.it> on Wed, 25 Oct 2000
20:58:24 +0200, NightFlier <teokfss@tiscalinet.it> says...
> Ciao, ho un problema molto semplice, non riesco a far funzionare il
> Perl.
> Ho scaricato ActivePerl buil 615 e voglio farlo avviare uno script che
> converte i file *.bin in file *.txt (si chiama tbin2txt.pl), beh NON CE LA
> FACCIO!! Il commando che metto è "c:\perl\perl.exe tbin2txt.pl texture.bin >
> text.txt", premo INVIO, esce il terminale dove si fa lo scrolling del
> contenuto del texture.bin ma non esce nessun file *.txt !!!!!!! Gli scripts
> li ho mesi nella directory c:\per\bin\, dove ho messo anche il texture.bin..
> Ho windows98, il DCOM è apposto, mscvr.dll apposto, ma nON funziona!
> Qualcuno ha qualche spiegazione per tutto questo???
The command processor should create the file 'text.txt' in the current
directory, no matter what the Perl program does or even if the perl
executable is where you say it is. Yet you say it doesn't get created
at all, which is surprising.
It might help if you gave some detail about what is in your Perl source
file, 'tbin2txt.pl', though I don't see how that can matter. You might
also try something really trivial, such as:
perl -v >test.txt
which should create and populate 'test.txt' in the current directory.
(The above assumes that the perl executable directory is in your path.
By default, that should be 'c:\perl\bin', but above you show it as
'c:\perl'. You might want to edit it into c:\autoexec.bat, if it isn't
there already.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.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 V9 Issue 4737
**************************************