[30379] in Perl-Users-Digest
Perl-Users Digest, Issue: 1622 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 9 09:09:48 2008
Date: Mon, 9 Jun 2008 06:09:05 -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 Mon, 9 Jun 2008 Volume: 11 Number: 1622
Today's topics:
Re: FAQ 4.14 How can I compare two dates and find the d <szrRE@szromanMO.comVE>
Re: FAQ 5.14 How can I translate tildes (~) in a filena <ben@morrow.me.uk>
Re: FAQ 5.28 How can I read in an entire file all at on <bill@ts1000.us>
Re: FAQ 5.28 How can I read in an entire file all at on <m@rtij.nl.invlalid>
Re: FAQ 5.38 How do I select a random line from a file? <danrumney@warpmail.new>
Re: Few questions about arguments and subroutines/modul <telemach@go2.pl>
Re: How to find memory leak in perl server <whynot@pozharski.name>
new CPAN modules on Mon Jun 9 2008 (Randal Schwartz)
Re: Order of operations <jurgenex@hotmail.com>
Parsing an AVI to determine the length in time marcelo.ebay.1970@gmail.com
Re: Parsing an AVI to determine the length in time <noreply@gunnar.cc>
Re: Perl grep and Perl 4 <szrRE@szromanMO.comVE>
Re: Set breakpoint at a file/class in debugger <Peter@PSDT.com>
Re: Tk with Thread <slick.users@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 8 Jun 2008 22:00:24 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: FAQ 4.14 How can I compare two dates and find the difference?
Message-Id: <g2idd801pm3@news4.newsguy.com>
David Combs wrote:
> In article <g09snv029d0@news4.newsguy.com>, szr
> <szrRE@szromanMO.comVE> wrote:
>> Philluminati wrote:
>>> On May 12, 8:03 am, PerlFAQ Server <br...@stonehenge.com> wrote:
>> [...]
>>>> These postings aim to reduce the number of repeated questions
>>>> as well as allow the community to review and update the answers.
>> [...]
>>> Honestly, what is the point of posting this?
>>
>> You quoted the answer to your own question. If you don't want to read
>> them (which would be your loss), then skip and move on to what you
>> prefer to read.
>>
>> --
>> szr
>>
>>
>
> And I repeat an earlier comment -- GET YOURSELF A DECENT NEWSREADER,
> and with it FOREVER CONSIGN these faq-posts to your own bit-bucket.
>
> Just because YOU don't like something doesn't mean that YOU get
> to deprive everyone else of it!
>
>
> And about "decent newsreaders", the said delete-these-subjects
> features are DESIGNED for use by people precicely like you --
> so GET ONE AND USE IT, and your life here on clpm will be
> far happier.
I think you meant to reply to Philluminati, and not me?
--
szr
------------------------------
Date: Sun, 8 Jun 2008 23:07:20 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 5.14 How can I translate tildes (~) in a filename?
Message-Id: <op1uh5-dvp.ln1@osiris.mauzo.dyndns.org>
Quoth "Peter J. Holzer" <hjp-usenet2@hjp.at>:
> On 2008-06-08 14:19, Michael Carman <mjcarman@mchsi.com> wrote:
> > PerlFAQ Server wrote:
> >> Older versions of Perl require that you have a shell installed that
> >> groks tildes. Recent perl versions have this feature built in.
> >
> > Can anyone here quantify "older" and "recent?"
>
> I *think* this was changed in perl 5.6.0.
So does perldoc File::Glob, and git://utsl.gen.nz/perl says that
5.005_04 still called csh (or other things, on other platforms).
Ben
--
"Faith has you at a disadvantage, Buffy."
"'Cause I'm not crazy, or 'cause I don't kill people?"
"Both, actually."
[ben@morrow.me.uk]
------------------------------
Date: Sun, 8 Jun 2008 15:48:22 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: FAQ 5.28 How can I read in an entire file all at once?
Message-Id: <bdbc1c21-864f-4f6b-a10b-23b246187f18@m73g2000hsh.googlegroups.com>
> =A0 =A0 The customary Perl approach for processing all the lines in a file=
is to
> =A0 =A0 do so one line at a time:
>
> =A0 =A0 =A0 =A0 =A0 =A0 open (INPUT, $file) =A0 =A0 || die "can't open $fi=
le: $!";
> =A0 =A0 =A0 =A0 =A0 =A0 while (<INPUT>) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 chomp;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # do something with $_
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 =A0 =A0 close(INPUT) =A0 =A0 =A0 =A0 =A0 =A0|| die "can't =
close $file: $!";
>
I recently had to rework a program that used the above method in many
places to load in small files (100 lines or so) containing product
information, sales tax, ect. for a simple cart because a high placed
security firm that was overseeing the project felt that the above
method caused too much lag on servers and a possible collision with
users. Not wanting to argue I followed their advice and replaced it
with the @lines =3D <INPUT> method shown below. Not that it matters now,
but did they have a valid point?
> =A0 =A0 This is tremendously more efficient than reading the entire file i=
nto
> =A0 =A0 memory as an array of lines and then processing it one element at =
a
> =A0 =A0 time, which is often--if not almost always--the wrong approach. Wh=
enever
> =A0 =A0 you see someone do this:
>
> =A0 =A0 =A0 =A0 =A0 =A0 @lines =3D <INPUT>;
>
> =A0 =A0 you should think long and hard about why you need everything loade=
d at
> =A0 =A0 once. It's just not a scalable solution. You might also find it mo=
re fun
> =A0 =A0 to use the standard Tie::File module, or the DB_File module's $DB_=
RECNO
> =A0 =A0 bindings, which allow you to tie an array to a file so that access=
ing an
> =A0 =A0 element the array actually accesses the corresponding line in the =
file.
Bill H
------------------------------
Date: Mon, 9 Jun 2008 08:51:44 +0200
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: FAQ 5.28 How can I read in an entire file all at once?
Message-Id: <pan.2008.06.09.06.51.38@rtij.nl.invlalid>
On Sun, 08 Jun 2008 15:48:22 -0700, Bill H wrote:
>> Â Â The customary Perl approach for processing all the lines in a
>> Â Â file is to do so one line at a time:
>>
>> Â Â Â Â Â Â open (INPUT, $file) Â Â || die "can't open $file:
>> Â Â Â Â Â Â $!"; while (<INPUT>) {
>> Â Â Â Â Â Â Â Â Â Â chomp;
>> Â Â Â Â Â Â Â Â Â Â # do something with $_
>> Â Â Â Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â close(INPUT) Â Â Â Â Â Â || die "can't close $file:
>> Â Â Â Â Â Â $!";
>>
>>
> I recently had to rework a program that used the above method in many
> places to load in small files (100 lines or so) containing product
> information, sales tax, ect. for a simple cart because a high placed
> security firm that was overseeing the project felt that the above method
> caused too much lag on servers and a possible collision with users. Not
> wanting to argue I followed their advice and replaced it with the @lines
> = <INPUT> method shown below. Not that it matters now, but did they have
> a valid point?
I suspect (add in a chomp somewhere) the latter method is somewhat more
efficient. A difference that is dwarfed by the overhead of the I/O, even
for a 100 line file.
Valid point? Nope, difference insignificant.
However, if processing each line takes some time and you want to protect
yourself against the files changing, the second method just makes the
race-window somewhat smaller. You'ld need locking in that case.
Valid point? Nope, wrong advice.
But as we don't know all variables involved, the point may have been
valid, though I suspect not.
M4
------------------------------
Date: Sun, 08 Jun 2008 21:23:11 -0400
From: Dan Rumney <danrumney@warpmail.new>
Subject: Re: FAQ 5.38 How do I select a random line from a file?
Message-Id: <484c85fd$0$31730$4c368faf@roadrunner.com>
Peter J. Holzer wrote:
[snip]
>> Finding random line from c:\dumpdecoder\svc.config.kdc.xml, 100 times
>> Rate Random Line By Hash Random Line By Array
>> Random Line By Hash 1.86/s -- -79%
>> Random Line By Array 8.84/s 375% --
>>
>> So, it looks like the hash method is, in this case, the faster.
>
> Er ...
>
> 8.84/s seems faster to me than 1.86/s.
>
> hp
>
Sheesh!
I plead molten brain; it's 100F in my apartment at the moment.
You are, of course, correct.
------------------------------
Date: Sun, 8 Jun 2008 23:43:45 -0700 (PDT)
From: Telemach <telemach@go2.pl>
Subject: Re: Few questions about arguments and subroutines/modules
Message-Id: <1ae83ef4-6cc1-4a1e-af6b-d04a82609a1c@b1g2000hsg.googlegroups.com>
> Catch a '-h' as first argument first before doing any other analysis of
> the commandline.
>
> jue
thanks, your post helped me
I did a trap for first argument so it will display help
sentence works in " "
last argument I did optional and a special if condition applied
- Telemach -
------------------------------
Date: Mon, 09 Jun 2008 11:01:35 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: How to find memory leak in perl server
Message-Id: <vj4vh5x336.ln2@carpet.zombinet>
[Followup-To set to c.l.p.m]
Yuri Shtil <shtil@comcast.net> wrote:
*SKIP*
> How would you recommend to approach the problem? What to look for in
> order to identify the cause of the memory leaks?
Find minimal example?
--
Torvalds' goal for Linux is very simple: World Domination
------------------------------
Date: Mon, 9 Jun 2008 04:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Jun 9 2008
Message-Id: <K26IEJ.vHB@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
API-PleskExpand-1.02
http://search.cpan.org/~nrg/API-PleskExpand-1.02/
OOP interface to the Plesk Expand XML API (http://www.parallels.com/en/products/plesk/expand/).
----
Abstract-Meta-Class-0.10
http://search.cpan.org/~adrianwit/Abstract-Meta-Class-0.10/
Simple meta object protocol implementation.
----
Acme-Colour-1.05
http://search.cpan.org/~lbrocard/Acme-Colour-1.05/
additive and subtractive human-readable colours
----
Acme-Note-0.7
http://search.cpan.org/~ferreira/Acme-Note-0.7/
Make a mental note for programming style
----
Acme-Roman-0.0.2.12
http://search.cpan.org/~ferreira/Acme-Roman-0.0.2.12/
Do maths like Romans did
----
Amazon-S3-0.44
http://search.cpan.org/~tima/Amazon-S3-0.44/
A portable client library for working with and managing Amazon S3 buckets and keys.
----
Apache2-Controller
http://search.cpan.org/~markle/Apache2-Controller/
lightweight OO framework for Apache2 handler apps
----
B-C-1.04_19
http://search.cpan.org/~rurban/B-C-1.04_19/
Perl compiler's C backend
----
Bundle-POPFile-1.02
http://search.cpan.org/~manni/Bundle-POPFile-1.02/
The modules needed by POPFile in one clean bundle
----
Bundle-Perl-Critic-1.020
http://search.cpan.org/~elliotjs/Bundle-Perl-Critic-1.020/
A CPAN bundle for Perl::Critic and related modules
----
Bundle-Perl-Critic-IncludingOptionalDependencies-v1.1.0
http://search.cpan.org/~elliotjs/Bundle-Perl-Critic-IncludingOptionalDependencies-v1.1.0/
Install everything Perl::Critic plus its optional dependencies.
----
CGI-Application-NetNewsIface-0.02
http://search.cpan.org/~shlomif/CGI-Application-NetNewsIface-0.02/
a publicly-accessible read-only interface for Usenet (NNTP) news.
----
Catalyst-Model-Akismet-0.02
http://search.cpan.org/~mramberg/Catalyst-Model-Akismet-0.02/
Catalyst model for the Akismet anti-spam protocol
----
Config-Mini-0.04
http://search.cpan.org/~jhiver/Config-Mini-0.04/
Very simple INI-style configuration parser
----
DBIx-MoCo-0.18
http://search.cpan.org/~jkondo/DBIx-MoCo-0.18/
Light & Fast Model Component
----
Data-Cloud-0.01
http://search.cpan.org/~nyarla/Data-Cloud-0.01/
Utility for word cloud.
----
Data-Section-0.003
http://search.cpan.org/~rjbs/Data-Section-0.003/
read multiple hunks of data out of your DATA section
----
Data-Section-0.004
http://search.cpan.org/~rjbs/Data-Section-0.004/
read multiple hunks of data out of your DATA section
----
Devel-PerlySense-0.0158
http://search.cpan.org/~johanl/Devel-PerlySense-0.0158/
Perl IDE backend with Emacs frontend
----
File-PathInfo-Ext-1.20
http://search.cpan.org/~leocharre/File-PathInfo-Ext-1.20/
metadata files, renaming, some other things on top of PathInfo
----
File-PathInfo-Ext-1.21
http://search.cpan.org/~leocharre/File-PathInfo-Ext-1.21/
metadata files, renaming, some other things on top of PathInfo
----
File-Tools-0.05
http://search.cpan.org/~szabgab/File-Tools-0.05/
UNIX tools implemented as Perl Modules and made available to other platforms as well
----
GD-SecurityImage-1.66
http://search.cpan.org/~burak/GD-SecurityImage-1.66/
Security image (captcha) generator.
----
Gtk2-Phat-0.04
http://search.cpan.org/~flora/Gtk2-Phat-0.04/
Perl interface to the Phat widget collection
----
Gtk2-Phat-0.05
http://search.cpan.org/~flora/Gtk2-Phat-0.05/
Perl interface to the Phat widget collection
----
Gtk2-Phat-0.06
http://search.cpan.org/~flora/Gtk2-Phat-0.06/
Perl interface to the Phat widget collection
----
HTML-Perlinfo-1.51
http://search.cpan.org/~accardo/HTML-Perlinfo-1.51/
Display a lot of Perl information in HTML format
----
HTML-TurboForm-0.13
http://search.cpan.org/~camelcase/HTML-TurboForm-0.13/
----
HTML-TurboForm-0.14
http://search.cpan.org/~camelcase/HTML-TurboForm-0.14/
----
Image-Imlib2-2.01
http://search.cpan.org/~lbrocard/Image-Imlib2-2.01/
Interface to the Imlib2 image library
----
Language-Befunge-4.00
http://search.cpan.org/~jquelin/Language-Befunge-4.00/
a Befunge-98 interpreter
----
Language-Befunge-Storage-Generic-Vec-XS-0.01
http://search.cpan.org/~infinoid/Language-Befunge-Storage-Generic-Vec-XS-0.01/
Language::Befunge::Storage::Generic::Vec rewritten for speed
----
Language-Befunge-Vector-XS-1.1.0
http://search.cpan.org/~jquelin/Language-Befunge-Vector-XS-1.1.0/
Language::Befunge::Vector rewritten for speed
----
Language-Prolog-Yaswi-0.16
http://search.cpan.org/~salva/Language-Prolog-Yaswi-0.16/
Yet another interface to SWI-Prolog
----
Lingua-Alphabet-Phonetic-NetHack-1.05
http://search.cpan.org/~mthurn/Lingua-Alphabet-Phonetic-NetHack-1.05/
map ASCII characters to names of NetHack items
----
Math-Expression-Evaluator-0.1.0
http://search.cpan.org/~moritz/Math-Expression-Evaluator-0.1.0/
parses, compiles and evaluates mathematic expressions
----
MooseX-Attribute-ENV-0.01
http://search.cpan.org/~jjnapiork/MooseX-Attribute-ENV-0.01/
Set default of an attribute to a value from %ENV
----
Net-BobrDobr-0.03
http://search.cpan.org/~arto/Net-BobrDobr-0.03/
module for using http://bobrdobr.ru.
----
Net-Squid-Auth-Engine-0.01.01
http://search.cpan.org/~lmc/Net-Squid-Auth-Engine-0.01.01/
External Credentials Authentication for Squid HTTP Cache
----
Net-Squid-Auth-Plugin-UserList-0.01.01
http://search.cpan.org/~lmc/Net-Squid-Auth-Plugin-UserList-0.01.01/
A User List-Based Credentials Validation Plugin for Net::Squid::Auth::Engine
----
Object-Previous-1.0.0
http://search.cpan.org/~jettero/Object-Previous-1.0.0/
find the instance of the object that called your function
----
Panotools-Script-0.14
http://search.cpan.org/~bpostle/Panotools-Script-0.14/
Panorama Tools scripting
----
Parse-BACKPAN-Packages-0.33
http://search.cpan.org/~lbrocard/Parse-BACKPAN-Packages-0.33/
Provide an index of BACKPAN
----
Perl-Critic-1.085
http://search.cpan.org/~elliotjs/Perl-Critic-1.085/
Critique Perl source code for best-practices.
----
Perl-Critic-Compatibility-1.000
http://search.cpan.org/~elliotjs/Perl-Critic-Compatibility-1.000/
Policies for Perl::Critic concerned with compatibility with various versions of Perl.
----
Perl6-GatherTake-0.0.2
http://search.cpan.org/~moritz/Perl6-GatherTake-0.0.2/
Perl 6 like gather { take() } for Perl 5
----
PerlIO-Util-0.42
http://search.cpan.org/~gfuji/PerlIO-Util-0.42/
A selection of general PerlIO utilities
----
Persistence-Entity-0.05
http://search.cpan.org/~adrianwit/Persistence-Entity-0.05/
Persistence API for perl classes.
----
Simple-SAX-Serializer-0.05
http://search.cpan.org/~adrianwit/Simple-SAX-Serializer-0.05/
Simple XML serializer
----
Software-License-0.007
http://search.cpan.org/~rjbs/Software-License-0.007/
packages that provide templated software licenses
----
Sys-Info-Driver-Windows-XS-0.11
http://search.cpan.org/~burak/Sys-Info-Driver-Windows-XS-0.11/
XS Wrappers for Sys::Info Windows driver
----
Test-DBUnit-0.08
http://search.cpan.org/~adrianwit/Test-DBUnit-0.08/
Database test framework.
----
Tie-Trace-0.09
http://search.cpan.org/~ktat/Tie-Trace-0.09/
easy print debugging with tie, for watching variable
----
Tie-Trace-0.10
http://search.cpan.org/~ktat/Tie-Trace-0.10/
easy print debugging with tie, for watching variable
----
XML-RSS-1.33
http://search.cpan.org/~shlomif/XML-RSS-1.33/
creates and updates RSS files
----
eGuideDog-Dict-Cantonese-0.4
http://search.cpan.org/~hgneng/eGuideDog-Dict-Cantonese-0.4/
an informal Jyutping dictionary.
----
eGuideDog-Dict-Mandarin-0.42
http://search.cpan.org/~hgneng/eGuideDog-Dict-Mandarin-0.42/
an informal Pinyin dictionary.
----
eGuideDog-Dict-Mandarin-0.43
http://search.cpan.org/~hgneng/eGuideDog-Dict-Mandarin-0.43/
an informal Pinyin dictionary.
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Sun, 08 Jun 2008 23:13:21 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Order of operations
Message-Id: <qepo445f9ldhicgjduhrhuhlskdadcf5fc@4ax.com>
dkcombs@panix.com (David Combs) wrote:
>So that means that you have to REMEMBER which funcs have (unexpected or unobvious)
>side-effects.
Well, no. That is why software engineering principles recommend to avoid
side effects and require to document(!) those odd behaviours.
>Meaning you gotta have a func-name-suffix "SE" or the like
>to remind you.
Should be spelled out in big bold red letters in the documentation.
>Well, there is someone else who knows, or could easily know, who has
>side effects, and can propogate that knowledge (well, infection) to
>calling funcs, and warn us of such potentially dangerous (and *horribly*
>difficult to track-down) uses within expressions.
>
>Who might that be? THE COMPILER, OF COURSE!
Nope. The compiler can only guess that a side effect may occur. If it
actually does happen is unknown at compile time and therefore equivalent
to solving the halting problem.
>Wouldn't it be reasonable to have the compiler (-w) warn of this
>stuff?
>
>(Presumably, it already does!)
Mabye. But it is always problematic trying to enforce best practises by
technology. It rarely works because people are very inventive when it
comes to circumventing restrictions.
jue
------------------------------
Date: Sun, 8 Jun 2008 21:00:15 -0700 (PDT)
From: marcelo.ebay.1970@gmail.com
Subject: Parsing an AVI to determine the length in time
Message-Id: <556d6fa7-e225-4369-ac91-5c7bb0ec0428@t54g2000hsg.googlegroups.com>
Hi all, I need to find out the length (in seconds) of a AVI video
file.
I search all the CPAN directory without success.
Does anyone know a way to get this information from an AVI file with a
batch process, either using a module or a plain routine?
Thanks in advance!
Marcelo
------------------------------
Date: Mon, 09 Jun 2008 06:19:12 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Parsing an AVI to determine the length in time
Message-Id: <6b3p6fF3ai42vU1@mid.individual.net>
marcelo.ebay.1970@gmail.com wrote:
> Hi all, I need to find out the length (in seconds) of a AVI video
> file.
Do no multi-post!!
http://lipas.uwasa.fi/~ts/http/crospost.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 8 Jun 2008 22:06:53 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Perl grep and Perl 4
Message-Id: <g2idpe01q11@news4.newsguy.com>
Charlton Wilbur wrote:
>>>>>> "szr" == szr <szrRE@szromanMO.comVE> writes:
>
>
> szr> That's assuming that he wasn't stuck with a server that had
> szr> only Perl 4 on it (and insufficient privileges to install a
> szr> newer one.)
>
> >> Right, which is a bizarre choice, verging on a pathology, on the
> >> part of the host.
>
> >> Perl 4 was superseded by Perl 5 a decade and a half ago.
>
> szr> True. My point is not everyone is has quite grasped the
> concept szr> of being up to date.
>
> But there's a difference between not being up to date and taking
> active steps to remain out of date, and using Perl 4 in 2008 counts
> as the latter.
Well I can't really disagree there. Though I have seen several hosting
firms using some seriously out of date setups (believe it or not there
are some still running servers with php3, apache 1.1, on kernel 2.0 and
virtually no security patches, just pure lazyness), but I agree there
really is not valid reason for it.
--
szr
------------------------------
Date: Mon, 09 Jun 2008 13:01:14 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Set breakpoint at a file/class in debugger
Message-Id: <pan.2008.06.09.13.01.14.295656@PSDT.com>
On Sat, 07 Jun 2008 20:08:09 +0200, Peter J. Holzer wrote:
> On 2008-06-07 00:57, Hongyu <me@hongyu.org> wrote:
>> For example, I have a Perl class named MyClass.pm, and my main program
>> is named main.pl which use MyClass module. When I launch the debugger
>> by typing "perl -d main.pl", I want to set a breakpoint at line 100 of
>> MyClass.pm.
>
> Don't know about line numbers, but you can set break points at any sub
> by using the full name.
Use the f command to change the active file:
% perl -d foo
main::(foo:1): ...
<DB> f Bar.pm
...
<DB> b 100
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Sun, 8 Jun 2008 16:00:45 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: Tk with Thread
Message-Id: <c4e6b5d0-9e4f-4986-98b1-52af416b6642@t54g2000hsg.googlegroups.com>
I want my script to have GUI, click a button, it will parse some raw
data, update the progress on the gui, use excel ole to output the
final result.
On Jun 8, 2:58 pm, Slickuser <slick.us...@gmail.com> wrote:
> I try to use Excel OLE but it crashes when I click exit.
> Is there a way to work around?
>
> use strict;
> use warnings;
> #use Win32::OLE;
> #use Win32::OLE::Const 'Microsoft Excel';
> use Tk;
> use Tk::Balloon;
> use threads;
> use threads::shared;
>
> my $run:shared = 0;
> my $exit:shared = 0;
> my $count:shared = 0;
>
> my $thr = threads->new(\&new_thread);
>
> my $mainWindow = MainWindow->new;
> my $textBox = $mainWindow->Scrolled("Text", -width=>80, -height=>7,
> -scrollbars=>"ose", -wrap=>"word")->grid();
>
> $mainWindow->Button(-foreground=>"blue", -text=>"Click",
> -command=>\&excecute)->grid();
>
> my $stopBut = $mainWindow->Button(-foreground=>"red", -text=>"Stop",
> -command=>sub{ $run=0; })->grid();
>
> $mainWindow->Button(-foreground=>"black", -text=>"exit",
> -command=>sub{ $exit=1;
> $thr->join;
> exit;
> })->grid();
>
> my $repeater = $mainWindow->repeat(1000,sub{
> if($run){
> $textBox->insert('end', "$count\n");
> $textBox->see('end');
> $textBox->update;
> $stopBut->configure(-state=> "disabled");
> }
> });
>
> MainLoop;
>
> sub new_thread{
>
> while(1)
> {
> if($exit){ return; } #thread can only be joined after it
> returns
> if($run)
> {
> if($exit){return;}
> &test;
>
> }
> else
> {
> ## Sleep for 1 miliseconds
> select(undef,undef,undef,.1);
> }
> }
>
> }
>
> sub test{
> $count++;
>
> }
>
> sub excecute { $run = 1 }
------------------------------
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 V11 Issue 1622
***************************************