[22717] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4938 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 5 18:06:59 2003

Date: Mon, 5 May 2003 15:05:12 -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, 5 May 2003     Volume: 10 Number: 4938

Today's topics:
    Re: Calling subs using '&' form <mjcarman@mchsi.com>
    Re: Calling subs using '&' form (Tad McClellan)
    Re: Calling subs using '&' form (Tad McClellan)
    Re: Calling subs using '&' form <stevenm@bogus.blackwater-pacific.com>
    Re: Calling subs using '&' form <abigail@abigail.nl>
        Can't find string terminator " ' "  <samj@austarmetro.com.au>
    Re: Can't find string terminator " ' " <ian@WINDOZEdigiserv.net>
    Re: downloading a page <nobody@dev.null>
        escape sequencing problem in Perl (Prakash)
    Re: escape sequencing problem in Perl <kasp@epatra.com>
    Re: escape sequencing problem in Perl (Malcolm Dew-Jones)
    Re: escape sequencing problem in Perl <kasp@epatra.com>
        forcing downloads <mdudley@execonn.com>
    Re: forcing downloads (Malcolm Dew-Jones)
    Re: How to compress and uncompress the files using the  <occitan@esperanto.org>
    Re: how to disable Lingua::EN::NameParse print to stdou <bing-du@tamu.edu>
        HTML::TableExtract - cell attributes ? <myicq@gmx_fjernmig_.net>
        need solution for tv ratings handler script <nick@turnips.fsworld.co.uk>
    Re: Outrage (was Re: Newbie Problem: Cannot see result  <cwilbur@mithril.chromatico.net>
    Re: Passing hash and string to subroutine <richp1234@hotmail.com>
    Re: Passing hash and string to subroutine <REMOVEsdnCAPS@comcast.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 05 May 2003 09:37:07 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Calling subs using '&' form
Message-Id: <b95suj$s3d1@onews.collins.rockwell.com>

On 5/5/2003 8:22 AM, Sara wrote:
> "Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message 
> news:<Xns93723FFF34117sdn.comcast@216.166.71.239>...
>> 
>> If you call a subroutine with an & and with no parentheses, it will
>>  (for annoying historic reasons) inherit the current subroutine's
>> @_ (argument list).  This can be a source of bugs.
> 
> Hmm I didn't know that- and actually that could be handy sometimes.

It is, it's just often misused.

> The only time I ever felt I HAD to use &sub was when I was writing a
>  compiler, and I was using production calls as args like
> 
> multi(\&token);

Ah, but this is a different beast altogether. It isn't a call to
token(), it's a reference to it.

> @l=@{&$subx(\@l,1)}
> 
> where $subx contains the name of a sub I wanted to call.

The _name_? As in symbolic references? Better to use a real ref:

  my $subx = \&foo;
  @l = @{ $subx->(\@l, 1) };

Note the ->() syntax, which avoids the "inherit caller's @_" behavior.

I don't think the prototype subversion applies here, because I don't
think that anonymous subs can have (meaningful) prototypes. (Someone
please correct me if I'm mistaken.)

> my experience with the compiler showed me that sometimes the '&' is
> the only way to do what I wanted to do.

Yes, the trick is know when.

-mjc



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

Date: Mon, 5 May 2003 11:05:47 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Calling subs using '&' form
Message-Id: <slrnbbd2ur.1nr.tadmc@magna.augustmail.com>

Steve May <stevenm@bogus.blackwater-pacific.com> wrote:
> Eric J. Roode wrote:

>> Using & to invoke subroutines is not _inherently_ bad, but it has two
>> ramifications which will sometimes reach up and bite you in the ass. 
>> On the whole, it's nearly always better to omit the &.

> sub list_cheeses {
>      my $first_cheese = shift;
>      my $second_cheese = shift;
>      my $x = &do_something;
> }
> 
>> 
>> The reason your test code broke is that, at the point it was
>> compiling the "print_string(do_something)" line, it did not know that
>> do_something was a subroutine.  


Because do_something() was defined in a require'd file.


> In Perl, you may use strings without
>> quotes. The line you wrote was compiled as
>> "print_string('do_something')".  However, "use strict" forbids the
>> use of bareword strings, which is why your script got a compile-time
>> error.  
> 
> AHA! Context!


If you mean as in "scalar/list context", then no, that isn't
what is involved here.


>> The solution is to write
>> 
>>     print_string(do_something());
>> 
>> so that the compiler can tell it's a subroutine call.  Either that,
>> or define the do_something sub before you get to to the print_string
>> line.


Or, declare do_something() to be a subroutine before you get to to 
the print_string line:

   sub do_something;   # a forward declaration


> Though WHY does it not know it is a subroutine?


require happens at runtime.

Compiling happens at, well, compile time.  :-)


> The compiler HAD to see the sub when the required library was
> loaded.


When the compiler is compiling, it has NOT seen any run-time
effects yet.


> I'm not
> real certain why requiring an external file does not define
> the subroutines contained therin...
> 
> I'm tempted to regard this as a bug, or at least a bit odd.:-)


Resist the temptation.


You can force the require to happen "soon enough" with a BEGIN block:

   BEGIN{ require 'funcs.pl' }
   ...
   do_something;

 
-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 5 May 2003 11:10:36 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Calling subs using '&' form
Message-Id: <slrnbbd37s.1nr.tadmc@magna.augustmail.com>

Abigail <abigail@abigail.nl> wrote:
> Steve May (stevenm@bogus.blackwater-pacific.com) wrote on MMMDXXXIV
> September MCMXCIII in <URL:news:b94gri$ebk$1@quark.scn.rain.com>:
> ()  I've recently noted with interest responses to posts indicating that the 
> ()  '&' form of calling subs is a bad thing.
> 

> As you have already analized yourself,
> there are some differences between using '&sub', '&sub ()', 'sub ()'
> and 'sub'. As long as you are aware of the differences, feel free to
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> use '&' in front of user subroutines.


And the reason the topic comes up here regularly is that many posters
do not meet that predicate.  :-)    :-(


> Personally, I never used them, except in a few cases when dealing with
> code references. As direct subroutine calls, I won't.


I too never use & for subroutine _calls_, only for code refs.

I always use parens when calling non-built-in subs.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Mon, 05 May 2003 11:16:51 -0700
From: Steve May <stevenm@bogus.blackwater-pacific.com>
Subject: Re: Calling subs using '&' form
Message-Id: <b969fm$q44$1@quark.scn.rain.com>

Tad McClellan wrote:
> Steve May <stevenm@bogus.blackwater-pacific.com> wrote:
> 
>>Eric J. Roode wrote:
> 
> 
>>>Using & to invoke subroutines is not _inherently_ bad, but it has two
>>>ramifications which will sometimes reach up and bite you in the ass. 
>>>On the whole, it's nearly always better to omit the &.
> 
> 
>>sub list_cheeses {
>>     my $first_cheese = shift;
>>     my $second_cheese = shift;
>>     my $x = &do_something;
>>}
>>
>>
>>>The reason your test code broke is that, at the point it was
>>>compiling the "print_string(do_something)" line, it did not know that
>>>do_something was a subroutine.  
> 
> 
> 
> Because do_something() was defined in a require'd file.
> 

Hmmm.....

> 
> 
>>In Perl, you may use strings without
>>
>>>quotes. The line you wrote was compiled as
>>>"print_string('do_something')".  However, "use strict" forbids the
>>>use of bareword strings, which is why your script got a compile-time
>>>error.  
>>
>>AHA! Context!
> 
> 
> 
> If you mean as in "scalar/list context", then no, that isn't
> what is involved here.
> 

Well, not really in that sense, more as in Perl saying
"What ARE you asking me to do?" based on how I've structured
the call.

Perhaps not an entirely accurate way to express what is really
going on.

> 
> 
>>>The solution is to write
>>>
>>>    print_string(do_something());
>>>
>>>so that the compiler can tell it's a subroutine call.  Either that,
>>>or define the do_something sub before you get to to the print_string
>>>line.
> 
> 
> 
> Or, declare do_something() to be a subroutine before you get to to 
> the print_string line:
> 
>    sub do_something;   # a forward declaration
> 
> 
> 
>>Though WHY does it not know it is a subroutine?
> 
> 
> 
> require happens at runtime.
> 
> Compiling happens at, well, compile time.  :-)
> 
> 
> 
>>The compiler HAD to see the sub when the required library was
>>loaded.
> 
> 
> 
> When the compiler is compiling, it has NOT seen any run-time
> effects yet.
> 

Ah,  it starts to become clear now.  That was the source of
my confusion.  I hadn't thought of it as compile time vs
run time. Seems like I need to get a better grip on exactly
what happens at compile time vs during run time.

I will make it so.

> 
> 
>>I'm not
>>real certain why requiring an external file does not define
>>the subroutines contained therin...
>>
>>I'm tempted to regard this as a bug, or at least a bit odd.:-)
> 
> 
> 
> Resist the temptation.
> 

Ok, I'll limit temptation to more tangible objects. :-)

> 
> You can force the require to happen "soon enough" with a BEGIN block:
> 
>    BEGIN{ require 'funcs.pl' }
>    ...
>    do_something;
> 

Very nice.

Thanks Tad!


s.



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

Date: 05 May 2003 18:43:26 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Calling subs using '&' form
Message-Id: <slrnbbdc6e.fj.abigail@alexandra.abigail.nl>

Tad McClellan (tadmc@augustmail.com) wrote on MMMDXXXIV September
MCMXCIII in <URL:news:slrnbbd37s.1nr.tadmc@magna.augustmail.com>:
:)  Abigail <abigail@abigail.nl> wrote:
:) > Steve May (stevenm@bogus.blackwater-pacific.com) wrote on MMMDXXXIV
:) > September MCMXCIII in <URL:news:b94gri$ebk$1@quark.scn.rain.com>:
:) > ()  I've recently noted with interest responses to posts indicating that the 
:) > ()  '&' form of calling subs is a bad thing.
:) > 
:)  
:) > As you have already analized yourself,
:) > there are some differences between using '&sub', '&sub ()', 'sub ()'
:) > and 'sub'. As long as you are aware of the differences, feel free to
:)               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:) > use '&' in front of user subroutines.
:)  
:)  
:)  And the reason the topic comes up here regularly is that many posters
:)  do not meet that predicate.  :-)    :-(


But then they shouldn't program at all. Furthermore, Steve indicated
in his post he was aware of the differences.

:) > Personally, I never used them, except in a few cases when dealing with
:) > code references. As direct subroutine calls, I won't.
:)  
:)  I too never use & for subroutine _calls_, only for code refs.

I do occasionally use & for subroutine calls, as in

    &$coderef ($foo);

instead of

    $coderef -> ($foo);

Usually because the resulting layout is more appealing.

:)  I always use parens when calling non-built-in subs.

I only use parens if either the syntax requires it, or precedence requires it.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Mon, 05 May 2003 19:13:39 GMT
From: "Sam Jesse" <samj@austarmetro.com.au>
Subject: Can't find string terminator " ' " 
Message-Id: <3eb6b7e2@news.comindico.com.au>

Hello to all.
thanks for answering past questions I get to learn alot.
I am typing this at the C: but getting no where and don't know why
C:\>perl -MLWP::Simple -e 'getprint "http://www.sn.no/libwww-perl/"'
Can't find string terminstor "' " anywhere before EOF at -e line 1.
what am I missing?

thanks
Sam




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

Date: Mon, 05 May 2003 19:35:25 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Can't find string terminator " ' "
Message-Id: <u2fdbvov8p318s77631crjvakv71v5q42s@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Mon, 05 May 2003 19:13:39 GMT, "Sam Jesse"
<samj@austarmetro.com.au> amazingly managed to produce the following
with their Etch-A-Sketch:

> Hello to all.
> thanks for answering past questions I get to learn alot.
> I am typing this at the C: but getting no where and don't know why
> C:\>perl -MLWP::Simple -e 'getprint
> "http://www.sn.no/libwww-perl/"' Can't find string terminstor "' "
> anywhere before EOF at -e line 1. what am I missing?
> 
> thanks
> Sam
> 


Swap the ' and " around:


perl -MLWP::Simple -e "getprint 'http://www.sn.no/libwww-perl/'"



HTH.



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPra8hWfqtj251CDhEQJkUACdG3QbMbewTVmbMRlYeY+XLdeossEAoMWi
6f2MOK81KqxQnC9MzlxQ3sDi
=hU1j
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: Mon, 05 May 2003 16:50:15 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: downloading a page
Message-Id: <3EB695FD.3000508@dev.null>



Sam Jesse wrote:

> is there some good step by step reading on how to use
> the LWP. the documentations are not that simple.


Check out the LWP Cookbook at 
http://www.perldoc.com/perl5.6/lib/lwpcook.html


> later I will need to parse the html. do I save it to a file, or a place in
> memory or do it on the fly?  I guss I need to do more homework and if you
> can recommend some good LWP reading I will be greatful
> 
> thanks
> Sam
> 
> 
> 



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

Date: 5 May 2003 08:36:32 -0700
From: prakashpms@hotmail.com (Prakash)
Subject: escape sequencing problem in Perl
Message-Id: <afc6e663.0305050736.24be5040@posting.google.com>

Hi,

I have a perl variable with "\" characters. When I try to print the
variable, perl   consider it as a escape sequence and prints only the
rest of the string. How do I avoid this problem and print the "\" in
the perl variable.

Here is my program

#!/usr/bin/perl

$string = "\\\\\\\\foo#";

print "$string\n";


The above program prints "\\\\foo#", where I want it to print
"\\\\\\\\foo#".

Thanks
Prakash


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

Date: Mon, 5 May 2003 21:50:56 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: escape sequencing problem in Perl
Message-Id: <b9631q$4r1$1@newsreader.mailgate.org>

> The above program prints "\\\\foo#", where I want it to print
> "\\\\\\\\foo#".

This is correct. To print a single "\" you will have to escape it and hence
in the program it will appear as "\\".
To print 8 \'s your string should have twice the number of \'s i.e. 16.

--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.




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

Date: 5 May 2003 10:11:21 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: escape sequencing problem in Perl
Message-Id: <3eb69b39@news.victoria.tc.ca>

Kasp (kasp@epatra.com) wrote:
: > The above program prints "\\\\foo#", where I want it to print
: > "\\\\\\\\foo#".

: This is correct. To print a single "\" you will have to escape it and hence
: in the program it will appear as "\\".

except sometimes

	print q{\a}
	print q{\\a}

both print \a

This is convenient, but confusing when you have more than one \ .  


: To print 8 \'s your string should have twice the number of \'s i.e. 16.



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

Date: Mon, 5 May 2003 22:48:25 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: escape sequencing problem in Perl
Message-Id: <b966db$afq$1@newsreader.mailgate.org>

Yes, there is more than one way of doing it.

May I point the OP to quotemeta function which I find particularly useful
but less talked about.

--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.




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

Date: Mon, 05 May 2003 13:06:18 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: forcing downloads
Message-Id: <3EB69A0A.D8F2545B@execonn.com>

I have a customer who's web site I am doing who sells ebooks.  These
books come in several formats, pdf, html, zip, MS reader, rocket file,
Mobi file.

I have two problems.

The first problem is that I cannot find a mime type for some of these
formats.  Thus I have no idea what I should be putting in the content
type header part.

But more importantly if there is a way I can force the file to download,
that would be better.  The reason is that people end up purchasing the
book, then during the several days it can take to read it, end up with
the browser crashing or Windows crashing, or end up closing it out
prematurily.

Then they are unable to finish the book, and want to get it again free.

So what I need is to know if there is any type I can specify for them
that will always result in a download?

I tried this question in the html group, but I think eeryone there only
knows how to set types to do what you want from the windows user end,
not the server end.

Thanks,

Marshall



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

Date: 5 May 2003 13:37:00 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: forcing downloads
Message-Id: <3eb6cb6c@news.victoria.tc.ca>

Marshall Dudley (mdudley@execonn.com) wrote:
: I have a customer who's web site I am doing who sells ebooks.  These
: books come in several formats, pdf, html, zip, MS reader, rocket file,
: Mobi file.

: I have two problems.

and neither of them have anything to do with perl, so it's not clear why
you would post this here.  Also, a search of some kind, (google is often
used for this) would probably lead you to numerous answers for this/these
questions, or groups that deal with them.

: The first problem is that I cannot find a mime type for some of these
: formats.  Thus I have no idea what I should be putting in the content
: type header part.

The mime rfc has various suggestions to handle this situation.

: But more importantly if there is a way I can force the file to download,

No, this is always at the option of the brower, though it is true that
some data types are more likely to be handled by saving the data in a
file.

: that would be better.  The reason is that people end up purchasing the
: book, then during the several days it can take to read it, end up with
: the browser crashing or Windows crashing, or end up closing it out
: prematurily.

How is that a problem?  Surely the software accounts for that sort of
problem (doesn't it?).  What happens if the user has a transmission
problem during the initial transfer, perhaps someone picks up the phone in
the other room and the computers phone connection goes bad, how do you
handle that?


: Then they are unable to finish the book, and want to get it again free. 

Not really - they paid for it didn't they - you kind of owe it to them.  

: So what I need is to know if there is any type I can specify for them
: that will always result in a download?

As above, no.

: I tried this question in the html group, but I think eeryone there only
: knows how to set types to do what you want from the windows user end,
: not the server end.

The html group probably deals with text/html most of the time. 



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

Date: Mon, 5 May 2003 22:43:41 +0200
From: Daniel Pfeiffer <occitan@esperanto.org>
To: pkvinu@indiatimes.com (Vinod. K)
Subject: Re: How to compress and uncompress the files using the perl program
Message-Id: <20030505224341.5b6bb0fe.occitan@esperanto.org>

pkvinu@indiatimes.com (Vinod. K) skribis:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<b8l=
8gb$226$1@mamenchi.zrz.TU-Berlin.DE>...
> > Vinod. K <pkvinu@indiatimes.com> wrote in comp.lang.perl.misc:
> > > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> > > news:<b8ir0k$bl2$2@mamenchi.zrz.TU-Berlin.DE>...
> > > > Vinod. K <pkvinu@indiatimes.com> wrote in comp.lang.perl.misc:
> > > > > Hello All,

> > > > > I am having a bunch of compressed files(database files, i.e .dbf =
files
> > > > > whose size is more than 1GB) in one area. All these files need to=
 be
> > > > > uncompressed  one after the other and put them in other location =
using
> > > > > perl script. presently I used - system "uncompress" - statement i=
n my
> > > > > perl script which is consuming considerably more time. Just I want
> > > > > know is there any module or any other command in perl which will
> > > > > perform the above said activity in lesser time???

> > > > There may be such modules, but they won't run significantly faster.
> > > > All you can save is the call time for an external program.  The tim=
e-
> > > > consuming expansion will be the same in both cases.

> > > Hi Anno,
> > > Thanks for ur immediate response. Do you have any idea about those mo=
dules ???

> > Do a CPAN search at http://theoryx5.uwinnipeg.ca/CPAN/cpan-search.html.

> I didn't get any modules/scripts which satisfies my requirements.
> Anyway ,thanks,anno.

I don't think in this case startup time of an external program is significa=
nt.  On the contrary, the external program is in compiled C, which interpre=
ted Perl would have a hard time beating.

I don't know how it compares to uncompress timewise, but gunzip is fairly f=
ast, especially if you have the time to gzip -9 the files.  This saves much=
 disk-space compared to compress.

--=20
coralament / best Gr=F6tens / liebe Gr=FC=DFe / best regards / elkorajn sal=
utojn
Daniel Pfeiffer

-- GPL 3: take the wind out of Palladium's sails! --
 ------
  -- My other stuff here too, sawfish, make.pl...: --
   ------
    -- http://dapfy.bei.t-online.de/ --


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

Date: Mon, 05 May 2003 10:45:45 -0500
From: Bing Du Test <bing-du@tamu.edu>
To: Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
Subject: Re: how to disable Lingua::EN::NameParse print to stdout?
Message-Id: <3EB68729.B59A5201@tamu.edu>

This is the first four lines of the script.

==========
#!/usr/local/bin/perl

use locale;
use Lingua::EN::NameParse qw(clean case_surname);
<snip...>
==========

Code snippet of Lingua::EN::NameParse:

======
print STDERR "Assembling with: <$input_string>\n";
       $name = &_assemble($name);
       &_validate($name);

       if ( $name->{error} and $name->{auto_clean} )
       {
          $name->{input_string} = &clean($name->{input_string});
print STDERR "Assembling[2] with: <",$name->{input_string},">\n";
          $name = &_assemble($name);
          &_validate($name);
======

If calling it differently can redirect STDERR, I'd like to know.

Thanks,

Bing

Anno Siegel wrote:

> Bing Du Test  <bing-du@tamu.edu> wrote in comp.lang.perl.misc:
> > This is perl, v5.6.1 built for sun4-solaris.
> > Lingua::EN::NameParse version 1.18.
> >
> > Lingua::EN::NameParse has 'print' in it.  It spits the following stuff
> > when the module is called in my script.
> >
> > Assembling with: <blah blah>
> > Name = <Lingua::EN::NameParse=HASH(0x3e5f4)>, input_string = < blah
> > blah>
> >
> > I don't want to modify Lingua::EN::NameParse.pm itself.  Anyway to
> > disable the above module outputs?
>
> How are you calling it?  Neither Lingua::EN::NameParse.pm nor
> NameGrammar.pm contain any obvious print() or warn() statements, nor
> does Parse::RecDescent (which is used by Lingua::EN::NameParse).
>
> Anno



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

Date: Mon, 05 May 2003 20:27:15 GMT
From: TDJ <myicq@gmx_fjernmig_.net>
Subject: HTML::TableExtract - cell attributes ?
Message-Id: <Xns9372E4878AB22tdjtdjtdj@212.54.64.135>

I have hacked together a script using HTML::TableExtract, and has
finally made it work... sort of.

The data I parse on some occations force me to look at the attributes
of the table cells, to know the difference, example

    	<td class="p_text">this</td>
    	<td class="p_text_border">that</td>

--->>> is there any way I can bring this module to give the 
attributes of the cells ? 



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

Date: Mon, 05 May 2003 21:49:45 +0100
From: NJJH <nick@turnips.fsworld.co.uk>
Subject: need solution for tv ratings handler script
Message-Id: <42jdbvku2lpfiineuaop6qkuderdluk8oe@4ax.com>

hi,

I have scoured the web for an answer to this question but as I've
failed to find one I've come to usenet. The page I need a solution for
is at http://wave.prohosting.com/tvtoday/grid.htm

I have a large grid of checkboxes which form a 'TV diary' for ratings
capture purposes. I need a script which will do the following things:

1) Start a new log file every day at midnight. (This is, obviously,
important).

2) Not append users details, but add them to totals in a log file.
Also keep track of how many times an entry has been made.

ie, the beginning of the log would initially be:

0 (users)
0,0,0,0,0,0

but contributing user selects box 1 and 3 and the log becomes
1
1,0,1,0,0,0

another user selects box 1 and the line becomes
2
2,0,1,0,0,0

Also, how do I format the checkboxes so that a value of '0' is added
to the log totals when the form is submitted?

cheers,
Nick


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

Date: Mon, 05 May 2003 19:43:38 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Outrage (was Re: Newbie Problem: Cannot see result of .pl)
Message-Id: <87u1c9uqqg.fsf@mithril.chromatico.net>

Michael Eric Battle <you.gotta@be.kidding.com> writes:

> What I find incomprehensible is how a PHB will "standardize", 
> over the howling protests of his IT staff, on the braindead 
> Imperial "software" (because _he_'s comfortable only with 
> Outrage, because it's all he knows, because it came with his 
> executive laptop), then bear down on those same techies (whose 
> professional judgment he totally discounted the week before) 
> to "fix it" when he gets infected by malware.

I find it equally incomprehensible. 

I just found myself sending an email that said, in summary, "I told
you that this wouldn't work; I told you why it wouldn't work, and what
you would have to provide for me in order to make it work.  Now, I'm
glad that you finally noticed that it didn't work, but until you give
me what I told you it would take to make it work, there's remarkably
little I can do, and while <RECIPIENT'S NAME HERE> SAID SO is
sufficient justification to make *people* work long hours and get more
work done, I doubt the servers will respond to it."

My theory is that PHBs deal so much with politics and the art of the
possible, where the principal goal is not in figuring out how to do
something but convincing someone to do it, that the concept that the
computer simply *cannot* work faster (or the network carry more data)
is incomprehensible to them.  They're also focused on the large-scale
details ("ten-thousand foot view" is the current jargon) and don't
grasp how important the details are.  So, they manage hardware the
same way they manage people[1], and are honestly baffled when it fails
to respond to intimidation or cajoling.

Charlton



[1] An error to begin with:  people should be *led*, not *managed.*


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

Date: Mon, 05 May 2003 08:11:33 -0700
From: Rich Pasco <richp1234@hotmail.com>
Subject: Re: Passing hash and string to subroutine
Message-Id: <3EB67F25.8010308@hotmail.com>

Josef Möllers wrote:

> Barry Kimelman wrote:
> 
>> When you pass an array or hash as a parameter in a subroutine call, its
>> values are "unpacked" and placed into one long parameter list which is
>> received by the called subroutine. Therefor the called subroutine has no
>> way of knowing how to associate the values with arrays and hashes. What
>> you need to do is pass references for arrays and hashes.
> 
> TMTOWTDI, how about passing the hash/array as the last argument?
> 
> process_events($text,%criterion);
> 
> sub process_events {
>    my $body = shift;
>    my %criteria = @_;
> ...
> }

Passing the hash as the last element works too, but as the individual
parameters get assigned first, and then the elements of the hash get
paired up again.  However, I'm preferring passing the hash by reference
as it keeps its identity as a single unit, instead of breaking it up
into a sequence of indidividual terms and then pairing them up again.
My program isn't yet big enough that execution time is a consideration,
but my intuition is that the reference approach would be faster for
large hashes.

     - Rich



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

Date: Mon, 05 May 2003 16:17:55 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Passing hash and string to subroutine
Message-Id: <Xns9372AFF795F6sdn.comcast@216.166.71.239>

Rich Pasco <richp1234@hotmail.com> wrote in
news:3EB67F25.8010308@hotmail.com: 

> Josef Möllers wrote:
> 
>> Barry Kimelman wrote:
>> 
>> TMTOWTDI, how about passing the hash/array as the last argument?
>> 
>> process_events($text,%criterion);
>> 
>> sub process_events {
>>    my $body = shift;
>>    my %criteria = @_;
>> ...
>> }
> 
> Passing the hash as the last element works too, but as the individual
> parameters get assigned first, and then the elements of the hash get
> paired up again.  However, I'm preferring passing the hash by
> reference as it keeps its identity as a single unit, instead of
> breaking it up into a sequence of indidividual terms and then pairing
> them up again. My program isn't yet big enough that execution time is
> a consideration, but my intuition is that the reference approach would
> be faster for large hashes.

For large hashes this is true, but for everyday small data, the convenience 
of Barry's approach outweighs the speed issue.  Thus it is a very common 
idiom that all Perl programmers should know.

-- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;


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

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


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