[17860] in Perl-Users-Digest
Perl-Users Digest, Issue: 20 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 9 00:05:34 2001
Date: Mon, 8 Jan 2001 21:05:12 -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: <979016711-v10-i20@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 8 Jan 2001 Volume: 10 Number: 20
Today's topics:
ANNOUNCE: Switch 2.01 (Damian Conway)
Re: ASCII to integer conversion <mjcarman@home.com>
Bit-Shifting and 16-bit numbers <steve@reedelectronics.com>
Re: creating GIF or JPEG with Perl (Martien Verbruggen)
Re: Creating simple GIF pictures??? (Martien Verbruggen)
Re: CSV to Excel WK3? <carvdawg@patriot.net>
Re: CSV to Excel WK3? (John McNamara)
Re: FAQ 8.20: How can I call my system's unique C funct (Chris Fedde)
Re: File I/O giving weird results fenderstratocaster@my-deja.com
getting bash output to a perl variable. <aaron@SPAM-O-RAMA.smalltime.com>
Re: How do I work out a percentage to just one decimal (Chris Fedde)
Re: How do I work out a percentage to just one decimal <ben.graves@virgin.net>
Re: How do I work out a percentage to just one decimal <matt.stoker@motorola.com>
How to humor a bad habit...? stefan@borgia.com
Re: How to humor a bad habit...? <rick.delaney@home.com>
Re: How to humor a bad habit...? (Richard Zilavec)
Http upload <diab.lito@usa.net>
Re: Http upload <joe+usenet@sunstarsys.com>
Re: Internal rounding to whole numbers (Mark Jason Dominus)
Jpeg width/height <diab.lito@usa.net>
Re: Jpeg width/height <slinberg@silicongoblin.com>
Re: Jpeg width/height <theaney@toadmail.toad.net>
Re: Jpeg width/height <peter.sundstrom@eds.com>
Re: Masking ps output.... <mjcarman@home.com>
Mime parser <jagman98@home.com>
Re: Shall use a reference instead? <michael-a-mayo@worldnet.att.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Jan 2001 20:20:11 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Switch 2.01
Message-Id: <t5krt68676d9aa@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 2.01 of Switch
==============================================================================
NAME
Switch - A switch statement for Perl
DESCRIPTION
Switch.pm provides the syntax and semantics for an explicit case
mechanism for Perl. The syntax is minimal, introducing only the
keywords C<switch> and C<case> and conforming to the general pattern
of existing Perl control structures. The semantics are particularly
rich, allowing any one (or more) of nearly 30 forms of matching to
be used when comparing a switch value with its various cases.
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved. This module
is free software. It may be used, redistributed and/or modified under
the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 2.01
- Fixed infinite loop problem under 5.6.0 caused by change
in goto semantics between 5.00503 and 5.6.0
(thanks Scott!)
==============================================================================
AVAILABILITY
Switch has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Switch.tar.gz
==============================================================================
------------------------------
Date: Mon, 08 Jan 2001 16:30:38 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: ASCII to integer conversion
Message-Id: <3A5A3F8E.76ADF4C7@home.com>
anm imroz choudhury wrote:
>
> Hello everyone. I have a simple question the answer to which I
> just can't find anywhere.
Out of curiousity, where did you look?
> Is there a function in perl similar to the atoi() function in C
> that takes a string containing numerals, and outputs the integer
> that the string represents?
Perl doesn't have different types of scalars. If you treat it like a
number, it will act like one. If you treat it like a string, it will act
like one of those. Observe:
#!/usr/local/bin/perl5 -w
use strict;
my $x = 5; # Assign umeric value
print "$x\n";
$x = '10'; # Assign string containing a number
print "$x\n";
$x++; # Autoincrement value
print "$x\n";
$x .= ' and a half'; # Concatenate
print "$x\n";
Output:
5
10
11
11 and a half
So you don't need an atoi() function at all.
PS: Really want to bend your C-shackled mind? Try this:
#!/usr/local/bin/perl5 -w
use strict;
my $x = 'A';
print "$x\n";
$x++;
print "$x\n";
-mjc
------------------------------
Date: Mon, 8 Jan 2001 17:17:51 -0500
From: "Steve Reed" <steve@reedelectronics.com>
Subject: Bit-Shifting and 16-bit numbers
Message-Id: <93ded605g6@enews3.newsguy.com>
Following is a chunk of code that I'm working with (it interfaces with a
software security device). When the computations are complete, the value of
$Arg1 is supposed to be zero. For this algorithm to work correctly, all the
numbers must remain 16-bit values. The problem seems to be that the bit
shift that returns the value "$RotatedReturnValue1" keeps returning a 32-bit
integer. Anyone know how I can keep all the numbers at the 16-bit level so
the bit-wise operations make sense and the end result is correct?
Thanks.
$ValidateCode1 = "422B";
$ValidateCode2 = "FFF2";
$ValidateCode3 = "EF90";
$ReadCode3 = "BCF8";
$KeyLockCheck = new Win32::API("kl2dll32", "_KFUNC\@16", [N,N,N,N], "N");
$ReturnValue = $KeyLockCheck->Call(1, $ValidateCode1, $ValidateCode2,
$ValidateCode3);
$ReturnValue1 = $ReturnValue & 0xFFFF;
$ReturnValue2 = $ReturnValue >> 16;
$TempCode3 = $ReturnValue2 ^ $ReadCode3;
$RotationValue = $ReturnValue2 & 7;
$RotatedReturnValue1 = $ReturnValue1 << $RotationValue;
$Arg1 = $TempCode3 ^ $RotatedReturnValue1;
----------------------------------------------------------------------------
------------------------
Satellite Freedom for business-class broadband Satellite Internet
http://www.satellitefreedom.com
Toll Free: 1-877-546-6840
----------------------------------------------------------------------------
------------------------
------------------------------
Date: Tue, 09 Jan 2001 03:42:54 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: creating GIF or JPEG with Perl
Message-Id: <slrn95l23q.ghh.mgjv@verbruggen.comdyn.com.au>
On Mon, 8 Jan 2001 21:14:52 +0100,
Jan Müggenburg <jan.mueggenburg@gmx.net> wrote:
> Hi,
>
> is it possible to create GIF- or JPG-files with Perl? What modules do I need
> under Perl for Win32?
GD or Image::Magick, depending on what you need to do. GD doesn't
create GIF anymore, and Image::Magick only produces uncompressed GIF
(unless you pay Unisys a fee yourself, and compile in LZW support).
But you should probably create PNG anyway.
> My intention is to draw a graph from a data set, store the diagramm as GIF
> or JPG-file and to include this file in a HTML-file.
Maybe you should have a look at GD::Graph, PGPLOT, the various Chart::
modules or the gnuplot program, again depending on your need, which
you don't specify at all sufficiently.
Did you know that these sorts of questions can normally be answered by
visiting CPAN at http://www.cpan.org/? They even have a search engine
for you at http://search.cpan.org/.
Martien
--
Martien Verbruggen |
Interactive Media Division | I used to have a Heisenbergmobile.
Commercial Dynamics Pty. Ltd. | Every time I looked at the
NSW, Australia | speedometer, I got lost.
------------------------------
Date: Tue, 09 Jan 2001 03:46:12 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Creating simple GIF pictures???
Message-Id: <slrn95l2a1.ghh.mgjv@verbruggen.comdyn.com.au>
On 08 Jan 2001 14:29:02 +0100,
Christian Meisl <meisl@amvt.tu-graz.ac.at> wrote:
> Hello everybody!
>
> I want to create a very simple GIF picture with a perl application
> (which does not use Tk). In the picture, there should be shown several
> rectangles of a certain color (black), and a HUGE amount of single
> dots of another color (red). The background of the GIF should be
> white, the size should be 1280x1024.
Sounds like a job for GD (or maybe Image::Magick).
If you insist on GIF, get an old version of GD, and if you want it
compressed, make sure you pay Unisys a fee (Image::Magick can link in
LZW compresion, but you still should pay Unisys).
You could of course just create PNG< which both modules will do, for
free.
Martien
--
Martien Verbruggen |
Interactive Media Division | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd. | spot.
NSW, Australia |
------------------------------
Date: Mon, 08 Jan 2001 18:21:28 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: CSV to Excel WK3?
Message-Id: <3A5A4B78.D8BAA93E@patriot.net>
Double-click the CSV file to open it in Excel, and then choose "Save As..."
OR
use Win32::OLE.
However, neither is an instant solution...any solution requiring more than a
single
clock cycle isn't "instant"
Reto Hersiczky wrote:
> Has anyboy an instant solution to convert
> a csv file to Excel's *.wk3 format?
>
> CPAN didn't help
>
> Any suggestions welcome.
>
> ------------------------------------------------------------------------
> Reto Hersiczky cut_here_reto.hersiczky@netcetera.ch
> Netcetera AG, 8040 Zuerich phone +41 1 247 79 39 fax +41 1 247 70 75
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Tue, 09 Jan 2001 00:03:45 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: CSV to Excel WK3?
Message-Id: <3a5a535b.6540436@news1.eircom.net>
Ar 8 Jan 2001 16:45:10 GMT, do scriobh Reto Hersiczky:
>Has anyboy an instant solution to convert
>a csv file to Excel's *.wk3 format?
WK3 is a Lotus format. If you want an Excel solution have a look at
http://search.cpan.org/search?dist=Spreadsheet-WriteExcel. It includes
a Perl program called csv2xls that converts CSV files to Excel files.
It uses Text::CSV_XS to parse the CSV.
John McNamara
--
"Something tells me we aren't programming in Pascal anymore, Toto."
------------------------------
Date: Mon, 08 Jan 2001 23:12:21 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: FAQ 8.20: How can I call my system's unique C functions from Perl?
Message-Id: <pPr66.774$B9.190376960@news.frii.net>
In article <93bcge$lnl$1@nnrp1.deja.com>, <active_ingy@my-deja.com> wrote:
>In article <hy866.753$B9.190387712@news.frii.net>,
> PerlFAQ Server <faq@denver.pm.org> wrote:
>> How can I call my system's unique C functions from Perl?
>>
>> In most cases, you write an external module to do it - see the
>
>Alternatively you could write your own wrapper with Inline.pm. This
>gives you more control than syscall because you can determine how the
>function is called and how arguments get passed back and forth. Here is
>a modified example from the Inline C Cookbook distributed with Inline:
>
Great idea! I'd love iit if you could re-write this in POD and mail it to
faq@denver.pm.org
or
perlfaq-suggestions@perl.com
thanks
chris
--
This space intentionally left blank
------------------------------
Date: Mon, 08 Jan 2001 23:22:30 GMT
From: fenderstratocaster@my-deja.com
Subject: Re: File I/O giving weird results
Message-Id: <93di3d$g5o$1@nnrp1.deja.com>
I'm trying to learn Perl from a book I bought at Barnes and Nobles, so
I'm by far not an expert. Just some quick questions so I can understand
this a little better.
> Yes I agree the results are weird, reading from an append-only
> filehandle should fail - not return garbage.
So if I use:
open(FREECELL, ">>C:/My Documents/freecell.txt");
I should not read the file into a variable or an array? And by doing so
I'm getting jibberish?
> You say you want the line to be delimited by ', ' but you do:
>
> print FREECELL "@array";
>
> By default this uses space a the delimiter. You need to explicitly use
> join()...
print FREECELL join(', ' @array);
The above line should do the trick?
And the best way for me to do the code in the first place would be just
to open the file for writing using:
open(FREECELL, ">C:/My Documents/freecell.txt");
Then reading the file into the array, adding a number to the end of the
array, sort it out, erase the file, then write the array back into it?
Thank you for your help,
FenderStratocaster
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 8 Jan 2001 23:59:47 -0500
From: "Aaron!@#" <aaron@SPAM-O-RAMA.smalltime.com>
Subject: getting bash output to a perl variable.
Message-Id: <93e5o5$ovi$1@slb6.atl.mindspring.net>
Hey there. I'm having trouble getting a file from a linksys router on my
LAN (so I can get a . Here's what I have so far:
--------------------
------- snip -------
#!/usr/bin/perl
################
# Configure It #
################
$RouterURL = "http://192.168.1.1/Status.htm"; ### URL of page which lists IP
address
$RouterUserName = ""; ### Usually nothing.
$RouterPassword = "admin"; ### Usually 'admin'.
#########
# Stuff #
#########
$StatusPage ==
`wget --http-user=$RouterUserName --http-passwd=$RouterPassword
\"$RouterURL\" -O -`;
print "StatusPage is $StatusPage";
------- snip -------
--------------------
When I run it, wget appears to be struttin' its stuff onscreen, but
$StatusPage is apparantly blank:
--------------------
------- snip -------
root@cafeteria:~# ./ip
--23:51:32-- http://192.168.1.1:80/Status.htm
=> `-'
Connecting to 192.168.1.1:80... connected!
HTTP request sent, awaiting response... 401 Authorization Required
Connecting to 192.168.1.1:80... connected!
HTTP request sent, awaiting response... 200 OK
Length: 4,412 [text/html]
0K -> .... [100%]
23:51:32 (331.43 KB/s) - `-' saved [4412/4412]
------- snip -------
--------------------
I also tried:
- doing "-O /dev/stout" instead of "-O -".
- doing "$StatusPage eq" instead of "$StatusPage =="
- inhaling massive amounts of caffiene
but nothing seemed to do the trick.
Perhaps you can help?
------------------------------
Date: Mon, 08 Jan 2001 23:20:14 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: How do I work out a percentage to just one decimal place?
Message-Id: <OWr66.775$B9.190391808@news.frii.net>
In article <7Cq66.64298$ca6.1162879@news6-win.server.ntlworld.com>,
Ben Graves <ben.graves@virgin.net> wrote:
>I am trying to work out percentage values for four numbers to use in a
>visitor poll.
>
>How do I get the number to be worked out to one decimal place?
>
>Also how do you round a value to the nearest whole number?
>
>Thanx for any help,
>
The classic integer rounding function is
$rounded = int($value + 0.5)
Rounding to 'one decimal place' could be done using sprintf
$rounded = sprintf('%.1f', $value);
YMMV
chris
--
This space intentionally left blank
------------------------------
Date: Tue, 9 Jan 2001 01:43:15 -0000
From: "Ben Graves" <ben.graves@virgin.net>
Subject: Re: How do I work out a percentage to just one decimal place?
Message-Id: <N0u66.1714$hx6.64732@news2-win.server.ntlworld.com>
Works great!
Thanx for the help,
Ben
"Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
news:OWr66.775$B9.190391808@news.frii.net...
> In article <7Cq66.64298$ca6.1162879@news6-win.server.ntlworld.com>,
> Ben Graves <ben.graves@virgin.net> wrote:
> >I am trying to work out percentage values for four numbers to use in a
> >visitor poll.
> >
> >How do I get the number to be worked out to one decimal place?
> >
> >Also how do you round a value to the nearest whole number?
> >
> >Thanx for any help,
> >
>
> The classic integer rounding function is
>
> $rounded = int($value + 0.5)
>
> Rounding to 'one decimal place' could be done using sprintf
>
> $rounded = sprintf('%.1f', $value);
>
> YMMV
> chris
> --
> This space intentionally left blank
------------------------------
Date: Mon, 08 Jan 2001 18:30:57 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: How do I work out a percentage to just one decimal place?
Message-Id: <3A5A69D1.6403D961@motorola.com>
Ben Graves wrote:
>
> I am trying to work out percentage values for four numbers to use in a
> visitor poll.
>
> How do I get the number to be worked out to one decimal place?
>
> Also how do you round a value to the nearest whole number?
>
> Thanx for any help,
>
> Ben
See question 4.13 in the FAQ:
http://www.faqs.org/faqs/perl-faq/part4/
--
/------------------------------------------------------------------\
| Matt Stoker | email: matt.stoker@motorola.com |
| Unit Process Modeling | Mail Drop: M360 |
| DigitalDNA(TM) Laboratories| Phone: (480)655-3301 |
| Motorola, SPS | Fax: (480)655-5013 |
| 2200 W Broadway Road | Pager: (888)699-8803 |
| Mesa, AZ 85202 | |
\------------------------------------------------------------------/
------------------------------
Date: Tue, 09 Jan 2001 00:28:55 GMT
From: stefan@borgia.com
Subject: How to humor a bad habit...?
Message-Id: <93dlvu$jac$1@nnrp1.deja.com>
Hi all!
If I have some code like this:
$ini{'a1'}='1';
$ini{'a2'}='2';
and then do:
foreach ( keys(%ini) ) { print "$_\n" }
I get this:
a1
a2
If I have some code like this:
$ini{'a'}{'a1'}='1';
$ini{'a'}{'a2'}='2';
How do I get:
a1
a2
Know what I am asking about? I don't know how to determine the "sub-
keys" in those 2 declarations, but I can determine the keys...
Any suggestions?
Thanks!
Stefan Adams
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 09 Jan 2001 01:04:53 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: How to humor a bad habit...?
Message-Id: <3A5A6787.A06547B3@home.com>
[posted & mailed]
stefan@borgia.com wrote:
>
> If I have some code like this:
>
> $ini{'a'}{'a1'}='1';
> $ini{'a'}{'a2'}='2';
>
> How do I get:
>
> a1
> a2
>
> Know what I am asking about? I don't know how to determine the "sub-
> keys" in those 2 declarations, but I can determine the keys...
>
> Any suggestions?
Read the section "Access and Printing of a HASH OF HASHES" in perldsc.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Tue, 09 Jan 2001 02:52:51 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: How to humor a bad habit...?
Message-Id: <3a5a7c06.509868454@news.tcn.net>
On Tue, 09 Jan 2001 00:28:55 GMT, stefan@borgia.com wrote:
> $ini{'a1'}='1';
> $ini{'a2'}='2';
>
>and then do:
>
> foreach ( keys(%ini) ) { print "$_\n" }
>
>I get this:
>
> a1
> a2
>
>If I have some code like this:
>
> $ini{'a'}{'a1'}='1';
> $ini{'a'}{'a2'}='2';
foreach $hashname (keys %ini) {
print $hashname . "\n";
foreach $key (keys %{$ini{$hashname}}) {
print "$key $ini{$hashname}->{$key}\n";
}
}
You have to get the keys from the first hash, then you can get the
keys from the second hash and finally the values.
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Tue, 09 Jan 2001 02:37:19 GMT
From: Mario <diab.lito@usa.net>
Subject: Http upload
Message-Id: <93dtgv$p94$1@nnrp1.deja.com>
I use this code to http upload an images trough a form:
open (OUTFILE, ">$pics_folder/$file_name.gif") || die "error,$!";
binmode OUTFILE;
while ($bytes_read = read($file_handle, $buffer, 1024)) {
print OUTFILE $buffer;
}
close ($file_handle) || die "error,$!";
close (OUTFILE) || die "error,$!";
It works with Gif,but uploads a distorced Jpeg image.Should I use
something different for Jpg files?
Thanks anyone.
--
Mario
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 08 Jan 2001 22:00:52 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Http upload
Message-Id: <m33detzaxn.fsf@mumonkan.sunstarsys.com>
Mario <diab.lito@usa.net> writes:
> I use this code to http upload an images trough a form:
>
> open (OUTFILE, ">$pics_folder/$file_name.gif") || die "error,$!";
^^^
[...]
> It works with Gif,but uploads a distorced Jpeg image.Should I use
> something different for Jpg files?
If the file you're uploading isn't a gif, then you probably
shouldn't be naming it with a .gif extension. Try testing
the upload file's mime-type for image/jpeg vs. image/gif,
and use the appropriate extension for each type.
HTH
--
Joe Schaefer
------------------------------
Date: Tue, 09 Jan 2001 02:14:31 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Internal rounding to whole numbers
Message-Id: <3a5a7406.54f0$e7@news.op.net>
In article <Zen66.152892$I5.3806225@news1.rdc1.sdca.home.com>,
John Hall <jhall@ifxonline.com> wrote:
>Is it acceptable to allow perl to round the value for me;
Acceptable to whom? To me? Why would you care?
> or is this a bad thing?
I've never known it to cause any problems.
'$a[rand @a]' is a common idiom.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 09 Jan 2001 02:40:04 GMT
From: Mario <diab.lito@usa.net>
Subject: Jpeg width/height
Message-Id: <93dtm3$pbg$1@nnrp1.deja.com>
How can I get width/height info of a JPEG file?
Reading the 7 to 10 byte (as in GIF) doesn't work.
Thanks.
--
Mario
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 08 Jan 2001 23:13:16 -0500
From: Steve Linberg <slinberg@silicongoblin.com>
Subject: Re: Jpeg width/height
Message-Id: <m3d7dxuzvn.fsf@ltlvx.literacy.upenn.edu>
Mario <diab.lito@usa.net> writes:
> How can I get width/height info of a JPEG file?
> Reading the 7 to 10 byte (as in GIF) doesn't work.
Image::Magick is one way.
--
Steve Linberg, Chief Goblin
Silicon Goblin Technologies
http://silicongoblin.com
Be kind. Remember, everyone you meet is fighting a hard battle.
------------------------------
Date: 08 Jan 2001 23:38:18 -0500
From: Tim Heaney <theaney@toadmail.toad.net>
Subject: Re: Jpeg width/height
Message-Id: <87bsthz6f9.fsf@susie.watterson>
Mario <diab.lito@usa.net> writes:
> How can I get width/height info of a JPEG file?
> Reading the 7 to 10 byte (as in GIF) doesn't work.
http://www.faqs.org/faqs/jpeg-faq/part1/section-22.html
------------------------------
Date: Tue, 9 Jan 2001 16:13:58 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Jpeg width/height
Message-Id: <93dvlp$3kj$1@hermes.nz.eds.com>
"Mario" <diab.lito@usa.net> wrote in message
news:93dtm3$pbg$1@nnrp1.deja.com...
> How can I get width/height info of a JPEG file?
> Reading the 7 to 10 byte (as in GIF) doesn't work.
Use the Image::Size module.
http://search.cpan.org/search?mode=module&query=Image%3A%3ASize
------------------------------
Date: Mon, 08 Jan 2001 16:16:25 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Masking ps output....
Message-Id: <3A5A3C39.6ED8FAD8@home.com>
bamar@my-deja.com wrote:
>
> I have the following problem, i had written a Gui wrapper
> around an executable asking for a user name and a passwd
> in my script i call system("foo -user $user -passwd $passwd")
> the froblem is that foo being another program forks a child and
> does not exit and shows up in the ps listing giving the user name
> and passwd , is there any way to get around this ??
Change your program so that the password isn't given as an argument.
See the perlfaq8 manpage for the long answer. In the future, please
consult the FAQ *before* posting a question here; It's faster for you,
gives better answers than a newsgroup, and cuts down on the massive
amount of traffic here.
-mjc
------------------------------
Date: Tue, 09 Jan 2001 02:29:33 GMT
From: Manny <jagman98@home.com>
Subject: Mime parser
Message-Id: <3A5A779C.7F5621CF@home.com>
I am trying to remove HTML and other MIME code from MIME message body
using MIME:Parser but the message still does not remove anything.
Can someone post an example of parser code?
Thanks in advance!
------------------------------
Date: Tue, 09 Jan 2001 03:21:28 GMT
From: "Michael Mayo" <michael-a-mayo@worldnet.att.net>
Subject: Re: Shall use a reference instead?
Message-Id: <Ysv66.22281$7f3.1572832@bgtnsc07-news.ops.worldnet.att.net>
"Ilmari Karonen" <iltzu@sci.invalid> wrote in message
news:978955589.18700@itz.pp.sci.fi...
>A reference is a reference, and an object is
> a blessed "thingy". It's just that there's usually little reason to
> access the object directly, so all you'll see in the code is the ref.
From Damian Conway's Object Oriented Perl, p76:
" Rule 3: To create an object, bless a _referent_."
"The bless function takes two arguments: a reference to the variable
to be marked and a string containing the name of the class. It then
sets an internal flag on the variable, indicating that it now belongs
to the class."
The bless function takes a *reference* to a blessed thingie. Therefore, the
only way (AFAIK) to access an object's internals or call an object's methods is
to supply a reference to a blessed thingie (an object).
Also, on p444:
"Objects:
C++ objects may be stored directly in statically typed variables
or dynamically created and accessed via typed pointers or
references. Perl objects may similarly be variables or unnamed
values and are always accessed via _references_ stored in
dynamically typed variables."
On the other hand, I did notice this, p439:
"Objects:
In Smalltalk, every object is accessed through a variable storing
a _reference_ to it. Perl objects are (almost always) stored and
accessed the same way."
This contradicts the statement on p444 and seems to support your view that it
is possible (but "almost never" done) to access an object without a reference.
I have no idea how you would do this, though.
>Still, it is possible to have direct access to a blessed variable
OK, let's take this simple class:
package Doohickie;
sub new{
my $class = shift @_;
my $vars = { color=>'red' }
bless $vars, $class;
return $vars;
}
sub doThingamabob {
my $self = shift @_;
$self->{color} = 'black';
}
Please show me how to:
1) create a new object of this class
2) access the object's color value
3) call the object's doThingamabob method
all without using references.
I don't see how this is possible given that an object's methods implicitly take
the object as their first argument!
-Mike
------------------------------
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 20
*************************************