[24947] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7197 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 18:06:55 2004

Date: Thu, 30 Sep 2004 15: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           Thu, 30 Sep 2004     Volume: 10 Number: 7197

Today's topics:
    Re: $SIG{CHLD} and system <thepoet_nospam@arcor.de>
    Re: $SIG{CHLD} and system (kspecial@linuxmail.org)
    Re: $| (undocumented) magic? <dformosa@zeta.org.au>
        arrays <nospam@nospam.com>
    Re: arrays <thepoet_nospam@arcor.de>
    Re: arrays (Walter Roberson)
    Re: help with eval <simplitia@gmail.com>
    Re: help with eval <nobull@mail.com>
        How to merge .wav files <jarsonk@nospam.com>
    Re: How to merge .wav files <ftoewe@austin.rr.com>
        how to put constaints on coefficients obtained from reg (pj)
        Interrupt make if script doesnt run. (fr0do)
        Perl.org locked down? (was Re: Potential bug ?) <bigal187@invalid.rx.eastcoasttfc.com>
    Re: Perl.org locked down? (was Re: Potential bug ?) <gregs@trawna.com>
    Re: Problem printing array content with CGI (Simon L)
        sprintf problem <b-patton@ti.com>
    Re: sprintf problem <for-spammers-only@web.de>
    Re: sprintf problem <thundergnat@hotmail.com>
        Symbolic algebra <goofy_headed_punk@msn.com>
        Symbolic algebra <goofy_headed_punk@msn.com>
    Re: Symbolic algebra <ftoewe@austin.rr.com>
    Re: Syntax appears inconsistent - why is this? <abigail@abigail.nl>
        TableExtract question - how to deal with headers with s (Michael Bourgon)
    Re: tr problem <notvalid@email.com>
    Re: unicode: is decode-process-encode a "good" aproach? <usenet@morrow.me.uk>
    Re: use require and loading modules <nobull@mail.com>
    Re: use warnings, was Re: problem with rand on OSX <dha@panix.com>
        Who's responsible for this ? <root@localhost>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 30 Sep 2004 21:03:02 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: $SIG{CHLD} and system
Message-Id: <415c5847$0$8106$9b4e6d93@newsread4.arcor-online.net>

Heinrich Mislik wrote:
> perl -e '$SIG{CHLD} = "IGNORE";system("date") and die'
> 
> gives me
> 
> Thu Sep 30 14:34:22 MSZ 2004
> Died at -e line 1.
> 
> I can understand, why this happens. But is it documented? Shouldn't system
> set up it's own signalhandlers? The function system in C does so. Does this
 > mean, that perl does not call this function?
> 
> Any thoughts

Mostly one thought: read "perldoc -f system". It forks a child
and, in cases like yours when there's no meta chars in
the argument string, calls execvp. No system() call invoked.

Apart from that, I can't reproduce this behaviour
(just tested 5.6.1 and 5.8.[03] on Linux and Win32).
%SIG isn't changed by the call of system("date").
What version and OS are you on?

-Christian


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

Date: 30 Sep 2004 14:00:38 -0700
From: kspecial@linuxmail.org (kspecial@linuxmail.org)
Subject: Re: $SIG{CHLD} and system
Message-Id: <365f784f.0409301300.e738812@posting.google.com>

Heinrich.Mislik@univie.ac.at (Heinrich Mislik) wrote in message news:<415bfee0$0$12646$3b214f66@usenet.univie.ac.at>...
> perl -e '$SIG{CHLD} = "IGNORE";system("date") and die'
> gives me
> 
> Thu Sep 30 14:34:22 MSZ 2004
> Died at -e line 1.

That's exactly what it's supposed to give you...

> I can understand, why this happens. 

Why what happens? Perl run's "date", then returns when date exits,
after which it proceeds to die....perl is reporting that it die()ed.
I'm not sure what you expected to happen. You can check return values
etc of the system():

$exit_value = $? >> 8;
$signal_num = $? & 127
$dumped_core = $? & 128

--K-sPecial


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

Date: 01 Oct 2004 07:08:57 +1000
From: ? the Platypus {aka David Formosa} <dformosa@zeta.org.au>
Subject: Re: $| (undocumented) magic?
Message-Id: <m34qlfcvme.fsf@dformosa.zeta.org.au>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

[...]

> Otherwise, it just doesn't happen all that often that you want to do
> one thing if both $a and $b are true, and the same thing when they
> are both false, but something else if one is true and the other
> isn't. If it happens, I'll try to bring in negation at one point, which
> normalizes the value of booleans, so comparison with "==" is valid.

I would use something like not ($a xor $b) which should have the same effect.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.


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

Date: Thu, 30 Sep 2004 14:31:44 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: arrays
Message-Id: <1096569163.426086@nntp.acecape.com>

i noticed in the debugger that some arrays i have to access with ->[0]
instead of just [0]

does this have to do with multidimensial arrays?




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

Date: Thu, 30 Sep 2004 20:48:08 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: arrays
Message-Id: <415c54cf$0$3640$9b4e6d93@newsread2.arcor-online.net>

daniel kaplan wrote:
> i noticed in the debugger that some arrays i have to access with ->[0]
> instead of just [0]
> 
> does this have to do with multidimensial arrays?

Indeed it has ;-)
Multidimensional arrays in Perl are nothing more but
arrays of arrayrefs. So you need to dereference the
child array before accessing its elements with -> notation.

Perl is already shipped with a good documentation on
that topic, see
perldoc perllol
perldoc perlreftut
perldoc perlref
and
perldoc perldata

HTH
-Christian


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

Date: 30 Sep 2004 18:49:38 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: arrays
Message-Id: <cjhkg2$i82$1@canopus.cc.umanitoba.ca>

In article <1096569163.426086@nntp.acecape.com>,
daniel kaplan <nospam@nospam.com> wrote:
:i noticed in the debugger that some arrays i have to access with ->[0]
:instead of just [0]

:does this have to do with multidimensial arrays?

perl does not offer true multidimensional arrays (i.e., contiguous
block of storage with item offsets calculatable by a fixed
arithmetic formula.) perl does, though, allow any element of an
array to be a *reference* to another array. Multidimensional arrays
in perl are handled by indexing along the first dimension to retreive
an array reference, then indexing that along the next dimension,
and so on until you run out of dimensions... and the result you get
back might be a reference to something rather than a numeric or string or
character value.

The answer to your question should now be clear: ->[0] is the syntax
for selecting element 0 from an array reference, whereas [0] is
the syntax for selecting element 0 from an array (which you might
have reached by already having dereferenced an array reference you had
stored.)
-- 
   "There are three kinds of lies: lies, damn lies, and statistics."
   -- not Twain, perhaps Disraeli, first quoted by Leonard Courtney


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

Date: 30 Sep 2004 11:45:11 -0700
From: "Alex  Lee" <simplitia@gmail.com>
Subject: Re: help with eval
Message-Id: <1096569911.444413.23420@k26g2000oda.googlegroups.com>

Brian, I think you made an excellent point there:
I made a over simplification by lumping errors and warnings together.
The simple solution to my original problem is to simply ignore the
warnings:

local $SIG{__WARN__}=sub{};
print eval "**1";
## found solution in "Perl Black Book"
Anyways thank you to all that post helful comments. 
al ;)



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

Date: Thu, 30 Sep 2004 21:27:26 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: help with eval
Message-Id: <cjhpvi$k30$1@sun3.bham.ac.uk>



A. Sinan Unur wrote:
> "Alex  Lee" <simplitia@gmail.com> wrote in
> news:1096477999.707653.91720@k17g2000odb.googlegroups.com: 
> 
> 
>>This is getting kind of weird: all I ask was how I can silence eval.
>>Oh excuse my 'simple' language, to prevent eval from sending 'all'
>>warning messages to STDERR:
> 
> 
> Ah-em, you would have gotten that answer if you had simply read:
> 
> perldoc -f eval

Actually there are mistakes in that documentation...

     If there is a syntax error or runtime error, or
     a die statement is    executed, an undefined value
     is returned by eval, and $@ is set to the error
     message. If there was no error, $@ is guaranteed to
     be a null string. Beware that using eval neither
     silences perl from printing warnings to STDERR,
     nor does it stuff the text of warning messages into $@.
     To do either of those, you have to use the $SIG{__WARN__}
     facility, or turn off warnings inside the BLOCK
     or EXPR using no warnings 'all'. See warn, the perlvar
     manpage, the warnings manpage and the perllexwarn manpage.

Compilation errors, other than the last one, are treated as warnings and 
will be captured as by the $SIG{__WARN__} handler.  But if warnings are 
disabled using 'no warnings' then all the compilation errors will not 
set sent to the $SIG{__WARN__} or to STDERR be concetenated into $@.

Note also the warnings can be captured by capturing STDERR too.



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

Date: Thu, 30 Sep 2004 14:44:45 -0400
From: "Jarson" <jarsonk@nospam.com>
Subject: How to merge .wav files
Message-Id: <xuY6d.20544$MD5.1043516@news20.bellglobal.com>

I'm building a web-based message alert system in Perl (CGI) using voice TTS. 
Each web client will get a custom voice message that will actually consist 
of selected .wav files merged together to appear as one.  My problem, is 
that I don't know how to handle .wav files to merge them properly under 
Perl.  Alternatively, if there is a way for a CGI program to send a stream 
of multiple separate .wav files, that would work to.  Is there?

Thanks, Jarson

jarson can be found at sygration. That's a dot com company. 




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

Date: Thu, 30 Sep 2004 21:41:47 GMT
From: "Fred Toewe" <ftoewe@austin.rr.com>
Subject: Re: How to merge .wav files
Message-Id: <v4%6d.1748$YT3.810@fe2.texas.rr.com>

"Jarson" <jarsonk@nospam.com> wrote in message
news:xuY6d.20544$MD5.1043516@news20.bellglobal.com...
> I'm building a web-based message alert system in Perl (CGI) using voice
TTS.
> Each web client will get a custom voice message that will actually consist
> of selected .wav files merged together to appear as one.  My problem, is
> that I don't know how to handle .wav files to merge them properly under
> Perl.  Alternatively, if there is a way for a CGI program to send a stream
> of multiple separate .wav files, that would work to.  Is there?
>
> Thanks, Jarson
>
> jarson can be found at sygration. That's a dot com company.
>
>

Have a look at http://www.xav.com/perl/site/lib/Win32/Sound.html
It might get you close enuff to where you can code it.




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

Date: 30 Sep 2004 13:37:50 -0700
From: nsf470@yahoo.com (pj)
Subject: how to put constaints on coefficients obtained from regression.pm
Message-Id: <11711ebf.0409301237.2c75e42a@posting.google.com>

Hi, 

I use regression package to do a multivariate linear regression fit to
my data. Regression.pm generates coefficient values (thetas), but I
want to make them always possitive. How do I put constraints (all
coefficients are positive) when using regression package? any ideas?
thanks


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

Date: 30 Sep 2004 15:03:26 -0700
From: frodo_r@yahoo.com (fr0do)
Subject: Interrupt make if script doesnt run.
Message-Id: <1f283ab4.0409301403.3cede62c@posting.google.com>

Hi,

Wanted to know if there are any ways to interrupt/abort make while
building if a perl script did not run currently make continues with a
message saying "Can't find perl script" or did not execute the perl
script.

Thanks!
-F


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

Date: Thu, 30 Sep 2004 09:07:45 -0700
From: "187" <bigal187@invalid.rx.eastcoasttfc.com>
Subject: Perl.org locked down? (was Re: Potential bug ?)
Message-Id: <2s2pamF1gl777U1@uni-berlin.de>

kspecial@linuxmail.org wrote:
[...]
> Luckily my ISP blocks port 25 outbound so I never got the
> chance to report with perlbug..Thanks alot,

Is this an attempt to stop spammers? If so, sounds like a good idea,
though I'm thinking you meant 25 inbound is blocked, as the outbound
port used by your computer when *sending* mail is a random outgoing
port; the server recieving the mail is always on the fixed port of 25
TCP.

I think the problem is the Perl.org servers lately seeming won't acccept
any new posts of mail (ie PerlBug gets posted there), as if it's been
locked down for some reason? I mean I can read posts, but suddenly
nothing seems to be acceoted in the way of posts and emails (like
PerlBug.)

Maybe someone else knows more?




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

Date: Thu, 30 Sep 2004 13:07:31 -0400
From: Greg Schmidt <gregs@trawna.com>
Subject: Re: Perl.org locked down? (was Re: Potential bug ?)
Message-Id: <wl2nvk7ezacp$.dlg@trawna.com>

On Thu, 30 Sep 2004 09:07:45 -0700, 187 wrote:

> kspecial@linuxmail.org wrote:
> [...]
>> Luckily my ISP blocks port 25 outbound so I never got the
>> chance to report with perlbug..Thanks alot,
> 
> Is this an attempt to stop spammers? If so, sounds like a good idea,
> though I'm thinking you meant 25 inbound is blocked, as the outbound
> port used by your computer when *sending* mail is a random outgoing
> port; the server recieving the mail is always on the fixed port of 25
> TCP.

My sister's ISP (Sprint Canada, I think) blocks outbound connections to
port 25 to anything but their own servers.  Took a while to figure this out
(she uses my mail server instead of theirs), but it does seem like a very
good defense against spammers and viruses that send out emails.

-- 
Greg Schmidt  gregs@trawna.com
  Trawna Publications  http://www.trawna.com/


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

Date: 30 Sep 2004 08:49:40 -0700
From: simon.low@pearson.com (Simon L)
Subject: Re: Problem printing array content with CGI
Message-Id: <c75aaf9b.0409300749.73e0efce@posting.google.com>

Steve May <junk@blackwater-pacific.com> wrote in message news:<10l9rfrjbi1ln70@corp.supernews.com>...
> Simon L wrote:
> 
> > Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<2rj362F19gourU1@uni-berlin.de>...
> > 
> >>Shawn Corey wrote:
> >>
> >>>If a CGI works from a command line but not when called by a web
> >>>server then 95% of the time it's a problem with permissions.
> >>
> >>Relative paths is a rather common cause as well.
> >>
> >>
> >>>Check _all_ files including the data files.
> >>
> >>And ensure that they are called with full paths.
> > 
> > 
> > Thanks for your responses.  I used absolute path.  I subsequently
> > wrote the code below, this time, it involves no files but only
> > a pipe declared before a fork, and still, it works at command line
> > but display nothing on the browser.  I am starting to think
> > maybe I missed something very basic. Any idea?
> 
> 
> This really sounds more like a server issue.
> 
> I believe I'd be looking at my error log for clues....
> 
> 
> \s

Thank you all for your responses.  It was indeed a server issue.  We did 
not compile Perl/mod_perl with sfio for security reason and hence
system(), exec, pipe calls will not send output to the browser. I switched
to use backticks to launch Perl scripts and it seems to work fine.

Cheers,
SL


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

Date: Thu, 30 Sep 2004 10:17:36 -0500
From: "Billy N. Patton" <b-patton@ti.com>
Subject: sprintf problem
Message-Id: <cjh82g$8oo$1@home.itg.ti.com>

My code:
$lcname = 15;
print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
print sprintf("| %m.ns |\n",$lcname,4,'CELL');
print sprintf("| %mns |\n",$lcname,4,'CELL');
print sprintf("| %s |\n",'CELL');

The results:
| %-m.ns |
| %m.ns |
| %mns |
| CELL |


I need the 'CELL' left justified, padded with spaces and using $lcname 
space.

The camel book Pg 223 parag 1
The various combinations are fully documented in the manpage for 
printf(3), but we'll mention that m is typically the minimum length of a 
field (negative for left justified), and n is precision for exponential 
formats and the maximum length for other formats.  Padding is typically 
done with spaces for strings ...

-- 
    ___  _ ____       ___       __  __
   / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
  / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
            /___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455,  b-patton@ti.com


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

Date: Thu, 30 Sep 2004 17:44:21 +0200
From: Toni Erdmann <for-spammers-only@web.de>
Subject: Re: sprintf problem
Message-Id: <cjh9km$ft3$1@news.mch.sbs.de>

Billy N. Patton wrote:
> My code:
> $lcname = 15;
> print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
> print sprintf("| %m.ns |\n",$lcname,4,'CELL');
> print sprintf("| %mns |\n",$lcname,4,'CELL');
> print sprintf("| %s |\n",'CELL');
> 
> The results:
> | %-m.ns |
> | %m.ns |
> | %mns |
> | CELL |
> 
> 
> I need the 'CELL' left justified, padded with spaces and using $lcname 
> space.
> 
> The camel book Pg 223 parag 1
> The various combinations are fully documented in the manpage for 
> printf(3), but we'll mention that m is typically the minimum length of a 
> field (negative for left justified), and n is precision for exponential 
> formats and the maximum length for other formats.  Padding is typically 
> done with spaces for strings ...
> 

printf "| %-*.*s |\n", $lcname, 4, 'CELL';

'*' will be replaced by the value of the parameter.

Toni


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

Date: Thu, 30 Sep 2004 11:58:49 -0400
From: thundergnat <thundergnat@hotmail.com>
Subject: Re: sprintf problem
Message-Id: <cjhafe$t2o$1@bob.news.rcn.net>

Billy N. Patton wrote:
> My code:
> $lcname = 15;
> print sprintf("| %-m.ns |\n",$lcname,4,'CELL');
> print sprintf("| %m.ns |\n",$lcname,4,'CELL');
> print sprintf("| %mns |\n",$lcname,4,'CELL');
> print sprintf("| %s |\n",'CELL');


print sprintf("|%-".$lcname."s|\n",'CELL');


> 
> The results:
> | %-m.ns |
> | %m.ns |
> | %mns |
> | CELL |
> 
> 
> I need the 'CELL' left justified, padded with spaces and using $lcname 
> space.
> 
> The camel book Pg 223 parag 1
> The various combinations are fully documented in the manpage for 
> printf(3), but we'll mention that m is typically the minimum length of a 
> field (negative for left justified), and n is precision for exponential 
> formats and the maximum length for other formats.  Padding is typically 
> done with spaces for strings ...
> 


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

Date: Thu, 30 Sep 2004 14:59:35 -0500
From: Brian Troutwine <goofy_headed_punk@msn.com>
Subject: Symbolic algebra
Message-Id: <pan.2004.09.30.19.59.34.333004@msn.com>

I'm trying to write a program to output a Lagrange interpolating
polynomial.
http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html

So far what I'm getting is output that looks somewhat along the lines of:

((x-2)(x-3)(x-4)(x-5)(1)/(24))+
((x-1)(x-3)(x-4)(x-5)(2)/(-6))+
((x-1)(x-2)(x-4)(x-5)(6)/(4))+
((x-1)(x-2)(x-3)(x-5)(24)/(-6))+
((x-1)(x-2)(x-3)(x-4)(120)/(24))

What I want is to be able to take that and output it in the form of

Ax^n + Bx^(n-1) ... + C

Does anybody have the experience to tell me how to calculate symbolically?
(Specifically how to implement a symbolic algebra module.) 



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

Date: Thu, 30 Sep 2004 15:32:35 -0500
From: Brian Troutwine <goofy_headed_punk@msn.com>
Subject: Symbolic algebra
Message-Id: <pan.2004.09.30.20.32.33.632948@msn.com>

I'm trying to write a program to output a Lagrange interpolating
polynomial.
http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html

So far what I'm getting is output that looks somewhat along the lines of:

((x-2)(x-3)(x-4)(x-5)(1)/(24))+
((x-1)(x-3)(x-4)(x-5)(2)/(-6))+
((x-1)(x-2)(x-4)(x-5)(6)/(4))+
((x-1)(x-2)(x-3)(x-5)(24)/(-6))+
((x-1)(x-2)(x-3)(x-4)(120)/(24))

What I want is to be able to take that and output it in the form of

Ax^n + Bx^(n-1) ... + C

Does anybody have the experience to tell me how to calculate symbolically?
(Specifically how to implement a symbolic algebra module.) 


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

Date: Thu, 30 Sep 2004 21:59:52 GMT
From: "Fred Toewe" <ftoewe@austin.rr.com>
Subject: Re: Symbolic algebra
Message-Id: <sl%6d.1750$YT3.954@fe2.texas.rr.com>

"Brian Troutwine" <goofy_headed_punk@msn.com> wrote in message
news:pan.2004.09.30.20.32.33.632948@msn.com...
> I'm trying to write a program to output a Lagrange interpolating
> polynomial.
> http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html
>
> So far what I'm getting is output that looks somewhat along the lines of:
>
> ((x-2)(x-3)(x-4)(x-5)(1)/(24))+
> ((x-1)(x-3)(x-4)(x-5)(2)/(-6))+
> ((x-1)(x-2)(x-4)(x-5)(6)/(4))+
> ((x-1)(x-2)(x-3)(x-5)(24)/(-6))+
> ((x-1)(x-2)(x-3)(x-4)(120)/(24))
>
> What I want is to be able to take that and output it in the form of
>
> Ax^n + Bx^(n-1) ... + C
>
> Does anybody have the experience to tell me how to calculate symbolically?
> (Specifically how to implement a symbolic algebra module.)

There are three modules that you might try at Active .  All are in the Math
group: Math-Symbolic, Math-Approx-Symbolic, and
Math-SymbolicX-ParserExtensionFactory





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

Date: 30 Sep 2004 20:33:10 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Syntax appears inconsistent - why is this?
Message-Id: <slrnclorc6.hv.abigail@alexandra.abigail.nl>

Joe Smith (Joe.Smith@inwap.com) wrote on MMMMXLVIII September MCMXCIII in
<URL:news:TeS6d.146050$D%.55455@attbi_s51>:
%%  Paul Lalli wrote:
%%  
%% > "David Filmer" <ineverreadanythingsenttome@hotmail.com> wrote in message
%% >>enclose %food (not parens). I associate curlys with hashes.
%% > 
%% > Your association is incorrect.
%% > ( ) are used to create arrays and hashes.
%% > { } are used to create hash references
%% > [ ] are used to create array references
%%  
%%  I would phrase it differently.
%%     ( ) are used to build lists, which can populate arrays and hashes.

Eh, wrong. () seldomly build lists. It certainly doesn't in:

    my %hash = (key1 => 'val1', key2 => 'val2');

The parens in the above expression play exactly the same role as
they do in:

    my $val = 3 * (4 + 5);

They help the parser to construct a parse-tree.

%%     { } are used to create a reference to an anonymous hash.
%%     [ ] are used to create a reference to an anonymous array.


Abigail
-- 
END   {print "Hacker\n"}
INIT  {print "Perl "   }
BEGIN {print "Just "   }
CHECK {print "another "}


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

Date: 30 Sep 2004 13:56:05 -0700
From: bourgon@gmail.com (Michael Bourgon)
Subject: TableExtract question - how to deal with headers with spaces?
Message-Id: <558b578d.0409301256.da6c18b@posting.google.com>

I have an HTML table I'm trying to extract, using HTML::TableExtract. 
The problem I'm running into is that my table's header (1) are
sometimes on two lines, (2) have spaces in them.

I'm a perl newbie, so I'm a bit stumped.  I know that it looks for
field names by word, so I tried doing a "\ " after the word.  No dice.

Any suggestions?  Thanks.


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

Date: Thu, 30 Sep 2004 16:15:15 GMT
From: Ala Qumsieh <notvalid@email.com>
Subject: Re: tr problem
Message-Id: <niW6d.4629$nj.4258@newssvr13.news.prodigy.com>

Christian Winter wrote:
> Tad McClellan schrieb:
> 
>> IanW <onedoesnot@needto.know> wrote:
> 
> [...]
> 
>>
>>> Btw, I could shorten that regexp more by doing:
>>>
>>> $_ =~ s/^(\S+)/\U$1/;
>>
>>
>>
>>
>> If short is your goal, then you can improve it even further:
>>
>>    s/^(\S+)/\U$1/;
> 
> 
> Or even further:
> 
> s/^\S+/\U$&/;

Further still:

   s/\S+/\U$&/;

--Ala


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

Date: Thu, 30 Sep 2004 14:23:51 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: unicode: is decode-process-encode a "good" aproach?
Message-Id: <70et22-4g4.ln1@osiris.mauzo.dyndns.org>


Quoth peter pilsl <pilsl@goldfisch.at>:
> 
> I read parameters delivered by the webbrowser (html-header is always 
> UTF-8 !!), and want to sort and lowercase them and print them out again.
> I dont set STDIN and STDOUT to ":utf8",

I will say, as I often have: I would recommend using :encoding(utf8)
rather that :utf8, as you can then handle malformed utf8 properly.

> cause this does not work with 
> mod_perl.
> 
> 
> ....
> my $input=$cgi->param('myfield');
> utf8::decode($input);

I would use Encode::decode here, as you'll get better error handling.

<snip>
> So is it ok to get the data somehow "raw" from the webinterface, then 
> decode it, process it and encode it again to print it out or is this a 
> rather stupid approach?
> 
> Is it normal that I need to decode values delivered by an webpage that 
> has UTF-8 charset in its header?

If you haven't specified that the FH is utf8, then you'll have to decode it
by hand.

> Is it ok to clear the utf-8 flag to make sorting work in a locale-way 
> and set the flag again to make lc() work?  Or does this just show that 
> there is something wrong in my script?

Hmmmmmmm..... I think this is a bad idea. What if you have chars outside
ISO8859-1? I would strongly recommend using Encode::encode to convert it
to ISO8859-1 explicitly, and be prepared to handle errors.

If you read perlunicode it tells you that Unicode and locales currently
don't play nicely together; I'd probably recommend doing something like
this:

my $iso = Encode::encode 'iso8859-1' => $utf8;
{
    use locale;
    do_stuff_with($iso);
}
$utf8 = Encode::decode 'iso8859-1' => $iso;

so that you don't try and use unicode data when locales are switched on.

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                            ben@morrow.me.uk


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

Date: Thu, 30 Sep 2004 21:59:15 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: use require and loading modules
Message-Id: <cjhrr7$kue$1@sun3.bham.ac.uk>



Gunnar Hjalmarsson wrote:

> buildmorelines wrote:
> 
>> is there any way to load modules after the initial compilation, as
>> needed/on the fly/dynamically, so I wont be loading code that will
>> not get used?
> 
> 
>     require MyModule;
> 
> does just that, i.e. the module gets loaded only if and when that
> statement is executed.

I think the OP is really looking for autouse.



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

Date: Thu, 30 Sep 2004 21:38:21 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: use warnings, was Re: problem with rand on OSX
Message-Id: <slrnclov6d.gh1.dha@panix2.panix.com>

On 2004-09-30, ? the Platypus {aka David Formosa} <dformosa@zeta.org.au> wrote:
> "David H. Adler" <dha@panix2.panix.com> writes:
>
> [...]
>
>> For one thing the warnings pragma is more flexible than -w.  On the
>> other hand, if you're using a sufficiently old version of perl, it does
>> not exist.
>
> With 5.8.0 you could switch off -w dervived warnings using no warnings
> 'blah'; just as effectively as if you used use warnings;  And -w takes
> only two keypresses.

One might want to check out the section "What's wrong with -w and $^W"
in the perllexwarn page.  There may be some subtle bugs floating around
with this method.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Naturally, like you, I was incensed, and immediately used my
U.S. Second Amendment rights to buy a duffel bag full of machine guns
for a shooting spree at the office.   - Jon Orwant


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

Date: 30 Sep 2004 21:13:30 GMT
From: Csaba <root@localhost>
Subject: Who's responsible for this ?
Message-Id: <Xns9574E216AE493rs232@195.129.110.131>

 not exp log srand xor s qq qx xor
 s x x length uc ord and print chr
 ord for qw q join use sub tied qx
 xor eval xor print qq q q xor int
 eval lc q m cos and print chr ord
 for qw y abs ne open tied hex exp
 ref y m xor scalar srand print qq
 q q xor int eval lc qq y sqrt cos
 and print chr ord for qw x printf
 each return local x y or print qq
 s s and eval q s undef or oct xor
 time xor ref print chr int ord lc
 foreach qw y hex alarm chdir kill
 exec return y s gt sin sort split


-- 
Life is complex, with real and imaginary parts.


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

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


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