[25633] in Perl-Users-Digest
Perl-Users Digest, Issue: 7875 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 10 14:05:36 2005
Date: Thu, 10 Mar 2005 11:05:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Mar 2005 Volume: 10 Number: 7875
Today's topics:
Re: [perl-python] a program to delete duplicate files P@draigBrady.com
Re: [perl-python] a program to delete duplicate files <tzot@sil-tec.gr>
A versus An (programatically) <google.20.schubach@spamgourmet.com>
Re: A versus An (programatically) <glex_nospam@qwest.invalid>
code and messages <me@nowehere.com>
Re: code and messages <spamtrap@dot-app.org>
Re: DBI and Microsoft Access <lv@aol.com>
Faster way to execute contents of a perl script? <bhoppe@ti.com>
Re: Faster way to execute contents of a perl script? <jgibson@mail.arc.nasa.gov>
Re: Faster way to execute contents of a perl script? (Walter Roberson)
Re: FCNTL in perl (Roach4)
Re: FCNTL in perl <stampes@xilinx.com>
Re: FCNTL in perl <tassilo.von.parseval@rwth-aachen.de>
Formatting a single line without effecting the entire t <lynn.watts@ugs.com>
gtk + png <mbosowo@gmail.com>
gtk2 + png <mbosowo@gmail.com>
Re: include external perl program alythh@netscape.net
Re: include external perl program alythh@netscape.net
Re: multidimensional hash modified by test xhoster@gmail.com
Re: One Liner to reverse sort file <don.hoggatt@pbsg.com>
Re: Perl DBI does not print error. xhoster@gmail.com
Re: Perl DBI does not print error. <sam.wun@authtec.com>
Tk - Displaying an image and selecting a regio of inter (Thommes)
Re: Tk - Displaying an image and selecting a regio of i <notvalid@email.com>
Re: Tk - Displaying an image and selecting a regio of i <wh@tever.tld>
Re: Using dot commands in a script <matternc@comcast.net>
Re: Using dot commands in a script <danfperl@yahoo.com>
Re: Using dot commands in a script <1usa@llenroc.ude.invalid>
Re: Using dot commands in a script <news@chaos-net.de>
Re: Using dot commands in a script <tony_curtis32@yahoo.com>
Re: Using dot commands in a script <news@chaos-net.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 10 Mar 2005 17:23:28 +0000
From: P@draigBrady.com
Subject: Re: [perl-python] a program to delete duplicate files
Message-Id: <42308290.5020801@draigBrady.com>
I've written a python GUI wrapper around some shell scripts:
http://www.pixelbeat.org/fslint/
the shell script logic is essentially:
exclude hard linked files
only include files where there are more than 1 with the same size
print files with matching md5sum
Pádraig.
------------------------------
Date: Thu, 10 Mar 2005 19:30:54 +0200
From: Christos "TZOTZIOY" Georgiou <tzot@sil-tec.gr>
Subject: Re: [perl-python] a program to delete duplicate files
Message-Id: <3201315gotmtqqm0cvp85dvoit92knfutq@4ax.com>
On Thu, 10 Mar 2005 10:54:05 +0100, rumours say that Patrick Useldinger
<pu.news.001@gmail.com> might have written:
>I wrote something similar, have a look at
>http://www.homepages.lu/pu/fdups.html.
That's fast and good.
A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux).
Have you found any way to test if two files on NTFS are hard linked without
opening them first to get a file handle?
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
------------------------------
Date: 10 Mar 2005 08:24:52 -0800
From: "bernard" <google.20.schubach@spamgourmet.com>
Subject: A versus An (programatically)
Message-Id: <1110471892.953759.327430@l41g2000cwc.googlegroups.com>
Hi,
Does anyone know of a way to allow Perl to determine whether a word
would require the indefinite article 'a' or 'an'. Looking at style
guides, such as the one found at:
http://owl.english.purdue.edu/handouts/esl/esliart.html
we see that it is NOT as simple as just looking for an aeiou at the
beginning of a word.
The reason I want to do this is because I am pulling a noun from a
database and want my program to be able to determine what article to
use with it. In theory, I could add a column to the table that
indicates which article is appropriate. But I was wondering if there
was a more flexible solution, perhaps based on some sort of phoenetic
routine.
Bernard.
------------------------------
Date: Thu, 10 Mar 2005 10:49:40 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: A versus An (programatically)
Message-Id: <EU_Xd.10$lf4.291@news.uswest.net>
bernard wrote:
> Hi,
>
> Does anyone know of a way to allow Perl to determine whether a word
> would require the indefinite article 'a' or 'an'. Looking at style
Lingua::EN::Inflect
http://search.cpan.org/~dconway/Lingua-EN-Inflect-1.88/lib/Lingua/EN/Inflect.pm
------------------------------
Date: Thu, 10 Mar 2005 20:18:06 +0200
From: Me <me@nowehere.com>
Subject: code and messages
Message-Id: <DMadnYiDZ8GxEq3fRVn-gQ@is.co.za>
I recently started coding with perl again after a rather long spell with
python and php. On one of the long running php projects (with people
always changing their minds) that I worked, all the error messages that
were visible to the end user were configurable. This was to meant avoid
coding when messages needed to be changed. Even the email messages were
configurable. The solution was not a neat one, and was at times a
headache to maintain (and thats putting it mildly).
What I would to find out is not neccesarily perl specific. But, perl is
what I am focusing on. What tools/methods are available to allow for
separation of "visible end user text" and code? I currently use template
to seperate code from design, that is not what I am looking for?
Taking it a step further, would be to say can I also get translation as
well so that messages are not just in English? This is just a nice to have.
Any suggestions? Comments?
------------------------------
Date: Thu, 10 Mar 2005 14:04:55 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: code and messages
Message-Id: <9-mdnbwvR8rKB63fRVn-vg@adelphia.com>
Me wrote:
> Taking it a step further, would be to say can I also get translation as
> well so that messages are not just in English?
In C that's often done with gettext. There's a Gettext module on CPAN, but
it looks to be abandoned - the last update was in 2000.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Thu, 10 Mar 2005 10:47:48 -0600
From: l v <lv@aol.com>
Subject: Re: DBI and Microsoft Access
Message-Id: <42307ae6$1_2@127.0.0.1>
nathaniel_welch@hotmail.com wrote:
> I need some help with connecting to a Microsoft Access database using
> DBI. My files are stored on a remote server. I really don't have any
> clue why I can't make this work. The error I get really has me
> confused as well. I tried the following (where recruit is the DSN
> name):
>
> use DBI;
> print "Content-type:text/html\n\n";
> print "<html><head><title>Test Page</title></head><body>";
> print "test1<br><br>";
> $dbh = DBI->connect("dbi:ODBC:recruit");
> print "test2</body></html>";
> exit;
>
> and the error I get is: "CGI Error The specified CGI application
> misbehaved by not returning a complete set of HTTP headers.".
>
> I also tried using a DSN less connection, but got the same error.
>
> This exact code works fine in my old environment, but will not work
> here. I checked and the DBI module is installed, so that's not the
> problem.
>
> Any help would be GREATLY appreciated!
>
> Thanks,
> Nate
>
What happens when you remove $dbh = DBI->connect("dbi:ODBC:recruit");
from your code?
Len
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
------------------------------
Date: Thu, 10 Mar 2005 11:58:31 -0600
From: Brandon Hoppe <bhoppe@ti.com>
Subject: Faster way to execute contents of a perl script?
Message-Id: <d0q1s7$1h9$1@home.itg.ti.com>
Hi,
I'm trying to find a faster way to do this. Right now I have a perl script that contains
function definitions. I have second perl script that contains calls to these functions.
Now the first perl script will execute the second perl script hundreds of times, in order
to call these functions.
So I have a loop that repeatadly changes global variables and then executes the second
perl script with a do $file; call.
This works and all, but its not very fast. It takes about 1 1/2 seconds to execute the
second script, so over hundreds of runs, you can see why it takes forever.
I was wondering if there's a faster way to repeatedly re-call all these functions. Like
reading the second script into an array and then "executing" the array. I doubt this is
possible but I was thinking something along this line, to get the file into memory to
execute over and over again which should be faster than to be reading from disk everytime.
Brandon
------------------------------
Date: Thu, 10 Mar 2005 10:16:05 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Faster way to execute contents of a perl script?
Message-Id: <100320051016052216%jgibson@mail.arc.nasa.gov>
In article <d0q1s7$1h9$1@home.itg.ti.com>, Brandon Hoppe
<bhoppe@ti.com> wrote:
> Hi,
>
> I'm trying to find a faster way to do this. Right now I have a perl script
> that contains
> function definitions. I have second perl script that contains calls to these
> functions.
>
> Now the first perl script will execute the second perl script hundreds of
> times, in order
> to call these functions.
>
> So I have a loop that repeatadly changes global variables and then executes
> the second
> perl script with a do $file; call.
>
> This works and all, but its not very fast. It takes about 1 1/2 seconds to
> execute the
> second script, so over hundreds of runs, you can see why it takes forever.
>
> I was wondering if there's a faster way to repeatedly re-call all these
> functions. Like
> reading the second script into an array and then "executing" the array. I
> doubt this is
> possible but I was thinking something along this line, to get the file into
> memory to
> execute over and over again which should be faster than to be reading from disk everytime.
There is no need to repeatedly 'do' the second file containing
subroutines. After this has been done once, the subroutines may be
called multiple times by name. Just make sure all of the code you wish
to execute is really in a subroutine and not on the main branch in the
second file.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: 10 Mar 2005 18:36:10 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Faster way to execute contents of a perl script?
Message-Id: <d0q42q$dkk$1@canopus.cc.umanitoba.ca>
In article <d0q1s7$1h9$1@home.itg.ti.com>,
Brandon Hoppe <bhoppe@ti.com> wrote:
:I'm trying to find a faster way to do this. Right now I have a perl script that contains
:function definitions. I have second perl script that contains calls to these functions.
:Now the first perl script will execute the second perl script hundreds of times, in order
:to call these functions.
:So I have a loop that repeatadly changes global variables and then executes the second
:perl script with a do $file; call.
Don't do that. Use 'use' instead to bring the functionality in once, and then
just call upon the routines at need. Don't worry, the global variable values that
will be picked up will be those at execution time, not those at compile time.
Read the documentation on 'use'; also I suggest you might as well go as far as
formatting it into a "module" -- perldoc perlmod
--
"This was a Golden Age, a time of high adventure, rich living and
hard dying... but nobody thought so." -- Alfred Bester, TSMD
------------------------------
Date: 10 Mar 2005 06:19:56 -0800
From: dbelleisle@morphidae.com (Roach4)
Subject: Re: FCNTL in perl
Message-Id: <46200f9b.0503100619.2cdf559e@posting.google.com>
Hi again,
I asked help about FCNTL because I don't have the choice of what I
want to use to monitor.
So anyone could give me a hand with it??
Thanks,
David
"Robin" <webmaster @ infusedlight.net> wrote in message news:<a8KdnTXpCYzvDLLfRVn-2Q@comcast.com>...
> "Roach4" <dbelleisle@morphidae.com> wrote in message
> news:46200f9b.0503091143.4de56d6a@posting.google.com...
> > Hi,
> >
> > I'm new to perl and I've to monitor a DIRECTORY for changes in it
> > using the FCNTL module in perl.
> >
> > Anyone could give me a hand by posting examples or hints on how I
> > could be able to do that?
> >
> >
> > Thank you very much,
> >
> > David
>
> please try something simpler like running a chdir ("$yourdir"); command,
> forget those double quotes though.
------------------------------
Date: Thu, 10 Mar 2005 08:13:54 -0700
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: FCNTL in perl
Message-Id: <d0po7j$hf53@xco-news.xilinx.com>
Roach4 wrote:
> I asked help about FCNTL because I don't have the choice of what I
> want to use to monitor.
>
> So anyone could give me a hand with it??
Why the Chinese character encoding?
You've read 'perldoc -f fcntl'?
You've read 'perldoc Fcntl'?
You've read 'man fcntl' on your system?
What do you specifically have questions with?
What have you tried and how did it fail?
~Jeff
"He looked at me and said,
'How exactly is it I can help you sir?'
I just bought some nails,
and got the Hell out of there" - Tim O'Brien
------------------------------
Date: Thu, 10 Mar 2005 16:28:34 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: FCNTL in perl
Message-Id: <slrnd30pt2.16n.tassilo.von.parseval@localhost.localdomain>
Also sprach Roach4:
> I'm new to perl and I've to monitor a DIRECTORY for changes in it
> using the FCNTL module in perl.
>
> Anyone could give me a hand by posting examples or hints on how I
> could be able to do that?
That's not much different from how you'd do it in C:
use Fcntl qw/F_NOTIFY DN_CREATE DN_ACCESS/;
$SIG{IO} = sub { print "creation or access happened\n"; };
open DIR, "/tmp/." or die $!;
fcntl DIR, F_NOTIFY, DN_CREATE|DN_ACCESS or die $!;
# /tmp is now being watched for DN_CREATE and DN_ACCESS
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
------------------------------
Date: Thu, 10 Mar 2005 10:18:56 -0800
From: "Mothra" <lynn.watts@ugs.com>
Subject: Formatting a single line without effecting the entire table with the Text::Table module
Message-Id: <42308ebe$1@usenet.ugs.com>
Hi All,
I have a data structure (see script) that I need to printout. I almost have
what I
need but I cannot figure out how to format just one line (center it )
sample output is:
kreimer
EMMI CHRISTIAN 0 0 17
TRACEY LUSBY 0 4 0
TONA MCGEAN 0 7 0
Total: 0 11 17
What I would like is the word "kreimer" centered and the other names
remain left justified. What am I doing wrong?
Thanks
Lynn
----------script--------------
use strict;
use warnings;
use Text::Table;
use diagnostics;
use Data::Dumper;
my $people = {
'kreimer' => {
'TRACEY LUSBY' => [ 0, 4, 0 ],
'EMMI CHRISTIAN' => [ 0, 0, 17 ],
'TONA MCGEAN' => [ 0, 7, 0 ],
},
'OTHER' => {
'STEPHEN ESPESET' => [ undef, 4, 27 ],
'PATRICK HOONHOU' => [ 1, 3, 4 ],
'WOODROW WILSON' => [ undef, 2, 1 ],
},
'lusby' => {
'KEVIN FLUETSCH' => [ 0, 0, 22 ],
'DOUG BOSWORTH' => [ 0, 1, 6 ],
'DOUG PENICK' => [ 1, 2, 22 ],
},
};
foreach my $tmp_people( values %{ $people->{'OTHER'} } ) {
if ( !defined( $tmp_people->[0] ) ) { $tmp_people->[0] = 0 }
if ( !defined( $tmp_people->[1] ) ) { $tmp_people->[1] = 0 }
if ( !defined( $tmp_people->[2] ) ) { $tmp_people->[2] = 0 }
}
my %manager_total = ();
foreach my $managers( keys %{$people} ) {
foreach my $person( keys %{ $people->{$managers} } ) {
$manager_total{$managers}[0] += $people->{$managers}->{$person}[0];
$manager_total{$managers}[1] += $people->{$managers}->{$person}[1];
$manager_total{$managers}[2] += $people->{$managers}->{$person}[2];
}
}
my $tb = Text::Table->new(
{
title => 'Name',
align => 'left',
align_title => 'center'
},
{
title => 'Last Month',
align => 'center',
align_title => 'center'
},
{
title => 'YTD',
align => 'center',
align_title => 'center'
},
{
title => 'Rolling 12 months',
align => 'center',
align_title => 'center'
},
);
#print Dumper (\%manager_total);
foreach my $managers( keys %{$people} ) {
$tb->add($managers);
foreach my $person( sort Mysort keys %{ $people->{$managers} } ) {
$tb->add( "$person", @{ $people->{$managers}->{$person} } );
}
$tb->add( "Total: ", @{ $manager_total{$managers} } );
$tb->add();
}
print $tb;
sub Mysort {
my ( undef, $first ) = split ( / /, $a );
my ( undef, $last ) = split ( / /, $b );
$first cmp $last;
}
------------------------------
Date: 10 Mar 2005 09:45:33 -0800
From: "mboso" <mbosowo@gmail.com>
Subject: gtk + png
Message-Id: <1110476733.699295.35850@f14g2000cwb.googlegroups.com>
I'm writing a gtk-perl application that will allow users to load a an
image into a window, write text over than image, then save the result
as a *png file.
I was wondering what widgets would best be suited for this task. I'm
currently looking through gtk+ documentation for suitable widgets, but
I thought I would ask here as well.
Mboso
My apologies if this was posted twice. I received an error for the
first one.
------------------------------
Date: 10 Mar 2005 08:34:01 -0800
From: "mboso" <mbosowo@gmail.com>
Subject: gtk2 + png
Message-Id: <1110472441.851194.42360@o13g2000cwo.googlegroups.com>
I'm thinking of writing a gtk2-perl app where a user can load a
background image into a window, write text onto that background, then
save the resulting image as a *jpg or *png file.
I was just wondering if anyone had any general idea on how to approach
this. While looking at the gtk+ documentation
http://developer.gnome.org/doc/API/2.0/gtk/, for suitable widgets, it
occurred to ask here as well.
I apologize for not having more specifics, but I'm still very much in
the brainstorming phase of this project.
Thanks
mboso
------------------------------
Date: 10 Mar 2005 08:40:23 -0800
From: alythh@netscape.net
Subject: Re: include external perl program
Message-Id: <1110472823.485204.39780@g14g2000cwa.googlegroups.com>
good hint Tad,
but I found it slightly irritating in a point: the article dismisses
any possible use of "local".
It happens instead that I often find it very useful. The typical
situation is where a variable globally visible keeps some kind of
"current state". This var is continuously modified at runtime, but you
have to restore its value when any given function exits (isnt'it called
also dynamical scoping?).
------------------------------
Date: 10 Mar 2005 08:40:49 -0800
From: alythh@netscape.net
Subject: Re: include external perl program
Message-Id: <1110472849.873353.264770@o13g2000cwo.googlegroups.com>
good hint Tad,
but I found it slightly irritating in a point: the article dismisses
any possible use of "local".
It happens instead that I often find it very useful. The typical
situation is where a variable globally visible keeps some kind of
"current state". This var is continuously modified at runtime, but you
have to restore its value when any given function exits (isnt'it called
also dynamical scoping?).
------------------------------
Date: 10 Mar 2005 14:41:43 GMT
From: xhoster@gmail.com
Subject: Re: multidimensional hash modified by test
Message-Id: <20050310094143.386$wr@newsreader.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> > >
> > but this works
> > print "NOT IN HASH\n" unless exists $data{b} && $data{b}{b};
> > although perhaps there is a better way.
>
> You need "exists" in front of "$data{b}{b}" too.
True, but....
> As written, it will
> still autovivify $data{ b}->{ b} if only $data{ b} exists.
$data{ b}->{ b} is not used in a hashref-like context, so there is nothing
to autovivify, whether the "exists" is added or not.
> Also, it
> will fail (claim nonexistence) if $data{ a}->{ a} is defined but false.
Yes, that is true.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 10 Mar 2005 06:46:17 -0800
From: "hogg" <don.hoggatt@pbsg.com>
Subject: Re: One Liner to reverse sort file
Message-Id: <1110465977.136332.62810@o13g2000cwo.googlegroups.com>
That works perfect. Thanks for everyone that replied.
------------------------------
Date: 10 Mar 2005 14:51:30 GMT
From: xhoster@gmail.com
Subject: Re: Perl DBI does not print error.
Message-Id: <20050310095130.511$rs@newsreader.com>
sam <sam.wun@authtec.com> wrote:
> Hi,
>
> The perl DBI does not prints error message:
> $sth = $dbh->prepare($insert_sql)
> || print ERRFILE_OUT "prepare: $insert_sql: $DBI::errstr";
>
> The out of this error only does not print why the error was occurred.
> eg.
> Unable to execute query: DBI::db=HASH(0x8647df0)->errstr:
It is not clear whether this is what you want but for some reason you
aren't getting it, or if this is what you get and it is for some reason not
suitable.
It is hard to believe it is really either of those, as the error message
you give does not seem to be generated by the code snippet you give and
there is no reason to expect that it would be.
> Dan anyone please tell me how to prints how a description of the error
> from DBI when sql executed failed?
I'm not sure why you would expect an *execution* failure to occur in a
*prepare* method.
In my hands, I turn on RaiseError and it just works. No magic incantations
are necessary.
Given the almost complete absense of context you provide, it is hard to be
more helpful than that.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 11 Mar 2005 00:22:54 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Perl DBI does not print error.
Message-Id: <d0ptsd$2nfp$1@news.hgc.com.hk>
xhoster@gmail.com wrote:
> sam <sam.wun@authtec.com> wrote:
>
>>Hi,
>>
>>The perl DBI does not prints error message:
>>$sth = $dbh->prepare($insert_sql)
>> || print ERRFILE_OUT "prepare: $insert_sql: $DBI::errstr";
>>
>>The out of this error only does not print why the error was occurred.
>>eg.
>>Unable to execute query: DBI::db=HASH(0x8647df0)->errstr:
>
>
> It is not clear whether this is what you want but for some reason you
> aren't getting it, or if this is what you get and it is for some reason not
> suitable.
>
> It is hard to believe it is really either of those, as the error message
> you give does not seem to be generated by the code snippet you give and
> there is no reason to expect that it would be.
>
>
>>Dan anyone please tell me how to prints how a description of the error
>>from DBI when sql executed failed?
>
>
> I'm not sure why you would expect an *execution* failure to occur in a
> *prepare* method.
>
> In my hands, I turn on RaiseError and it just works. No magic incantations
> are necessary.
>
> Given the almost complete absense of context you provide, it is hard to be
> more helpful than that.
>
Hi,
Do you have any example?
The following is a copy of the sample code that does not print out DBI
error:
#!/usr/bin/perl
use DBI;
# connect using to the database named $database using given
# username and password, return a database handle
$database = "mydb";
$username = "me";
$pw = "mypass";
$dbh = DBI->connect("DBI:mysql:$database",$username,$pw);
die "Unable to connect: $DBI::errstr\n" unless (defined $dbh);
$sth = $dbh->prepare(q{SELECT * from customer}) or die "Unable to prep
our query:".$dbh->errstr."\n";
$rc = $sth->execute or die "Unable to execute our query:".$dbh->errstr."\n";
while ($aref = $sth->fetchrow_arrayref){
for ($i=0; $i < $sth->{NUM_OF_FIELDS};$i++){
print $sth->{NAME}->[$i].": " . $aref->[$i] . "\n";
}
}
# tells server you will not need more data from statement handle
# (optional, since we're just about to disconnect)
$sth->finish;
# disconnects handle from database
$dbh->disconnect;
Thanks
sam
> Xho
>
------------------------------
Date: 10 Mar 2005 07:54:32 -0800
From: thommes3000@lycos.de (Thommes)
Subject: Tk - Displaying an image and selecting a regio of interest
Message-Id: <4dad0f2f.0503100754.6efb9e20@posting.google.com>
Hello eveyone,
I'm new to Tk.
I want my script to display an image on the screen, then I want the
user to be able to draw a rectangluar region of interest into the
image. I want the script to return the coordiantes of this ROI.
Is there an easy way to solve this problem or is there a good
tutorial?
Thanks very much for your help,
Thommes
------------------------------
Date: Thu, 10 Mar 2005 17:40:24 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: Tk - Displaying an image and selecting a regio of interest
Message-Id: <cE%Xd.16216$OU1.13645@newssvr21.news.prodigy.com>
Thommes wrote:
> Hello eveyone,
>
> I'm new to Tk.
> I want my script to display an image on the screen, then I want the
> user to be able to draw a rectangluar region of interest into the
> image. I want the script to return the coordiantes of this ROI.
> Is there an easy way to solve this problem or is there a good
> tutorial?
I would use a Canvas object, and plot your image onto it. Then, you can
draw rectangles by binding mouse buttons and motion. You can find some
helpful examples at:
www.perltk.org/articles/index.htm
Also, there is a newsgroup dedicated to Perl/Tk. Please post any
Tk-related questions to comp.lang.perl.tk.
--Ala
------------------------------
Date: Thu, 10 Mar 2005 17:55:38 +0000
From: Octo Mancer <wh@tever.tld>
Subject: Re: Tk - Displaying an image and selecting a regio of interest
Message-Id: <pan.2005.03.10.17.55.38.83668@tever.tld>
On Thu, 10 Mar 2005 07:54:32 -0800, Thommes wrote:
> Hello eveyone,
>
> I'm new to Tk.
> I want my script to display an image on the screen, then I want the user
> to be able to draw a rectangluar region of interest into the image. I want
> the script to return the coordiantes of this ROI. Is there an easy way to
> solve this problem or is there a good tutorial?
>
> Thanks very much for your help,
> Thommes
You would probably be better off asking this in comp.lang.perl.tk
Rich
------------------------------
Date: Thu, 10 Mar 2005 09:43:59 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Using dot commands in a script
Message-Id: <Sc6dnQqKHPmtwK3fRVn-sw@comcast.com>
Dan wrote:
> 3. I didn't put warnings & strict lines to keep verbiage down. I went
> with the bare minimum to reproduce the problem.
use warnings and use strict are never excess verbiage, most of all
when you're debugging a problem. Stripping the problem down to the
minimum is great; far too few people who come here with problems do
that. But you can leave use warnings and use strict in. It lets
people know that are you attempting to let Perl tell you what the
problem is, and the people who run your sample script to analyze your
problem are going to want to know what use warnings and use strict might
or might not tell them.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 10 Mar 2005 07:05:40 -0800
From: "Dan" <danfperl@yahoo.com>
Subject: Re: Using dot commands in a script
Message-Id: <1110467140.529604.84330@z14g2000cwz.googlegroups.com>
Hm - I replied earlier and it doesn't seem to have shown up. Forgive
me if this repeats but here are a few notes.
1. Martin's suggestion to use system('/usr/bin/ksh /tmp/test.env') or
system('/tmp/test.env') executes successfully but doesn't persist the
value of $BLAH because of the parent/child shell Tony wrote about.
2. I'm becoming resigned to using Martin's suggestion of going through
the file line by line and assiging from there, but I don't think that's
as clean a solution as a single line to load everything on the file at
once.
3. I didn't include strict & warnings because I wanted the least
amount of scripting to reproduce the problem.
------------------------------
Date: Thu, 10 Mar 2005 15:38:05 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Using dot commands in a script
Message-Id: <Xns96156C2E8967Fasu1cornelledu@127.0.0.1>
"Dan" <danfperl@yahoo.com> wrote in news:1110467140.529604.84330
@z14g2000cwz.googlegroups.com:
> Hm - I replied earlier and it doesn't seem to have shown up.
Be patient on the UseNet, please.
> 3. I didn't include strict & warnings because I wanted the least
> amount of scripting to reproduce the problem.
There is never, _never_, a good reason to omit strict and warnings when
posting here.
Doing so allows us to see that you have taken care of obvious errors which
perl helpfully points out.
Sinan.
------------------------------
Date: Thu, 10 Mar 2005 18:48:00 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Using dot commands in a script
Message-Id: <slrnd3122g.9do.news@maki.homeunix.net>
Tony Curtis wrote :
>>> On Thu, 10 Mar 2005 14:54:30 +0100,
>>> Martin Kissner <news@chaos-net.de> said:
>
>> This works in perl skripts, too. If shell variables are
>> exported, they are accessible from the environment of
>> subsequently executed commands.
>
> Different situation. Here, perl inherits the environment from
> its parent (zsh). In the OP's case, there is only a transient
> child Bourne shell.
Ah; yes, of course you are right. Thank you for catching this.
In the OP's case the ksh-script would have to run *before* the perls
script is executed, but maybe this is not desired.
shell> /tmp/test.env && myperlscript.pl
should work, but the variables are still set, after the perlscript is
done.
Best regards
Martin
--
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
.114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
s{sleep 1};sub p(){print "@_"}'
------------------------------
Date: Thu, 10 Mar 2005 12:00:55 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Using dot commands in a script
Message-Id: <87fyz3nzxk.fsf@limey.hpcc.uh.edu>
>> On Thu, 10 Mar 2005 18:48:00 +0100,
>> Martin Kissner <news@chaos-net.de> said:
> In the OP's case the ksh-script would have to run *before*
> the perls script is executed, but maybe this is not desired.
shell> /tmp/test.env && myperlscript.pl
> should work, but the variables are still set, after the
> perlscript is done.
Not your day, is it? :-)
This also has the same child process "problem".
Parsing the shell script in perl, or wrapping the source'ing &
perl up in a ksh script are the 2 simplest solutions (IMHO).
------------------------------
Date: Thu, 10 Mar 2005 19:23:25 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Using dot commands in a script
Message-Id: <slrnd3144t.9do.news@maki.homeunix.net>
Tony Curtis wrote :
>>> On Thu, 10 Mar 2005 18:48:00 +0100,
>>> Martin Kissner <news@chaos-net.de> said:
>
>> In the OP's case the ksh-script would have to run *before*
>> the perls script is executed, but maybe this is not desired.
>
> shell> /tmp/test.env && myperlscript.pl
>
>> should work, but the variables are still set, after the
>> perlscript is done.
>
> Not your day, is it? :-)
>
> This also has the same child process "problem".
Aargh.
I wanted to write
shell> . /tmp/test.env && myperlscript.pl
This is the place where the '.'-command is useful (and indispensible).
Sorry for not concentrating.
Best regards
Martin
--
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
.114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
s{sleep 1};sub p(){print "@_"}'
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7875
***************************************