[22583] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4804 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 2 06:05:48 2003

Date: Wed, 2 Apr 2003 03:05:09 -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           Wed, 2 Apr 2003     Volume: 10 Number: 4804

Today's topics:
        .doc > .txt <sorry.no@email.com>
    Re: .doc > .txt <me@privacy.net>
    Re: array or two hashes? <hannes@michalek.de>
    Re: CGI.pm or roll-your-own? <bart.lateur@pandora.be>
    Re: CGI::ContactForm 1.03 - Feedback request <noreply@gunnar.cc>
        Deducing variable name during initialization <jll@soundobjectlogic.com>
        desperately seeking (Weyland)
    Re: desperately seeking <Andrew.McGregor@amtrak.co.uk>
        gdtextutils ppm for activestate 5.8 (Mike Solomon)
        How to use newlines in DOS command options (Gian-Reto Alig)
        ICQ <bsd_devil@web.de>
    Re: ICQ <me@privacy.net>
    Re: ICQ <bsd_devil@web.de>
        Memory leak in Perl Interpreter (dylan)
    Re: MSWin32 Active State Perl Question <mooncm.lbkejwiAhEgSfSe@dAcEbSaS>
    Re: OT: Regex - hard or soft 'g' <tassilo.parseval@rwth-aachen.de>
    Re: Perl Debugger : ptkdb (zzapper)
    Re: perl noob question (Hostile17)
    Re: perl noob question <tassilo.parseval@rwth-aachen.de>
    Re: piped commands <josef.moellers@fujitsu-siemens.com>
    Re: Problem building perl on WinXP. Help! <me@privacy.net>
    Re: Sample Perl module with callback functions <tassilo.parseval@rwth-aachen.de>
        Two perl-debugging question (i5513)
    Re: use modules with same namespace (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 2 Apr 2003 10:12:18 +0100
From: "Brian Wakem" <sorry.no@email.com>
Subject: .doc > .txt
Message-Id: <b6e9hi$4h819$1@ID-112158.news.dfncis.de>

I have been trying to find a way of converting any .doc file into plain
text, i.e. extract purely the text from it, formatting is irrelevant.

I've been using some extremely crude methods (below) I have devised to do
it, and it works for 95% of .doc files, but fails on the other 5%.
Different versions of word save files in different ways.  I cannot find a
module to help with this and I can't find anything useful on google or
groups.google.  Does anyone know of a module or script, or just a good way
of doing it?


# extremely crude method, where $doc contains
# the entire .doc file.  This worked for 190 of the
# 200 .doc files I tested it on.

$doc =~ s/^.*?(\xD9\x00\x00\x00|\x00{90,})//s;
$doc =~ s/\x0D\x00\x00\x00\x00\x00\x00\x00\x00.*$//gs;
$doc =~ s/\x00{16,}.*$//gs;
$doc =~ s/\x09/ /g;
$doc =~ s/\x0D/<br>/g;
$doc =~ s/\x08/<br>/g;
$doc =~ s/\x07/<br>/g;
$doc =~ s/\x13//g;
$doc =~ s/([\x00-\x09]|[\x11\x12]|[\x14-\x19]|[\xA0-\xFF])//g;
$doc =~ s/\s*(EMBED|PAGE)[\w\s_().]*//g;
$doc =~ s/<br>\s+/<br>/sg; # html formatting
$doc =~ s/(<br>){4,}/<br><br><br><br>/sg; # html formatting
$doc =~ s/HYPERLINK "?[-\w@._:]*"?//sg;

--
Brian Wakem





------------------------------

Date: Wed, 2 Apr 2003 20:05:58 +1000
From: "Tintin" <me@privacy.net>
Subject: Re: .doc > .txt
Message-Id: <b6ecm6$4d0il$1@ID-172104.news.dfncis.de>


"Brian Wakem" <sorry.no@email.com> wrote in message
news:b6e9hi$4h819$1@ID-112158.news.dfncis.de...
> I have been trying to find a way of converting any .doc file into plain
> text, i.e. extract purely the text from it, formatting is irrelevant.
>
> I've been using some extremely crude methods (below) I have devised to do
> it, and it works for 95% of .doc files, but fails on the other 5%.
> Different versions of word save files in different ways.  I cannot find a
> module to help with this and I can't find anything useful on google or
> groups.google.  Does anyone know of a module or script, or just a good way
> of doing it?
>
>
> # extremely crude method, where $doc contains
> # the entire .doc file.  This worked for 190 of the
> # 200 .doc files I tested it on.
>
> $doc =~ s/^.*?(\xD9\x00\x00\x00|\x00{90,})//s;
> $doc =~ s/\x0D\x00\x00\x00\x00\x00\x00\x00\x00.*$//gs;
> $doc =~ s/\x00{16,}.*$//gs;
> $doc =~ s/\x09/ /g;
> $doc =~ s/\x0D/<br>/g;
> $doc =~ s/\x08/<br>/g;
> $doc =~ s/\x07/<br>/g;
> $doc =~ s/\x13//g;
> $doc =~ s/([\x00-\x09]|[\x11\x12]|[\x14-\x19]|[\xA0-\xFF])//g;
> $doc =~ s/\s*(EMBED|PAGE)[\w\s_().]*//g;
> $doc =~ s/<br>\s+/<br>/sg; # html formatting
> $doc =~ s/(<br>){4,}/<br><br><br><br>/sg; # html formatting
> $doc =~ s/HYPERLINK "?[-\w@._:]*"?//sg;

Whoa!  Doing it the hard way.  Use Win32::OLE and save it as a txt file
(assuming a Windoze environment)




------------------------------

Date: Wed, 2 Apr 2003 10:04:42 +0200
From: hannes michalek <hannes@michalek.de>
Subject: Re: array or two hashes?
Message-Id: <b6e5gr$4bhtt$1@ID-111424.news.dfncis.de>

> $listhash{$directory}=[@filelist]; $texthash{$directory}=$text;

i will use that (and take some lessons in Perlish ;-)

thanks to everybody on this thread!


hannes

-- 
hannes michalek (after change to gpg in 08/2002) <hannes@michalek.de>
Key fingerprint = E160 AFC5 7B0F 311D C5B4 42CB 6592 D5FA 338F 4932




------------------------------

Date: Wed, 02 Apr 2003 08:34:16 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: CGI.pm or roll-your-own?
Message-Id: <h18l8vokeu1lnu4m0agj3ge5pv3kpi7k0p@4ax.com>

Peter Scott wrote:

>>With a cgi-lib.pl-type of construction, everything seems more or less to 
>>be right in front of you.
>
>cgi-lib.pl doesn't have an equivalent of the h1() function from the code
>you quoted.  Or any other HTML generating code aside from the equivalents
>of start_html() and end_html().

Which is good on cgi-lib.pl. The HTML generating cruft is the worst
piece of shit in CGI.pm.

>I note that cgi-lib.pl has a home page (http://cgi-lib.berkeley.edu/) which
>says, "The cgi-lib.pl library has become the de facto standard library for 
>creating CGI scripts."  Sigh.

It has. 8 years ago.

-- 
	Bart.


------------------------------

Date: Wed, 02 Apr 2003 11:56:36 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI::ContactForm 1.03 - Feedback request
Message-Id: <b6eccb$49dnq$1@ID-184292.news.dfncis.de>

Tore Aursand wrote:
> On Tue, 01 Apr 2003 11:57:01 +0200, Gunnar Hjalmarsson wrote:
> 
>> I want to keep it simple. *Very* simple.
> 
> The users wants *options*.  There is _NOTHING_ stopping you from
> giving them what you're already giving them, _and_ giving something
> extra to those who want that.
> 
> The only thing you need to do, and that's something I would suggest
> you'd do anyway, is to separate the HTML code from the Perl code.

I have now realized that that can be done, and have already started to 
explore template customization as an option.

Thanks.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Wed, 02 Apr 2003 10:09:01 GMT
From: Jean-Louis Leroy <jll@soundobjectlogic.com>
Subject: Deducing variable name during initialization
Message-Id: <lzadf99pmm.fsf@toots.sol>

Hello,

is there a bit of magic that would make this possible?

        my $foo = Variable->new;
        print $foo->name; # prints 'foo'

 ...or a variant of that syntax, with the requirement that 'foo' must
appear only once.

The first idea that comes to mind is a source filter. Any ideas for a
better/easier/more robust solution?

For information, it's for a restricted Perl -> C++/Java translator I
want to use in building test suites for testing similar code developed
in several languages.
-- 
Jean-Louis Leroy
Sound Object Logic
http://www.soundobjectlogic.com


------------------------------

Date: 1 Apr 2003 23:55:09 -0800
From: weyland@bellsouth.net (Weyland)
Subject: desperately seeking
Message-Id: <444b356f.0304012355.41c29107@posting.google.com>

Greetings,

I'm very new to Perl, but have been reading as much as 
possible and searching the net, but am not having any 
luck learning quickly enough or finding what I'm looking for.

What I'm looking to do is take an email that 
comes into a client and pipe it through a script 
that would/will strip out the body and save it to a file.
In other words - nothing but the actual message to me will be saved.

As well, I'm trying to do this with HTML mail additionally.
As in, sometimes mail comes in as plain text, and sometimes it comes in as HTML.

I realize that I'll probably have to combine two scripts to make 
one that does it all, but I'd really like to find out how to do 
this, and am getting a little too frustrated in my learning and searches.

Does anyone know of existing scripts I can look at or even already use?

Thank you.

Weyland
(feel free to mail me on replies)


------------------------------

Date: Wed, 02 Apr 2003 09:17:57 +0100
From: Andrew McGregor <Andrew.McGregor@amtrak.co.uk>
Subject: Re: desperately seeking
Message-Id: <3E8A9CB5.2070804@amtrak.co.uk>

Weyland wrote:
> 
> Does anyone know of existing scripts I can look at or even already use?
> 

search.cpan.org for html and/or mail.  there will be some sort of 
parsing module that will suit your requirements.



------------------------------

Date: 2 Apr 2003 00:34:43 -0800
From: mike_solomon@lineone.net (Mike Solomon)
Subject: gdtextutils ppm for activestate 5.8
Message-Id: <56568be5.0304020034.3f83b984@posting.google.com>

I am trying to use DBIx::Chart to create graphs

DBIx::Chart requires gdtextutils

I am running active state perl 5.8

There is no ppm for gdtextutils on the active state reposititry

does anyone know where I can get a ppm for gdtextutils ?

I tried downloading the source and compliling it on my PC but I got an
error :
"No targets provided near line 654" which meens nothing to me!

Does anyone know of a ppm for 5.8 or have any tips about how I can
compile it from the source code

there is a ppm for 5.6 is there any way I could use this or would'nt
it work ?


Thanks


Regards

Mike Solomon


------------------------------

Date: 2 Apr 2003 01:36:58 -0800
From: gian-reto.alig@gmx.ch (Gian-Reto Alig)
Subject: How to use newlines in DOS command options
Message-Id: <b59dd496.0304020136.699c9e11@posting.google.com>

Hi

I'm using Perl to write automated build and release scripts for CM
Synergy (Continuus)...

Recently I tried to update the releases attribute with a system
command...

as far as I know I have to overwrite the whole attribute, and because
of this I have to be able to supply multi-line values for some
attributes, even to change one line...

Everything worked fine on my unix server, I used Backquotes and put
the value into doublequotes ... but when I tried to do the same thing
on Windows, this failed... Perl seems to replace newlines and tabs
with spaces...

I tried to do it manually on the console, it didn't worked either...

Is there any way to use newlines in a commandline option in DOS?

Is it possible using the Win32::Process module?

Thanks in advance

regards

gian-reto alig


------------------------------

Date: Wed, 2 Apr 2003 12:18:05 +0200
From: "BSD" <bsd_devil@web.de>
Subject: ICQ
Message-Id: <b6e9tr$4bfnq$1@ID-172702.news.dfncis.de>

Did any one use perl to send SMS message via ICQ?
Anay input would be really appreciated?

BSD




------------------------------

Date: Wed, 2 Apr 2003 20:07:07 +1000
From: "Tintin" <me@privacy.net>
Subject: Re: ICQ
Message-Id: <b6ecob$3o8gq$1@ID-172104.news.dfncis.de>


"BSD" <bsd_devil@web.de> wrote in message
news:b6e9tr$4bfnq$1@ID-172702.news.dfncis.de...
> Did any one use perl to send SMS message via ICQ?
> Anay input would be really appreciated?

http://search.cpan.org/author/JMUHLICH/Net-ICQ-0.16/lib/Net/ICQ.pm




------------------------------

Date: Wed, 2 Apr 2003 13:42:42 +0200
From: "BSD" <bsd_devil@web.de>
Subject: Re: ICQ
Message-Id: <b6eesg$4f2dj$1@ID-172702.news.dfncis.de>

cpan> install Net::ICQ
Running install for module Net::ICQ
Running make for J/JM/JMUHLICH/Net-ICQ-0.16.tar.gz
  Is already unwrapped into directory /root/.cpan/build/Net-ICQ-0.16
  Makefile.PL returned status 512
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install

BSD

"Tintin" <me@privacy.net> wrote in message
news:b6ecob$3o8gq$1@ID-172104.news.dfncis.de...
>
> "BSD" <bsd_devil@web.de> wrote in message
> news:b6e9tr$4bfnq$1@ID-172702.news.dfncis.de...
> > Did any one use perl to send SMS message via ICQ?
> > Anay input would be really appreciated?
>
> http://search.cpan.org/author/JMUHLICH/Net-ICQ-0.16/lib/Net/ICQ.pm
>
>




------------------------------

Date: 1 Apr 2003 23:36:19 -0800
From: dylankcy@yahoo.com (dylan)
Subject: Memory leak in Perl Interpreter
Message-Id: <fafa4510.0304012336.53c36ae2@posting.google.com>

Hi,
I did working on some program that integrate perl application into C++
application. I'm using perl version 5.004_04 in sunOS 2.5.
When i'm runnig through purify tool, i found the following memory leak
is happening in libperl.a library, so i suspect there is a memory leak
in perl interpreter itself. Is anyone aware of situation where perl
interpreter will allocate memory as shown below. Thanks for the help
and advice.

         MLK: 48 bytes leaked at 0x2c88838
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newSTATEOP [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
               Perl_pp_entereval [libperl.a]
               Perl_runops    [libperl.a]
         MLK: 36 bytes leaked at 0x2e3f338
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newLISTOP [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
               Perl_pp_entereval [libperl.a]
               Perl_runops    [libperl.a]
         MLK: 36 bytes leaked at 0x2e408b8
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newLISTOP [libperl.a]
               Perl_force_list [libperl.a]
               Perl_newUNOP   [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
         MLK: 28 bytes leaked at 0x2e14538
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newUNOP   [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
               Perl_pp_entereval [libperl.a]
               Perl_runops    [libperl.a]
         MLK: 28 bytes leaked at 0x2e40a38
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newSVOP   [libperl.a]
               Perl_force_ident [toke.c]
               Perl_yylex     [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
         MLK: 28 bytes leaked at 0x2e41538
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newUNOP   [libperl.a]
               Perl_newPROG   [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
               Perl_pp_entereval [libperl.a]
         MLK: 28 bytes leaked at 0x2e42f38
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newUNOP   [libperl.a]
               Perl_yyparse   [libperl.a]
               Perl_doeval    [pp_ctl.c]
               Perl_pp_entereval [libperl.a]
               Perl_runops    [libperl.a]
         MLK: 24 bytes leaked at 0x2e3ecb8
         This memory was allocated from:
               malloc         [rtlib.o]
               Perl_newOP     [libperl.a]
               Perl_newLISTOP [libperl.a]
               Perl_force_list [libperl.a]
               Perl_newUNOP   [libperl.a]
               Perl_yyparse   [libperl.a]
   
thanks in advance
CY


------------------------------

Date: Wed, 02 Apr 2003 05:27:07 GMT
From: "BSK" <mooncm.lbkejwiAhEgSfSe@dAcEbSaS>
Subject: Re: MSWin32 Active State Perl Question
Message-Id: <Lwuia.4703$4P1.368419@newsread2.prod.itd.earthlink.net>

Actually, $] reports perl 5.008, however the ActiveState documentation tells
me "ActivePerl 5.8.0 (based on Perl 5.8.0)."

BSK


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3E8A4BC3.DB3A256A@earthlink.net...
> Sisyphus wrote:
> > Benjamin Goldberg wrote:
> >
> > > I'm afraid that alarm() doesn't work on windows.  At all.  Not just,
> > > it doesn't work with STDIN, it just doesn't work.
> >
> > That's true as regards pre-5.8 perl. But alarm() works fine on windows
> > with perl 5.8 (which I presume is what the op means by "5.008").
>
> Whoops, I completely missed that part of the OP's post.
>
> --
> $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
> );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
> ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
>




------------------------------

Date: 2 Apr 2003 05:30:16 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: OT: Regex - hard or soft 'g'
Message-Id: <b6dsh8$470$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Tom Beer:

> How does one pronounce "regex"? Is the 'g' hard (as in "regular"), or
> is it soft.
> 
> I understand the etymology, but something inside me wants to make the
> 'g' soft and I was wondering what the generally accepted pronunciation
> before I embarras myself.

I am not sure whether there is one at all. Benjamin says he uses the
soft form, whereas I always pronounced it like 'reck-ex'. To be
absolutely sure, just pronounce it 'regular expression'...or 'pattern'. 
;-)

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: 2 Apr 2003 01:54:43 -0800
From: david@tvis.co.uk (zzapper)
Subject: Re: Perl Debugger : ptkdb
Message-Id: <f677762.0304020154.2901b062@posting.google.com>

> It is now on CPAN. Devel::ptkdb is now at version 1.1084 and dated 28 Nov 2002.
> 
> There is quite a bit of documentation with the module. Try `perldoc
> Devel::ptkdb` when you have installed it.

Thanx Brian. I found ptkdb (that means Perl TK DeBugger)really useful
especially its visualisation of data. Now I'd like to learn to
power-drive it. I'd like here other user's tips etc.

zzapper


------------------------------

Date: 1 Apr 2003 22:00:14 -0800
From: hostile17@bigfoot.com (Hostile17)
Subject: Re: perl noob question
Message-Id: <c610561.0304012200.581bcae5@posting.google.com>

> Don't Do That(tm).

I agree, but for the interest, if you want to programmatically create
variables, you can do it.

$number = 1;
@{$number} = (1,2,3); # creates array called @1


------------------------------

Date: 2 Apr 2003 06:04:48 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: perl noob question
Message-Id: <b6dui0$51u$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Hostile17:

>> Don't Do That(tm).
> 
> I agree, but for the interest, if you want to programmatically create
> variables, you can do it.
> 
> $number = 1;
> @{$number} = (1,2,3); # creates array called @1

Yes, you can do it that way but with a few limitations that, for me
anyway, render the thing useless most of the time: the array @1 has to
be a package variable. You can't make it a lexical (one declared with
my()) since such a variable lives in no namespace.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Wed, 02 Apr 2003 08:44:52 +0200
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: piped commands
Message-Id: <3E8A86E4.7D5C56F7@fujitsu-siemens.com>

stinkbomb wrote:
> =

> Josef M=F6llers wrote:
> >
> > stinkbomb wrote:
> > >
> > What's so bad about
> >         $x =3D~ s/hello/goodbye/gi;
> >         $x =3D~ s/world/planet/gi;
> >         $x =3D~ s/!/\?/gi;
> > apart from some optimizations?
> >
> =

> would it be slower that we're calling the function and setting variable=
s
> many times?
> or not?

You're calling the function many times, if you use a pipe, so that would
not be a problem, would it? Also, one could probably make some
optimizations, I usually don't have such stringent performance
requirements that I need them. I've tried folding the first two cases
into one, like "s/(hello|world)/($1=3D=3D'hello')?"goodby":"planet"/xegi"=

but without success. Perhaps others know these kinds of constructs
better than me.

As for the variables: That might be a case for the optimizer? Also, who
guarantees that your pipe wouldn't also assign the intermediate results
to $_?

Is performance such an issue for you?

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


------------------------------

Date: Wed, 2 Apr 2003 19:52:20 +1000
From: "Tintin" <me@privacy.net>
Subject: Re: Problem building perl on WinXP. Help!
Message-Id: <b6ebsk$45lk8$1@ID-172104.news.dfncis.de>


"Bill" <crusader@bestweb.net> wrote in message
news:Xns9350C874DC6B2crusaderbestwebnet@216.168.3.50...
> I am new to the concept of building sources. I am trying to build perl
> 5.8.0 in Windows XP with the Mingw32 GCC version 2.95.2 and dmake-4.1pl1-
> win32 as told in the perl readme.win32. I followed all of the directions.
> The only thing I was really stuck on was how to get the ENVIRONMENT
> VARIABLES in the config.mk in dmake configured for Ming32 GCC. There was
> no corresponding file in the distribution. I left the configuration like
> this:
>
>    OS            *:= win32
>    OSRELEASE     *:= borland
>    OSENVIRONMENT *:= bcc50
> What do I put for osrelease and osenvironment when using  Mingw32 GCC?
>
> Anyway this is what happened when I tried too build. Can anyone tell me
> whats happening?

Are you that keen to compile your own version of Perl?  What's wrong with
installing Activestate Perl?
http://www.activestate.com/




------------------------------

Date: 2 Apr 2003 06:02:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Sample Perl module with callback functions
Message-Id: <b6dud1$50s$1@nets3.rz.RWTH-Aachen.DE>

Also sprach * Tong *:

> Can somebody give me an example of Perl module that allow user
> define their own callback functions? 

There are a couple of modules on the CPAN that make use of callbacks.
Have a look at for instance Net::IRC (the documentation of it refers to
them as 'handlers').

The example you found is a little simple-minded in that it does not
really exhibit what callbacks are about. Callbacks are little pieces of
code that get executed when a certain defined event happens. Think of a
scenario where a module implements some network protocol. The module
both has to wait for input from the user but also for messages that are
sent by the server. This happens in a so-called event-loop. The module
is caught in such a loop checking whether user or server events have
arrived. If something arrives it triggers a callback. Below is a simple
class that goes through a file character-wise and triggers one
function when it encounters an alphanumerical character and another
function for anything else:

    #! /usr/bin/perl -w

    use strict;
    use Carp;

    package FileWalker;

    sub new {
        my ($class, $file) = @_;
        open my $h, $file or croak $!;
        bless {
            handle      => $h,
            on_alphanum => \&def_alphanum_handler,
            on_else     => \&def_else_handler,
        } => $class;
    }

    # registers a callback for alphanums
    sub on_alphanum {
        my ($self, $func) = @_;
        $self->{ on_alphanum } = $func;
    }
    
    # registers a callback for anything else
    sub on_else {
        my ($self, $func) = @_;
        $self->{ on_else } = $func;
    }

    # default handlers for alphanums ...
    sub def_alphanum_handler {
        my $char = shift;
        print $char;
    }

    # ... and anything else
    sub def_else_handler {
        my $char = shift;
        print $char;
    }

    sub parse {
        my $self = shift;
        my $h = $self->{ handle };
        while (defined (my $c = getc($self->{ handle }))) {
            # triggers one of the two handlers depending on $c
            $self->{ on_alphanum }->($c), next
                if $c =~ /[[:alnum:]]/;
            $self->{ on_else }->($c);
        }
    }
     
    sub DESTROY {
        close shift->{ handle };
    }

    package main;

    my $walker = FileWalker->new(".bashrc");
    $walker->on_alphanum( sub { print shift } );
    $walker->on_else( sub { } );
    $walker->parse;

With an empty on_else-handler this will print just the alphanumerics and
strip anything else.

The above could have done differently, too. For example another common
way to achieve such a thing is via subclassing FileWalker and overriding
only the two handler functions. In this case the structure of FileWalker
would change slightly. The getc-loop could then look like this:

    while (defined (my $c = getc($self->{ handle }))) {
        $self->on_alphanum($c), next
            if $c =~ /[[:alnum:]]/;
        $self->on_else($c);
    }

assuming that on_alphanum() and on_else were the two callback functions.
HTML::Parser works exactly like this.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: 1 Apr 2003 23:29:32 -0800
From: i5513@hotmail.com (i5513)
Subject: Two perl-debugging question
Message-Id: <a657ec02.0304012329.20a8a80f@posting.google.com>

Hi! I want to use perl' debugger. How can I enable a breakpoint at
other file that isn't principal?

I'm look for a sentence like:

b my_file#no_lin

(by default it is only possible at current file, isn't?)

I know I can : 
b postpone my_subr
It is the more similar I could find, but I would like go to a line at
this routine directly, without two break points.

(Note that I'm using emacs for windows editor)
And, ... other question ...
(from perldebug)
What does 'Breakpoints may only be set on lines that begin an
executable statement' is mean?

I don't understand why some times I recived a message that says me
"Line x not breakable".

I found a example:
1 while (0)
2 {
3  ;  
4 }
5 @a = "b";

<DB> b 5
<DB>
# It's ok

1 while (0)
2 {
3  ;  
4 }
5 @a = 
6 "b";
<DB> b 5
Line 5 not breakable
# I don't understand, but I read from 
# http://world.std.com/~aep/ptkdb/ (Known problem section):
# ... That is where the operation is 'syntactically' 
# completed ... well I conformed with b 6 ...

1 while (0)
2 {
3  ;  
4 };         # this ';' is the change
5 @a = 
6 "b";
<DB> b 5
<DB> 
# Now it is a breakpoint correct, why???

I'm having problemes debugging perl, so I ask you.
Thanks you


------------------------------

Date: 2 Apr 2003 10:33:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: use modules with same namespace
Message-Id: <b6ee9f$a71$1@mamenchi.zrz.TU-Berlin.DE>

James E Keenan <jkeen@concentric.net> wrote in comp.lang.perl.misc:
> 
> "peter pilsl" <pilsl_usenet@goldfisch.at> wrote in message
> news:3e89f73a$1@e-post.inode.at...
> >
> > to split a big module into several smaller modules I use the following
> way.
> >
> > package mymodule;
> >
> > use submodule1;
> > use submodule2;
> >
> > ....
> >
> > where submodule1 und submodule2 is only a collection of subs.
> > Cause many subs in submodule1 make calls to subs in the mainmodule and
> even
> > in submodule2 I didnt give submodule1 and submodule2 a own namespace, but
> > also use the same namespace.
> >
> > So submodule1 reads like this:
> >
> > package mymodule;
> >
> > sub1{...}
> > sub2{...}
> >
> > 1;
> >
> >
> > It seems to work - even with mod_perl - but it doesnt seem very ok to me.
> > Are there any drawbacks on this ?  (beside the fact that it isnt good
> style)
> >
> > peter
> >
> One reason it's not good style is that it's confusing to other Perl folks,
> at least on the face of it.  Assuming that these are all regular modules
> (not OO), you have a strong potential for namespace confusion here.  You
> don't appear to have placed any restrictions on which subroutines can be
> imported/exported from which packages.

Actually, standard exportation won't work at all with this arrangement.
When you "use submodule1", the system will look for a method
"submodule1->import", which it won't find, so no symbols are exported.

>                                        Apart from having smaller files, is
> there a compelling reason why you wish to split your module into several
> smaller ones?  If not, then I'd suggest the advantages are outweighed by the
> confusion created.

If you *must* split a file "MyModule.pm", this is how I'd do it (untested).

Keep MyModule.pm with just this contents:

    package MyModule;
    use base 'Exporter';
    BEGIN {
        our @EXPORT = ...;
        our @EXPORT_OK = ...;
        ...
    }

    do 'SubModule1';
    do 'SubModule2';

    1;

SubModule1 and SubModule2 don't have package directives (and no .pm
suffix, they aren't modules).  They just contain the code you would
have written where the "do" statements are.  This way, MyModule.pm
remains a standard Perl module, but SubModule1 and SubModule2 don't
look as if they could be used stand-alone.

Anno
-- 
-- 

sub nmax { @$_[ @_] = (); $#$_ }


------------------------------

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 4804
***************************************


home help back first fref pref prev next nref lref last post