[23468] in Perl-Users-Digest
Perl-Users Digest, Issue: 5682 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 20 00:07:48 2003
Date: Sun, 19 Oct 2003 21:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 19 Oct 2003 Volume: 10 Number: 5682
Today's topics:
Re: 'time' utilty for Win*? (!Cygwin) <ccya86@yahoo.com>
C vs Perl <ccya86@yahoo.com>
Re: C vs Perl <nroberts@dontemailme.com>
Re: cleanup speed (named vs anonymous (and my?)) ctcgag@hotmail.com
DUDA IMPORTANTE <ccampora@anakena.dcc.uchile.cl>
Re: Finding all used fileno's ? <ndronen@io.frii.com>
Re: finding text-segment in a HTTP::Element tree (ko)
Re: How can i write the values of a form through a cgi <tore@aursand.no>
Re: How do I make a standalone WIN32 executable from Pe <invalid-email@rochester.rr.com>
Re: How do I make a standalone WIN32 executable from Pe <jwillmore@remove.adelphia.net>
Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
Re: How do I make a standalone WIN32 executable from Pe <usenet@expires12.2003.tinita.de>
Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
Re: How do I make a standalone WIN32 executable from Pe astewart1@cox.net
Re: How do I make a standalone WIN32 executable from Pe <perlnews@kwcpa.com>
Re: HTML whitespace/commnets cruncher <nospam@bigpond.com>
Re: Newbie dumb but quick question <bobx@linuxmail.org>
Re: Newbie dumb but quick question (ko)
Re: Newbie dumb but quick question <jeffw5@kwcpa.com>
Re: Newbie dumb but quick question (Sam Holden)
Re: Newbie dumb but quick question <perlnews@kwcpa.com>
retrieving info from file <feurry@hotmail.com>
Re: retrieving info from file (Sam Holden)
Re: retrieving info from file <feurry@hotmail.com>
Re: retrieving info from file (Tad McClellan)
Re: retrieving info from file (Sam Holden)
Re: retrieving info from file <feurry@hotmail.com>
Rookie: Constructing a large SQL INSERT statement <sdfg@sdg.com>
Re: Rookie: Constructing a large SQL INSERT statement <nospam@bigpond.com>
Re: TIFF conversion with Image::Magick <mgjv@tradingpost.com.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 19 Oct 2003 21:01:58 -0500
From: "len v" <ccya86@yahoo.com>
Subject: Re: 'time' utilty for Win*? (!Cygwin)
Message-Id: <omHkb.1899$5M.46865@dfw-read.news.verio.net>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:ph5vovguph0appho85l4q6v1ha6td83o4i@4ax.com...
> I know this is OT, but since I use 'time' under Linux for quick tests
> of my perl scripts, I'm asking here...
>
> Does anyone know if there's a straight port of 'time' *nix utility to
> win32? I know that it will be available under Cygwin, but I do not
> want/can install it.
>
> I have a set of *nix utilities that do _not_ require an emulation
> layer, called UnxUtils/UnxUpdates[*] and even though there are some
> incompatibilities due to the fact that the OSes are actually
> different, I've been happy using (those utilities that I needed in)
> it. But 'time' is not included in the collection!
>
> I've tried both googling for 'time' with some other helping keyword
> and browsing fsf site, but couldn't find anything thus far.
>
>
> [*] Though I don't know if the project is actively maintained any
> more.
>
>
> TIA,
> Michele
> --
> # This prints: Just another Perl hacker,
> seek DATA,15,0 and print q... <DATA>;
> __END__
Win2k's Resource kits contains a util called timethis.exe and can be
downloaded from Microsoft's web site at (sorry for the long link)
http://www.microsoft.com/downloads/details.aspx?FamilyID=913795cd-7026-4143-ae85-1f5e096f9be0&DisplayLang=en
Len V
------------------------------
Date: Sun, 19 Oct 2003 19:53:58 -0500
From: "len v" <ccya86@yahoo.com>
Subject: C vs Perl
Message-Id: <CmGkb.1898$5M.46778@dfw-read.news.verio.net>
A recent (Oct 3) Fox Trox comic (Bill Amend ) got me thinking causing me to
edit the origional comic. Bill then had to write a patch, as most C
programers must do.( http://homepage.mac.com/billamend/images/patch.gif )
To see the comparison, go to ---> http://perl.hacker.freeservers.com/
------------------------------
Date: Sun, 19 Oct 2003 18:03:11 -0700
From: Noah Roberts <nroberts@dontemailme.com>
Subject: Re: C vs Perl
Message-Id: <bmvcem$n6o$1@quark.scn.rain.com>
len v wrote:
> A recent (Oct 3) Fox Trox comic (Bill Amend ) got me thinking causing me to
> edit the origional comic. Bill then had to write a patch, as most C
> programers must do.( http://homepage.mac.com/billamend/images/patch.gif )
>
> To see the comparison, go to ---> http://perl.hacker.freeservers.com/
Where is the C++ version? I don't see it.
--
Noah Roberts
- "If you are not outraged, you are not paying attention."
------------------------------
Date: 20 Oct 2003 03:57:28 GMT
From: ctcgag@hotmail.com
Subject: Re: cleanup speed (named vs anonymous (and my?))
Message-Id: <20031019235728.411$04@newsreader.com>
Eric Wilhelm <ewilhelm@somethinglike.sbcglobalDOTnet> wrote:
> I've been working on a 2D drafting / geometry module (CAD::Drawing) and
> noticed some HUGE slowdown when working with extremely large hashes.
>
> This is an object-oriented module, so the typical blessed hash reference
> is returned by the constructor function:
>
> sub new {
> my $caller = shift;
> my $class = ref($caller) || $caller;
> my $self = {@_};
> bless($self, $class);
> return($self);
> }
>
> The two keys under which most of the data is stored are $self->{g} (all
> geometry, nested by layer name and then entity) and $self->{colortrack}
> (keeping lists of addresses nested by layer,entity, then color.)
>
> While loading the data into the structure took very little time with the
> above function, I knocked about 11 minutes off of the cleanup using the
> one below (from 11m27.723s down to 0m31.711s loading 689850 circles onto
> 4590 layers.
I've noticed that the clean-up of very large hashes is very
ill-behaved. It can sometime be inordinately slow, and what
causes it to be slow or not is unpredicable. On some systems and
versions, simply allocating buckets at the start (even the default number
of buckets) can cure the slowness. Sometimes switching from lexical
to dynamic has done it. Sometimes it seems that switching from
named to referenced only (or vice versa) does it. Since I rarely want to
destroy large hashes except at program end, I've taken to just routinely
using _exit in programs with large hashes.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Sun, 19 Oct 2003 21:50:48 +0000 (UTC)
From: Cristian Alberto Campora Guajardo <ccampora@anakena.dcc.uchile.cl>
Subject: DUDA IMPORTANTE
Message-Id: <bmv0vo$pi8$1@helcaraxe.dcc.uchile.cl>
Al final se puede modificar el codigo de las dos tareas anteriores ???
------------------------------
Date: 20 Oct 2003 00:03:49 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: Finding all used fileno's ?
Message-Id: <3f932665$0$199$75868355@news.frii.net>
Dean Arnold <darnold@presicient.com> wrote:
DA> I've got an app that calls an external
DA> 3rd party C lib that opens sockets, but doesn't expose the sockets
DA> directly outside of the library. I want to use the fileno's
DA> of those sockets in a Perl select(read,write,error,timeout) call.
DA> so I need to discover the fileno's of the sockets.
DA> Q: will something like the following do what I need
DA> (esp. on both Win32 and *nix) ? The upper fileno limit
DA> is arbitrary, and can probably be tuned as needed.
DA> @fdary = ();
DA> foreach (0..23) {
DA> $fdary[$_] = 1, next
DA> unless open FH, "<&$_";
DA> close FH;
DA> }
DA> foreach (0..$#fdary) {
DA> print "$_ is available\n"
DA> if defined($fdary[$_]);
DA> }
I don't know whether this works on Win32, but fstat seems to be
a better approach than open on UNIX.
#!/usr/bin/perl
use POSIX qw/fstat/;
for (0 .. 25) {
print "$_ is open\n" if fstat $_;
}
$ ./fds
0 is open
1 is open
2 is open
DA> The idea would be to scan once before
DA> calling the external lib to open a socket,
DA> then scan again, skipping the entries we know are
DA> already open. The difference between
DA> pre- and post- sets of dup'able handles is
DA> assumed to be the fileno's of the new sockets.
DA> It seems to work for files openned via Perl, but are
DA> the fileno's generated via Perl identical to the underlying OS's
DA> file descriptors ? esp. for Win32 ?
In the above output, 0, 1 and 2 are stdin, stdout and stderr,
respectively. The filenos are correct and identical to filenos
that the operating system associates with the process. I think
perl's behavior is such that you should be able to test this yourself
and not worry too much about the details.
DA> Is there a way to do this with a zero-timeout select() or poll()
DA> (ie, set the bitmask to all fileno's, then scan for any fileno's
DA> which report errors ?)
You can only select(2) or poll(2) on "valid" file descriptors;
you'll get an EBADF if your file descriptor set contains a fileno
that's not yet open.
Regards,
Nicholas
--
"Why shouldn't I top-post?" http://www.aglami.com/tpfaq.html
"Meanings are another story." http://www.ifas.org/wa/glossolalia.html
------------------------------
Date: 19 Oct 2003 16:44:28 -0700
From: kuujinbo@hotmail.com (ko)
Subject: Re: finding text-segment in a HTTP::Element tree
Message-Id: <92d64088.0310191544.167de369@posting.google.com>
"Arthur B." <nan@voulauépa.com> wrote in message news:<bms4ac$qqr$1@news.polytechnique.fr>...
> ko wrote:
[snip]
> > What exactly are you trying to do,
>
> See my post : call a sub for each text-segment, taking the segment
> as a parameter. See HTML::Element for a definition of text-segment
>
> > and what code have you tried so far?
>
> Nothing, I can't figure how to do it
Two choices I'm aware of:
1. Write a recursive routine that processes all tags to deal with the
text segments.
2. Use objectify_text() to get all text segments. The method turns
text segments into HTML::Element objects and allows direct access to
the text:
#!/usr/bin/perl -w
use strict;
use HTML::TreeBuilder; # inherits from HTML::Element
my $html;
{
local $/;
$html = <DATA>;
}
my $root = HTML::TreeBuilder->new;
$root->parse($html);
$root->eof;
$root->objectify_text;
my @text_nodes = $root->look_down('_tag','~text');
# your sub to process text
print $_->attr('text'), "\n" foreach @text_nodes;
$root->deobjectify_text;
$root->delete;
__DATA__
<html>
<body>
<p>some text</p>
<p>more text</p>
</body>
</html>
Text segments are accessible through the object's 'text' attribute
using the attr() method. So to do a substitution::
(my $text = $_->attr('text')) =~ s#PATTERN#REPLACEMENT#; #read
$_->attr('text',$text); # make change
Don't know how I can explain look_down() any better than it already is
in the docs. Maybe if you copy/paste the examples from the docs into a
script and played around with it you'll get a better feel for how to
use it. Perhaps you're not too familiar with using objects? If so,
'perldoc perlboot' should help get you started.
HTH - keith
------------------------------
Date: Mon, 20 Oct 2003 02:39:48 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: How can i write the values of a form through a cgi script in a txt file.
Message-Id: <pan.2003.10.20.00.02.52.323188@aursand.no>
On Sun, 19 Oct 2003 11:15:09 -0700, JR wrote:
>> Please post the complete code.
> [...]
> this is my complete code
That's impossible. You told in the previous message that you got this
error message:
Undefined subroutine CGI::Vars at CGI.pm line 349
When I run your code - as posted by you - I don't receive this error
message. I get, however, an other error:
Global symbol "%params" requires explicit package name [...]
And that's because you're not dereferencing your hash when printing it out;
print EEP $key . ' = ' . $params{$key} . '<br';
^^^^^^^^^^^^^
You should use '$params->{$key}' instead.
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Sun, 19 Oct 2003 22:13:45 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <3F930C49.4040307@rochester.rr.com>
Jeff W wrote:
> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
> could write PC scripts and utilities. I downloaded ActivePerl and
> looked at it. However, it appears that I would need a perl
> installation on every target machine. Is there any easy, (and low or
> zero cost) way to generate standalone Perl/Tk executables?
...
> /j
I don't understand why you think you need to make an executable to have
it run anywhere that uses the same platform. It is easy, for example,
to make a CDROM that will autorun a Perl/Tk program on any target Win32
system, without installing anything, making any executable, etc. Here
is an example directory list of such a CDROM:
E:\>dir
Volume in drive E is 000716_2242
Volume Serial Number is 3DD9-9056
Directory of E:\
AUTORUN INF 30 07-16-00 4:08p autorun.inf
LOOKUP BAT 26 07-16-00 4:03p lookup.bat
LOOKUP PL 4,118 07-16-00 9:38p lookup.pl
LPAP DBN 499,712 07-15-00 11:20p lpap.dbn
LPFN DB 5,218,304 07-15-00 10:49p lpfn.db
LPHN DBN 4,472,832 07-15-00 11:13p lphn.dbn
LPLN DB 5,767,168 07-15-00 10:49p lpln.db
LPMAIN DB 84,811,776 07-15-00 10:49p lpmain.db
LPMI DBN 2,449,408 07-16-00 12:56p lpmi.dbn
LPSD DBN 155,648 07-15-00 11:13p lpsd.dbn
LPSF DBN 147,456 07-15-00 11:04p lpsf.dbn
LPSM DBN 2,809,856 07-15-00 11:13p lpsm.dbn
LPST DB 5,873,664 07-15-00 10:49p lpst.db
LPTN DBN 2,875,392 07-16-00 8:41p lptn.dbn
LPZP DBN 2,924,544 07-15-00 11:21p lpzp.dbn
PERL <DIR> 07-16-00 10:42p Perl
README TXT 10,719 07-16-00 10:37p readme.txt
SETUP BAT 26 07-16-00 4:03p setup.bat
17 file(s) 118,020,679 bytes
1 dir(s) 0 bytes free
E:\>
The Perl/Tk program is lookup.pl, the Perl directory is a direct copy of
my Perl directory on my PC, including everything there (if space were an
issue, one could get rid of the docs, unused modules, etc). The
autorun.inf file contains:
[autorun]
open=lookup.bat
and lookup.bat contains:
@perl\bin\perl lookup.pl
The rest of the files are data files or informational. Setup.bat is
just a copy of lookup.bat for those who might have autorun turned off --
folks are more likely to type "setup" than "lookup".
Folks can also simply copy the whole CD to a directory on their hard
drive, and have it work from there with better performance than straight
off the CD, with no setup, installation, etc -- and have it be 100% gone
when they erase the directory. All in all, very effective and very easy.
HTH.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sun, 19 Oct 2003 22:32:50 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <20031019183320.654557e4.jwillmore@remove.adelphia.net>
On Sun, 19 Oct 2003 15:14:22 -0400
Jeff W <perlnews@kwcpa.com> wrote:
> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but
> i AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32
> so I could write PC scripts and utilities. I downloaded ActivePerl
> and looked at it. However, it appears that I would need a perl
> installation on every target machine. Is there any easy, (and low
> or zero cost) way to generate standalone Perl/Tk executables?
In the land of *NIX, you could use perlcc to compile an application.
In Windows land, you _may_ have to get a comercial application -or-
use Cygwin, compile Perl, and then you _should_ have perlcc available
to you.
I can't speak from experience, but that's my understanding.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
An artist should be fit for the best society and keep out of it.
------------------------------
Date: Sun, 19 Oct 2003 19:40:08 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <YNGdnbCgHItFvQ6iRVn-jA@comcast.com>
I appreciate the idea, but I don't really want to leave 118M on
someone's system because i gave them a 50KB utility...
thanks though
/j
Bob Walton wrote:
>Jeff W wrote:
>
>> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
>> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
>> could write PC scripts and utilities. I downloaded ActivePerl and
>> looked at it. However, it appears that I would need a perl
>> installation on every target machine. Is there any easy, (and low or
>> zero cost) way to generate standalone Perl/Tk executables?
>...
>> /j
>
>I don't understand why you think you need to make an executable to have
>it run anywhere that uses the same platform. It is easy, for example,
>to make a CDROM that will autorun a Perl/Tk program on any target Win32
>system, without installing anything, making any executable, etc. Here
>is an example directory list of such a CDROM:
>
>E:\>dir
>
> Volume in drive E is 000716_2242
> Volume Serial Number is 3DD9-9056
> Directory of E:\
>
>AUTORUN INF 30 07-16-00 4:08p autorun.inf
>LOOKUP BAT 26 07-16-00 4:03p lookup.bat
>LOOKUP PL 4,118 07-16-00 9:38p lookup.pl
>LPAP DBN 499,712 07-15-00 11:20p lpap.dbn
>LPFN DB 5,218,304 07-15-00 10:49p lpfn.db
>LPHN DBN 4,472,832 07-15-00 11:13p lphn.dbn
>LPLN DB 5,767,168 07-15-00 10:49p lpln.db
>LPMAIN DB 84,811,776 07-15-00 10:49p lpmain.db
>LPMI DBN 2,449,408 07-16-00 12:56p lpmi.dbn
>LPSD DBN 155,648 07-15-00 11:13p lpsd.dbn
>LPSF DBN 147,456 07-15-00 11:04p lpsf.dbn
>LPSM DBN 2,809,856 07-15-00 11:13p lpsm.dbn
>LPST DB 5,873,664 07-15-00 10:49p lpst.db
>LPTN DBN 2,875,392 07-16-00 8:41p lptn.dbn
>LPZP DBN 2,924,544 07-15-00 11:21p lpzp.dbn
>PERL <DIR> 07-16-00 10:42p Perl
>README TXT 10,719 07-16-00 10:37p readme.txt
>SETUP BAT 26 07-16-00 4:03p setup.bat
> 17 file(s) 118,020,679 bytes
> 1 dir(s) 0 bytes free
>
>E:\>
>
>The Perl/Tk program is lookup.pl, the Perl directory is a direct copy of
>my Perl directory on my PC, including everything there (if space were an
>issue, one could get rid of the docs, unused modules, etc). The
>autorun.inf file contains:
>
>[autorun]
>open=lookup.bat
>
>and lookup.bat contains:
>
>@perl\bin\perl lookup.pl
>
>
>The rest of the files are data files or informational. Setup.bat is
>just a copy of lookup.bat for those who might have autorun turned off --
>folks are more likely to type "setup" than "lookup".
>
>Folks can also simply copy the whole CD to a directory on their hard
>drive, and have it work from there with better performance than straight
>off the CD, with no setup, installation, etc -- and have it be 100% gone
>when they erase the directory. All in all, very effective and very easy.
>
>HTH.
>
>
------------------------------
Date: Sun, 19 Oct 2003 19:41:55 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <YNGdnbOgHIvevA6iRVn-jA@comcast.com>
thanks James - I think you are saying I should run unix perl under
cygwin and use the perlcc provided with that perl. Will that really
give me a WIN executable?
/j
James Willmore wrote:
>On Sun, 19 Oct 2003 15:14:22 -0400
>Jeff W <perlnews@kwcpa.com> wrote:
>
>> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but
>> i AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32
>> so I could write PC scripts and utilities. I downloaded ActivePerl
>> and looked at it. However, it appears that I would need a perl
>> installation on every target machine. Is there any easy, (and low
>> or zero cost) way to generate standalone Perl/Tk executables?
>
>In the land of *NIX, you could use perlcc to compile an application.
>In Windows land, you _may_ have to get a comercial application -or-
>use Cygwin, compile Perl, and then you _should_ have perlcc available
>to you.
>
>I can't speak from experience, but that's my understanding.
>
>HTH
>
>
>
------------------------------
Date: 19 Oct 2003 23:51:21 GMT
From: Tina Mueller <usenet@expires12.2003.tinita.de>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <bmv81p$rmq7c$1@ID-24002.news.uni-berlin.de>
Jeff W wrote:
> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
> could write PC scripts and utilities. I downloaded ActivePerl and
> looked at it. However, it appears that I would need a perl
> installation on every target machine. Is there any easy, (and low or
> zero cost) way to generate standalone Perl/Tk executables?
try out the PAR module, available on CPAN.
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://www.perlquotes.de/ \ \ _,_\ __/\ __/_| /__/ perception
-my address is currently unreachable due to the Swen.A virus-
------------------------------
Date: Sun, 19 Oct 2003 20:33:23 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <QaadnedPsP_PsA6iRVn-jw@comcast.com>
Thanks Tina - I had found that and tried to read through it - it didn't
seem easy to use by itself - also - I couldn't find a mention of it in
ActivePerl - which I thought would be necessary under win32
/j
Tina Mueller wrote:
>Jeff W wrote:
>> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
>> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
>> could write PC scripts and utilities. I downloaded ActivePerl and
>> looked at it. However, it appears that I would need a perl
>> installation on every target machine. Is there any easy, (and low or
>> zero cost) way to generate standalone Perl/Tk executables?
>
>try out the PAR module, available on CPAN.
>
>hth, tina
>
>
------------------------------
Date: Sun, 19 Oct 2003 17:59:21 -0700
From: astewart1@cox.net
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <hfc6pvc2u38mpbo1tml29ncs4jrabn2ihr@4ax.com>
On Sun, 19 Oct 2003 20:33:23 -0400, Jeff W <perlnews@kwcpa.com> wrote:
>Thanks Tina - I had found that and tried to read through it - it didn't
>seem easy to use by itself - also - I couldn't find a mention of it in
>ActivePerl - which I thought would be necessary under win32
>
>/j
>
>Tina Mueller wrote:
>
>>Jeff W wrote:
>>> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
>>> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
>>> could write PC scripts and utilities. I downloaded ActivePerl and
>>> looked at it. However, it appears that I would need a perl
>>> installation on every target machine. Is there any easy, (and low or
>>> zero cost) way to generate standalone Perl/Tk executables?
>>
>>try out the PAR module, available on CPAN.
>>
>>hth, tina
>>
>>
PAR is very easy to use. The "pp" command scans all the files needed
for your application, zips them up together and turns that into a
standalone executable. If the PAR documentation looks confusing,
concentrate on the description of pp.
You need the Perl installation to create packages, but the target
machines do not. PAR is not mentioned in ActivePerl because it is not
part of it. You can download PAR from CPAN, and even if ActiveState
has a version on its PPM server, it is probably out of date. PAR is
improving rapidly.
And it's free....
Alan Stewart
------------------------------
Date: Sun, 19 Oct 2003 21:43:12 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: How do I make a standalone WIN32 executable from Perl?
Message-Id: <ldidnZ3HjrUyoA6iRVn-uA@comcast.com>
thanks!!!! - And from someone with the same name as my favorite
Folk/Rock Artist 8-}
astewart1@cox.net wrote:
>On Sun, 19 Oct 2003 20:33:23 -0400, Jeff W <perlnews@kwcpa.com> wrote:
>
>>Thanks Tina - I had found that and tried to read through it - it didn't
>>seem easy to use by itself - also - I couldn't find a mention of it in
>>ActivePerl - which I thought would be necessary under win32
>>
>>/j
>>
>>Tina Mueller wrote:
>>
>>>Jeff W wrote:
>>>> Hi - Since I'm not a programmer, and OOP C++ is a bit beyond me, but i
>>>> AM a UNIX perl hacker, I was thinking of learning Perl/TK on WIN32 so I
>>>> could write PC scripts and utilities. I downloaded ActivePerl and
>>>> looked at it. However, it appears that I would need a perl
>>>> installation on every target machine. Is there any easy, (and low or
>>>> zero cost) way to generate standalone Perl/Tk executables?
>>>
>>>try out the PAR module, available on CPAN.
>>>
>>>hth, tina
>>>
>>>
>
>PAR is very easy to use. The "pp" command scans all the files needed
>for your application, zips them up together and turns that into a
>standalone executable. If the PAR documentation looks confusing,
>concentrate on the description of pp.
>
>You need the Perl installation to create packages, but the target
>machines do not. PAR is not mentioned in ActivePerl because it is not
>part of it. You can download PAR from CPAN, and even if ActiveState
>has a version on its PPM server, it is probably out of date. PAR is
>improving rapidly.
>
>And it's free....
>
>Alan Stewart
>
>
>
------------------------------
Date: Mon, 20 Oct 2003 10:21:54 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: HTML whitespace/commnets cruncher
Message-Id: <1228095.0vguEy4h5y@gregs-web-hosting-and-pickle-farming>
It was a dark and stormy night, and Garry Heaton managed to scribble:
> Can anyone recommend a perl script for crunching HTML whitespace and
> comments? I wish to make duplicates of HTML files for uploading.
>
> Garry Heaton
Would you believe I saw some code yesterday on the net that did this but now I cant find it.
The basic algorithm used regular expressions and was only a few lines long:
convert consecutive whitespace characters to single whitespace
remove whitespace from the beginning of lines
conver consecutive newlines to a single newline
gtoomey
------------------------------
Date: Mon, 20 Oct 2003 00:43:10 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Re: Newbie dumb but quick question
Message-Id: <ycGkb.1841$CE2.1826409@news2.news.adelphia.net>
"Jeff W" <perlnews@kwcpa.com> wrote in message
news:LP-dnRn2WqLlew-iRVn-jg@comcast.com...
> I found par and pp, but not as part of ActivePerl - am I missing
> something here - is this really an easy thing to do? (i want to write a
> phonebook program, and I'm not a professional programmer)
>
> thanks
> /j
>
> Bob X wrote:
>
> >"Jeff W" <perlnews@kwcpa.com> wrote in message
> >news:MpKdnXL9gt_mTg-iRVn-gA@comcast.com...
> >> Hi - I've been coming up on Perl at work in a UNIX environment.
> >> I downloaded Active Perl onto my PC to play with it there.
> >>
> >> Question: Is it possible to create WIN32 Perl scripts and
> >> "compile" them so that they will run places where Perl is
> >> not installed?
> >>
> >> Thanks
> >> /j
> >>
> >
> >Look at "Par"
> >
Use PPM and do a search for PAR. Get the latest. I use the latest 5.8.0 from
ActiveState and I have Par .75 installed. I have created exe files using it.
Be aware that even your 50K script will at about 1MB because of the Perl
files it needs to run independantly.
If you need more help let me know. : )
------------------------------
Date: 19 Oct 2003 17:55:33 -0700
From: kuujinbo@hotmail.com (ko)
Subject: Re: Newbie dumb but quick question
Message-Id: <92d64088.0310191655.3dae2907@posting.google.com>
Jeff W <perlnews@kwcpa.com> wrote in message news:<LP-dnRn2WqLlew-iRVn-jg@comcast.com>...
[snip to bottom]
> Bob X wrote:
>
> >"Jeff W" <perlnews@kwcpa.com> wrote in message
> >news:MpKdnXL9gt_mTg-iRVn-gA@comcast.com...
> >> Hi - I've been coming up on Perl at work in a UNIX environment.
> >> I downloaded Active Perl onto my PC to play with it there.
> >>
> >> Question: Is it possible to create WIN32 Perl scripts and
> >> "compile" them so that they will run places where Perl is
> >> not installed?
> >>
> >> Thanks
> >> /j
> >>
> >
> >Look at "Par"
> >
> I found par and pp, but not as part of ActivePerl - am I missing
> something here - is this really an easy thing to do? (i want to write a
> phonebook program, and I'm not a professional programmer)
>
> thanks
> /j
You need to install it using ActiveState's ppm program. From the Windows shell:
ppm
search par*
install par
'perldoc ppm' for all the details.
Also, please take a look at the posting guidelines for the group:
http://mail.augustmail.com/~tadmc/clpmisc.shtml
Top posting is not cool here...
HTH - keith
------------------------------
Date: Sun, 19 Oct 2003 21:42:13 -0400
From: Jeff W <jeffw5@kwcpa.com>
Subject: Re: Newbie dumb but quick question
Message-Id: <ldidnWLEjrXpoA6iRVn-uA@comcast.com>
Hi ko - I'd like to understand your comment here - but I don't know what
"top posting " is - could you fill me in? If I committed a faux pas I'd
like to understand it.
thanks
/j
ko wrote:
>Jeff W <perlnews@k
>
>Also, please take a look at the posting guidelines for the group:
>
>http://mail.augustmail.com/~tadmc/clpmisc.shtml
>
>Top posting is not cool here...
>
>HTH - keith
>
>
------------------------------
Date: 20 Oct 2003 01:55:20 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Newbie dumb but quick question
Message-Id: <slrnbp6g48.807.sholden@flexal.cs.usyd.edu.au>
On Sun, 19 Oct 2003 21:42:13 -0400, Jeff W <jeffw5@kwcpa.com> wrote:
> Hi ko - I'd like to understand your comment here - but I don't know what
> "top posting " is - could you fill me in? If I committed a faux pas I'd
> like to understand it.
Though it isn't labelled "top posting", see the section headed
"Use an effective followup style" in the guidelines at the URL you
were pointed in the previous message (which I've left below).
> ko wrote:
>
>>http://mail.augustmail.com/~tadmc/clpmisc.shtml
Note, this posting isn't an example of "top posting", your post was.
See the difference? :)
--
Sam Holden
------------------------------
Date: Sun, 19 Oct 2003 22:20:09 -0400
From: Jeff W <perlnews@kwcpa.com>
Subject: Re: Newbie dumb but quick question
Message-Id: <zt2dnYmRb8DK2w6iRVn-tQ@comcast.com>
Sam Holden wrote:
>Though it isn't labelled "top posting", see the section headed
>"Use an effective followup style" in the guidelines at the URL you
>were pointed in the previous message (which I've left below).
>
>
ok - got it - guess it's a personal style thing - i hate scrolling to
the bottom so I assume others do too.
Point noted.
/j
------------------------------
Date: Sun, 19 Oct 2003 21:14:00 -0400
From: Peter <feurry@hotmail.com>
Subject: retrieving info from file
Message-Id: <cFGkb.94017$PD3.5006234@nnrp1.uunet.ca>
i'm using the following line to try and extract some data from a file
($probe) =~ m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
This is the information i'm sorting through in the file.
crop area: X: 0..718 Y: 0..479 (-vop crop=718:480:0:0)
I want to get the 4 crop values 718, 480, 0, 0 all stored
in separate variables.
using
($probe) =~ m/\(-vop crop\=(\d+)/;
gets me the 718, but using the whole line at the top doesn't get me the
last 0
it also returns 718.. any idea how to get the other 3 values.
I really need the last 0.
Thanks
------------------------------
Date: 20 Oct 2003 01:20:42 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: retrieving info from file
Message-Id: <slrnbp6e3a.3iu.sholden@flexal.cs.usyd.edu.au>
On Sun, 19 Oct 2003 21:14:00 -0400, Peter <feurry@hotmail.com> wrote:
> i'm using the following line to try and extract some data from a file
>
> ($probe) =~ m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
>
> This is the information i'm sorting through in the file.
>
> crop area: X: 0..718 Y: 0..479 (-vop crop=718:480:0:0)
>
> I want to get the 4 crop values 718, 480, 0, 0 all stored
> in separate variables.
> using
> ($probe) =~ m/\(-vop crop\=(\d+)/;
> gets me the 718, but using the whole line at the top doesn't get me the
> last 0
> it also returns 718.. any idea how to get the other 3 values.
> I really need the last 0.
$1 == 780
$2 == 480
$3 == 0
$4 == 0
Will be true after the first regex sauccessfully matches, if the
sample line shown is in $probe.
The parenthesis around $probe are strange, so maybe you didn't paste you
real code and meant:
($probe) = m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
In which case:
You are only asking perl to keep the first value returned...
Try:
($probe, $x, $y, $z) = m/\(-vop crop=(\d+):(\d+):(\d+):(\d+)/;
Programming is far easier, if you try and understand why code does what
it does, instead of guessing.
--
Sam Holden
------------------------------
Date: Sun, 19 Oct 2003 21:42:15 -0400
From: Peter <feurry@hotmail.com>
Subject: Re: retrieving info from file
Message-Id: <H3Hkb.94022$PD3.5006324@nnrp1.uunet.ca>
>
> $1 == 780
> $2 == 480
> $3 == 0
> $4 == 0
>
> Will be true after the first regex sauccessfully matches, if the
> sample line shown is in $probe.
>
> The parenthesis around $probe are strange, so maybe you didn't paste you
> real code and meant:
>
> ($probe) = m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
>
> In which case:
>
> You are only asking perl to keep the first value returned...
>
> Try:
>
> ($probe, $x, $y, $z) = m/\(-vop crop=(\d+):(\d+):(\d+):(\d+)/;
>
> Programming is far easier, if you try and understand why code does what
> it does, instead of guessing.
>
i used the following
$probe =~ m/\(-vop crop\=(\d+):(\d+):(\d+):(\d+)/;
print "$1, $2, $3, $4\n";
and it worked perfectly. Thanks a lot for your help!
------------------------------
Date: Sun, 19 Oct 2003 20:39:06 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: retrieving info from file
Message-Id: <slrnbp6f5q.i0m.tadmc@magna.augustmail.com>
Peter <feurry@hotmail.com> wrote:
> i'm using the following line to try and extract some data from a file
>
> ($probe) =~ m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
^ ^
^ ^
Why do you have those parenthesis there?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 20 Oct 2003 01:50:45 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: retrieving info from file
Message-Id: <slrnbp6frl.807.sholden@flexal.cs.usyd.edu.au>
On Sun, 19 Oct 2003 21:42:15 -0400, Peter <feurry@hotmail.com> wrote:
> i used the following
> $probe =~ m/\(-vop crop\=(\d+):(\d+):(\d+):(\d+)/;
> print "$1, $2, $3, $4\n";
> and it worked perfectly. Thanks a lot for your help!
if ($probe =~ m/\(-vop crop\=(\d+):(\d+):(\d+):(\d+)/) {
print "$1, $2, $3, $4\n";
} else {
warn "Couldn't extract data from: $_";
}
or something to that effect.
Always check if the regex matched, otherwise old values of $1, etc. will
be used and hard to find bugs will result.
Yes, always.
And you don't need to escape '=', it's just a plain old character.
--
Sam Holden
------------------------------
Date: Sun, 19 Oct 2003 21:52:38 -0400
From: Peter <feurry@hotmail.com>
Subject: Re: retrieving info from file
Message-Id: <qdHkb.94028$PD3.5006451@nnrp1.uunet.ca>
Tad McClellan wrote:
> Peter <feurry@hotmail.com> wrote:
>
>
>>i'm using the following line to try and extract some data from a file
>>
>>($probe) =~ m/\(-vop crop\=(\d+)\:(\d+):(\d+):(\d+)/;
>
> ^ ^
> ^ ^
>
> Why do you have those parenthesis there?
>
>
My mistake...i didn't use them..sorry for the confusion!
------------------------------
Date: Mon, 20 Oct 2003 01:50:08 GMT
From: "sdfgsd" <sdfg@sdg.com>
Subject: Rookie: Constructing a large SQL INSERT statement
Message-Id: <kbHkb.185242$Of2.4682150@twister.tampabay.rr.com>
Disclaimer: I've googled and searched Perldoc/CPAN.
The format of the INSERT statement is:
INSERT INTO mytable (field_1, field_2, field_3)
VALUES (value_1, value_2, value_3),
(value_1, value_2, value_3),
(value_1, value_2, value_3),
(value_1, value_2, value_3),
etc. ;
In Delphi I just keep looping through the constrution process and keep
adding to a string variable like this:
sqlstatement := sqlstatement + newrow;
Is this the right approach to take in perl? Just keep adding to a scalar, or
would some sort of list/hash construct be better?
Thanks in advance,
JD
------------------------------
Date: Mon, 20 Oct 2003 12:26:19 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Rookie: Constructing a large SQL INSERT statement
Message-Id: <2722475.NeJRp8J92b@gregs-web-hosting-and-pickle-farming>
It was a dark and stormy night, and sdfgsd managed to scribble:
> Disclaimer: I've googled and searched Perldoc/CPAN.
>
> The format of the INSERT statement is:
>
> INSERT INTO mytable (field_1, field_2, field_3)
> VALUES (value_1, value_2, value_3),
> (value_1, value_2, value_3),
> (value_1, value_2, value_3),
> (value_1, value_2, value_3),
> etc. ;
>
> In Delphi I just keep looping through the constrution process and keep
> adding to a string variable like this:
>
> sqlstatement := sqlstatement + newrow;
>
> Is this the right approach to take in perl? Just keep adding to a scalar,
> or would some sort of list/hash construct be better?
>
> Thanks in advance,
> JD
Oracle does not have multi-row inserts; mysql does.
The perl equivalent to sqlstatement := sqlstatement + newrow is
$sqlstatement.= $newrow;
While this works, I would probably not insert more than a few dozen rows at once with each insert. I'm not sure on how big the buffers are in your DMBS.
gtoomey
------------------------------
Date: 20 Oct 2003 02:21:23 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: TIFF conversion with Image::Magick
Message-Id: <slrnbp6hl5.ppp.mgjv@verbruggen.comdyn.com.au>
[Note that none of this has anything at all to do with Perl, and is
only marginally related to the Image::Magick module. Maybe the
ImageMagick mailing list would be more appropriate]
\begin{offtopic}
On 17 Oct 2003 16:00:19 -0400,
Jesse Sheidlower <jester@panix.com> wrote:
>
> I've been sent some files in TIFF format, with each file
> supposedly consisting of several hundred small images
> in different "frames". Each file is about 750K or so.
Where did these images come from? What created them?
There is no "single" TIFF format. There are many ways in which a TIFF
file can be organised, and not all of those ways are supported by all
software.
The overall TIFF format does support multiple images in one file, but
I certainly wouldn't count on widespread support for that.
On the other hand, Image::Magick should be able to create and read
multi-frame TIFF files. This might just be an odd format that confuses
it. Or maybe the file is corrupted?
> First of all, I've tried to view these images in several
> programs, including xloadimage, the GIMP, GQView, and
> some others, and there's no indication that they contain
> anything more than a single image.
Any other programs you tried? Is there any software that can confirm
that this TIFF format is indeed readable by something else than what
created it?
> Second, and Perl-related, I've tried to convert these to PNG
> or some other format using Image::Magick, and it is not
> working. I used a very simple test script, that works on
> standard TIFF files, with the suggested approach of
>
> $x = $img->Read('image_A.tiff');
> warn $x if $x;
>
> $x = $img->Write('image_A.png');
> warn $x if $x;
>
> but when I run this, after about 30 seconds of working, I get
> a "Killed" response; it doesn't get to the first "warn" stage
> at all, let alone give me the nice error messages the docs
> promise. I get an identical response using "convert" on the
> commandline. I've looked through Martien's book with no luck.
(note that this is also not a Perl issue, but an ImageMagick issue)
That sounds to me like there is something not entirely clean with
those TIFF files, or that it's in some sort of format that
Image::Magick can't work with, but that looks like one that it thinks
it can work with.
If I were you, I'd send this to the ImageMagick mailing list, and
provide a link to one of those images, so people can have a look.
> Any suggestions for converting these files? Optimally
Not without knowing anything more than that they are "TIFF files".
\end{offtopic}
Martien
--
|
Martien Verbruggen | We are born naked, wet and hungry. Then
Trading Post Australia | things get worse.
|
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 5682
***************************************