[27935] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9299 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 15 03:05:56 2006

Date: Thu, 15 Jun 2006 00:05:07 -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, 15 Jun 2006     Volume: 10 Number: 9299

Today's topics:
    Re: <p>(.*)</p> Doesn't Work <tadmc@augustmail.com>
        Broken Pipe in Network Programming <janicehwang1325@yahoo.com>
    Re: can I trust on key %hash natural order? <filippo2991@virgilio.it>
    Re: can I trust on key %hash natural order? <john@castleamber.com>
    Re: can I trust on key %hash natural order? <hoosier45678@hotmail.com>
        Did not return a true value narra.madan@gmail.com
        Doc to PDF using Perl <scottp@noein.com>
    Re: Doc to PDF using Perl <spam@vecernik.at>
    Re: Earthquake and Tornado Forecasting Programs   June  <edgrsprj@ix.netcom.com>
    Re: Evaluating environment variables <glennj@ncf.ca>
    Re: Evaluating environment variables <uri@stemsystems.com>
        How To Pick Winning Stocks info@stockinvesting.com
    Re: multiple statements in the debugger <xicheng@gmail.com>
        new CPAN modules on Thu Jun 15 2006 (Randal Schwartz)
        reference to object method <hobosalesman@gmail.com>
    Re: reference to object method xhoster@gmail.com
    Re: reference to object method <attn.steven.kuo@gmail.com>
    Re: reference to object method <uri@stemsystems.com>
        Tk bug not fixed in CPAN <larry.grant.dc@gmail.com>
    Re: Tk bug not fixed in CPAN <larry.grant.dc@gmail.com>
    Re: Tk bug not fixed in CPAN <larry.grant.dc@gmail.com>
    Re: What is Expressiveness in a Computer Language <neelk@cs.cmu.edu>
    Re: What is Expressiveness in a Computer Language <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com>
    Re: What is Expressiveness in a Computer Language <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com>
        Why doesn't chdir (@args) work? <register_allocation@lycos.com>
    Re: Why doesn't chdir (@args) work? xhoster@gmail.com
    Re: Why doesn't chdir (@args) work? <not-for-email@example.com>
    Re: WIN32::PIPE bug ? <karl_zero@free.net>
    Re: WIN32::PIPE bug ? <rvtol+news@isolution.nl>
    Re: WIN32::PIPE bug ? <sisyphus1@nomail.afraid.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 14 Jun 2006 17:25:23 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: <p>(.*)</p> Doesn't Work
Message-Id: <slrne9136j.1pl.tadmc@magna.augustmail.com>

nsb_tsd@eml.cc <nsb_tsd@eml.cc> wrote:
> 
>> When trying to match HTML paragraphs using Perl:
> 
> I was just doing the same thing..



>     $content =~ m/navbar(.*)<\/TABLE><BR>/ism;


m//m affects the meaning of ^ and $, it is useless when
your pattern does not use those anchors.


>     my @info_to_keep = $tbl =~ m/<TD>(.*?)<\/TD>/img;


There is a module specifically for prying the data out of HTML tables:

   use HTML::TableExtract;


> s is for matching .* across \n's


Actually, m//s makes dot match a newline (whether the dot is asterisked or not).

> g matches multiple times, and the result is returned in list context.


The "g" modifier has absolutely no connection with the context that 
the m// operator is in!

It is the assignment (=) that puts the m// in list context, not
the "g" modifier.


> m is for multi-line matching, not sure if s is necessary when m is
> present.


They do different things, so the presence of one has nothing
to do with the other.

If you want dot to match a newline use "s".

If you want ^ and & to match "lines" rather than "strings", use "m".


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


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

Date: 14 Jun 2006 20:50:37 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Broken Pipe in Network Programming
Message-Id: <1150343437.807214.327140@u72g2000cwu.googlegroups.com>

Hi,

I have server running on localhost and a client is connected to it from
the same station, which is the localhost. However, when i try to
connect another client to the server, it gives me Broken pipe error in
the second client and the server side prompt that there is a
segmentation fault (core dumped). What is the cause of this problem and
how can i solve it?



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

Date: 14 Jun 2006 15:10:49 -0700
From: "filippo" <filippo2991@virgilio.it>
Subject: Re: can I trust on key %hash natural order?
Message-Id: <1150323049.381983.216620@y41g2000cwy.googlegroups.com>


Paul Lalli ha scritto:

> What is the *actual* problem you are trying to solve?

Thanks to everibody for the fast answer.

I have to calculate the bill for renting bungalow. The price depends on
the date:
 DATE          PRICE_LEVEL
mid june -> low price
mid jul -> med price
mid aug -> high
mid sept -> mid
mig oct -> low

I use Date::Calc to compare dates. Since my prices and dates are stored
into database, I have to fetch all data (date, price_level). I fetch
the records ordered by date and I store them into arrayref
(fetchall_arrayref) or hash_ref. My algorithm must read the records
from array (or hashes) ordered by data.

Another question: if an array is ordered, the command foreach (@array)
keeps the order?

Thanks,
Filippo



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

Date: 14 Jun 2006 22:57:09 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: can I trust on key %hash natural order?
Message-Id: <Xns97E2B69EFDDA0castleamber@130.133.1.4>

"filippo" <filippo2991@virgilio.it> wrote:

> 
> Paul Lalli ha scritto:
> 
>> What is the *actual* problem you are trying to solve?
> 
> Thanks to everibody for the fast answer.
> 
> I have to calculate the bill for renting bungalow. The price depends on
> the date:
>  DATE          PRICE_LEVEL
> mid june -> low price
> mid jul -> med price
> mid aug -> high
> mid sept -> mid
> mig oct -> low
> 
> I use Date::Calc to compare dates. Since my prices and dates are stored
> into database, I have to fetch all data (date, price_level).

Better: do the comparision with SQL. It can compare dates.

> Another question: if an array is ordered, the command foreach (@array)
> keeps the order?

Yes, but IMO you are putting your logic in the wrong place.

-- 
John Bokma          Freelance software developer
                                &
                    Experienced Perl programmer: http://castleamber.com/


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

Date: Wed, 14 Jun 2006 19:36:48 -0500
From: James <hoosier45678@hotmail.com>
Subject: Re: can I trust on key %hash natural order?
Message-Id: <pan.2006.06.15.00.36.42.962003@hotmail.com>

On Wed, 14 Jun 2006 12:07:36 -0700, filippo wrote:

> Hi,
> 
> I load my hash with my order, am I sure that the order is preserved on
> command 'foreach (key %myHash)?
> 
> BR,
> 
> Filippo

If you must:
http://www.foad.org/~abigail/Perl/Hash/Ordered.html




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

Date: 14 Jun 2006 23:39:10 -0700
From: narra.madan@gmail.com
Subject: Did not return a true value
Message-Id: <1150353550.530755.6190@i40g2000cwc.googlegroups.com>

hi,
i am getting the follwing error when ever i call a module from my pgm..
#################################################################
[Thu Jun 15 12:04:29 2006] [error] [client 127.0.0.1] Premature end of
script headers: Register.pl
Thu Jun 15 12:04:29 2006] [error] [client 127.0.0.1] Reg_Display.pm did
not return a true value at W:/cgi-bin/new/Register.pl line 13.
[Thu Jun 15 12:04:29 2006] [error] [client 127.0.0.1] BEGIN
failed--compilation aborted at W:/cgi-bin/new/Register.pl line 13.
################################################################
the code is as follows...

#!c:\perl\bin\perl
use warnings;
use strict;
BEGIN
{
unshift(@INC,"/cgi-bin/lib/register");
};
use CGI;
my($cgi);
use Reg_Display; <-"error occured here"
$cgi=CGI->new;
print $cgi->header('text/html');
print $cgi->start_html;
print<<"EOT";
i am in register
EOT
&Reg_Display::content_Display();
print $cgi->end_html;



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

Date: Wed, 14 Jun 2006 23:52:15 GMT
From: "Scott R. Prelewicz" <scottp@noein.com>
Subject: Doc to PDF using Perl
Message-Id: <Pi1kg.3397$oE3.1222@trndny04>

Can anyone suggest a good solution to convert MS Word docs to PDF 
programatically, using perl?

I tried installing and using abiword but I am having too many issues with 
the program, and I am looking for a different solution.
I searched CPAN and can only find Win32 mosules for doing something close, 
but I'm not on windows.

I am using FreeBSD. The .docs are uploaded resumes, and the client wants 
these to be converted to PDF automatically and stored on the server.

Thanks in advanced,

Scott





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

Date: Thu, 15 Jun 2006 02:22:47 +0200
From: Oliver Vecernik <spam@vecernik.at>
Subject: Re: Doc to PDF using Perl
Message-Id: <4490a857$0$12936$91cee783@newsreader02.highway.telekom.at>

Scott R. Prelewicz schrieb:
> Can anyone suggest a good solution to convert MS Word docs to PDF 
> programatically, using perl?

Not with Perl, but maybe this does what you want:

http://www.ooomacros.org/user.php#95532

Author DannyB:

http://www.oooforum.org/forum/profile.phtml?mode=viewprofile&u=479

-- 
Oliver


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

Date: Wed, 14 Jun 2006 22:17:43 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Earthquake and Tornado Forecasting Programs   June 13, 2006
Message-Id: <bW%jg.5901$lp.5192@newsread3.news.pas.earthlink.net>

>
> Oh for a newsreader that can eliminate all such ugly excessively
> cross-posted articles lacking follow-ups.  PLONK thread is the only
> remaining answer.
>

Posted by E.D.G.   June 14, 2006

In my opinion, even moderated Internet Newsgroups cannot provide the
necessary control for adequately protected scientific communications.  I
have in mind the development of a sophisticated Web site based Internet
Bulletin Board which past experiences indicate to me should work.  The Web
site running that bulletin board should be of interest to computer
programmers around the globe regardless of what programming language they
are using.




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

Date: 14 Jun 2006 22:51:43 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Evaluating environment variables
Message-Id: <slrne914nv.i06.glennj@smeagol.ncf.ca>

At 2006-06-14 05:49PM, prattm@gmail.com <prattm@gmail.com> wrote:
>  I am reading in a config file that has a bunch of absolute file paths,
>  most with embedded environment variables, such as:
>  
>  ${HOME}/bin/myscript.pl

Assuming you have braces around all your variable names:

    s/\${(.*?)}/$ENV{$1}/eg

-- 
Glenn Jackman
Ulterior Designer


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

Date: Wed, 14 Jun 2006 18:57:22 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Evaluating environment variables
Message-Id: <x7pshb1h2l.fsf@mail.sysarch.com>

>>>>> "GJ" == Glenn Jackman <glennj@ncf.ca> writes:

  GJ> At 2006-06-14 05:49PM, prattm@gmail.com <prattm@gmail.com> wrote:
  >> I am reading in a config file that has a bunch of absolute file paths,
  >> most with embedded environment variables, such as:
  >> 
  >> ${HOME}/bin/myscript.pl

  GJ> Assuming you have braces around all your variable names:

  GJ>     s/\${(.*?)}/$ENV{$1}/eg

you don't need /e as the replacement there is a valid string and doesn't
need to be evaled. and you will likely need to escape the { as perl will
interpret {} as a quantifier. i haven't tested that and i leave that as
an exercise to the OP.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Thu, 15 Jun 2006 03:41:11 GMT
From: info@stockinvesting.com
Subject: How To Pick Winning Stocks
Message-Id: <rF4kg.40483$hp.1202@read2.cgocable.net>


To pick winning stocks, you need the tools to separate
the companies with superior sales and profit growth from
the ones who are just making a lot of noise. Besides
choosing the right companies to invest in, you must
learn how to read the market's trend so that your timing
is right. 

And picking the next big winner based on the news is not
as likely as picking the next big loser. The news media's
time-frame is usually very short, sometimes just that
particular day! 

full article here:
http://www.swinginvesting.com/winning-stock-pick.html



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

Date: 14 Jun 2006 16:10:48 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: multiple statements in the debugger
Message-Id: <1150326648.871617.177070@c74g2000cwc.googlegroups.com>

avilella@gmail.com wrote:
> Hi all,
>
> I am using the perl debugger under Emacs, and for a long time I have
> wondered if
> there is a way to do trigger more than one statement at the same line.
>
> For example:
>
> Let's say I have a breakpoint at a place in my code, and at some point
> I want to do a:
>
> DB<2> c
>
> and after that I want to print the contents of something, like:
>
> DB<2> x @foo
>
> and I want to do this all over again, and again.
>
> Is there a way to do that in one line?
>
> Something like:
>
> DB<2> c ; x @foo
>
> At some point, then I will be able to do something like:
>
> DB<2> c ; x @foo; c ; x @foo2; c x @foo3 ; c; x @foo4; n; x @bar; n; n;
> x @bar2

Don't think you can make it this way. but if you want to get something
like "disp" in "gdb", you may want to use action 'a' or sometimes
watchpoint 'w'. for example, you set a break point at line-32.

DB<2> b 32
DB<3> a 32 print map "$_\n" @foo;

then every time your code runs pass this line-32, @foo will be printed
out automatically..you can set and unset multiple actions at the same
break point, but you can not use the debug-command 'x' to dump the
results, so it's not good for some complex data structures. a
workaround is:

    perl -MData::Dumper -d yourcode.pl

(dont know how you can do it in emacs though), and then

DB<3> a 32 print Dumper \@foo;

Another way I know is you can set a debug-command to be executed after
every "n", "s", "c", "r"......commands by the following way:

DB<2> { x \@foo

then every time after you type "n", "s", "c"...... you will get the
results of @foo.. But I guess this is not what you wanted.

XC



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

Date: Thu, 15 Jun 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jun 15 2006
Message-Id: <J0vx27.H31@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Class-DBI-Loader-Kinship-0.01
http://search.cpan.org/~ioannis/Class-DBI-Loader-Kinship-0.01/
Fixes to Class::DBI::Loader
----
Class-DBI-Plugin-AbstractCount-0.07
http://search.cpan.org/~jczeus/Class-DBI-Plugin-AbstractCount-0.07/
get COUNT(*) results with abstract SQL
----
DBIx-NamedQuery-0.10
http://search.cpan.org/~bolek/DBIx-NamedQuery-0.10/
Utilities for decoupling of Perl code and SQL statements
----
Dicop-Base-3.04
http://search.cpan.org/~bsi/Dicop-Base-3.04/
basics for a Dicop HTTP server/client
----
Dicop-Server-3.04
http://search.cpan.org/~bsi/Dicop-Server-3.04/
----
File-LibMagic-0.83
http://search.cpan.org/~fitzner/File-LibMagic-0.83/
Perlwrapper for libmagic
----
Finance-Bank-NetBranch-0.01
http://search.cpan.org/~kulp/Finance-Bank-NetBranch-0.01/
Manage your NetBranch accounts with Perl
----
Geo-Coder-Google-0.1
http://search.cpan.org/~jshirley/Geo-Coder-Google-0.1/
Geocoder that utilizes the public Google Geocoder API
----
Mail-DKIM-0.18
http://search.cpan.org/~jaslong/Mail-DKIM-0.18/
Signs/verifies Internet mail using DKIM message signatures
----
Nagios-Plugin-0.11
http://search.cpan.org/~tonvoon/Nagios-Plugin-0.11/
Object oriented helper routines for your Nagios plugin
----
OpenGuides-0.56
http://search.cpan.org/~dom/OpenGuides-0.56/
A complete web application for managing a collaboratively-written guide to a city or town.
----
PIX-Walker-1.03
http://search.cpan.org/~lifo/PIX-Walker-1.03/
Process Cisco PIX configs and 'walk' access-lists
----
Parse-CPAN-Packages-2.26
http://search.cpan.org/~lbrocard/Parse-CPAN-Packages-2.26/
Parse 02packages.details.txt.gz
----
Perl-Critic-0.17
http://search.cpan.org/~thaljef/Perl-Critic-0.17/
Critique Perl source code for best-practices
----
Perl-Tidy-20060614
http://search.cpan.org/~shancock/Perl-Tidy-20060614/
Parses and beautifies perl source
----
Rose-HTML-Objects-0.53
http://search.cpan.org/~jsiracusa/Rose-HTML-Objects-0.53/
Object-oriented interfaces for HTML.
----
Switch-Perlish-1.0.5
http://search.cpan.org/~broq/Switch-Perlish-1.0.5/
A Perlish implementation of the switch statement.
----
Term-Size-Perl-0.02
http://search.cpan.org/~ferreira/Term-Size-Perl-0.02/
Perl extension for retrieving terminal size (Perl version)
----
Term-Size-ReadKey-0.01
http://search.cpan.org/~ferreira/Term-Size-ReadKey-0.01/
Perl extension for retrieving terminal size (using Term::ReadKey)
----
Text-Same-0.02
http://search.cpan.org/~kim/Text-Same-0.02/
Look for similarities between files or arrays
----
Unicode-Escape-0.0.2
http://search.cpan.org/~itwarrior/Unicode-Escape-0.0.2/
Escape and unescape Unicode characters other than ASCII
----
Wifi-WpaCtrl-0.02
http://search.cpan.org/~flora/Wifi-WpaCtrl-0.02/
wpa_supplicant/hostapd control interface library


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 14 Jun 2006 16:59:06 -0700
From: "Hobo Salesman" <hobosalesman@gmail.com>
Subject: reference to object method
Message-Id: <1150329545.938966.208000@u72g2000cwu.googlegroups.com>

Can I store a reference to an object method in a scalar and use that to
call the method? Something like (and I'm sure this is wrong):

$methodRef = \$object->method();
&{$methodRef}($argument);



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

Date: 15 Jun 2006 01:15:48 GMT
From: xhoster@gmail.com
Subject: Re: reference to object method
Message-Id: <20060614211608.248$yE@newsreader.com>

"Hobo Salesman" <hobosalesman@gmail.com> wrote:
> Can I store a reference to an object method in a scalar and use that to
> call the method? Something like (and I'm sure this is wrong):
>
> $methodRef = \$object->method();
> &{$methodRef}($argument);


my $ref = sub { $object->method(@_) };

$ref->($argument);

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 14 Jun 2006 18:23:05 -0700
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: reference to object method
Message-Id: <1150334585.591878.167650@f6g2000cwb.googlegroups.com>

Hobo Salesman wrote:
> Can I store a reference to an object method in a scalar and use that to
> call the method? Something like (and I'm sure this is wrong):
>
> $methodRef = \$object->method();
> &{$methodRef}($argument);


Yes, an object method is just a subroutine
and one can store a reference to a subroutine.  You'll
have to make sure that you provide the right
invocant.  Here are a few examples:

#!/usr/bin/perl


package Sales;

my %motto = (
    Realtor  => 'Location, Location, Location',
    UsedCars => 'Another sucker born every minute',
);

sub new
{
    my $class = shift;
    my $field = shift;
    return undef unless $motto{$field};
    bless { $field, $motto{$field} }, $class;
}

sub motto
{
    my $self = shift;
    return values %$self;
}

1;

# file continues ...

package main;

use strict;
use warnings;
use Scalar::Util qw/blessed/;

my $obj1 = Sales->new('Realtor');
my $coderef = \&Sales::motto;
print $obj1->$coderef, "\n";

my $class = blessed $obj1;
my $coderef2 = \&{"$class" . "::motto"};
print $obj1->$coderef2, "\n";

print $coderef2->( $class->new('UsedCars') ), "\n";

-- 
Hope this helps,
Steven



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

Date: Thu, 15 Jun 2006 00:07:53 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: reference to object method
Message-Id: <x7wtbjysbq.fsf@mail.sysarch.com>

>>>>> "x" == xhoster  <xhoster@gmail.com> writes:

  x> "Hobo Salesman" <hobosalesman@gmail.com> wrote:
  >> Can I store a reference to an object method in a scalar and use that to
  >> call the method? Something like (and I'm sure this is wrong):
  >> 
  >> $methodRef = \$object->method();
  >> &{$methodRef}($argument);


  x> my $ref = sub { $object->method(@_) };

  x> $ref->($argument);

much better to use UNIVERSAL::can:

	my $meth = $obj->can( 'method_name' ) ;

	$meth->( $arg ) ;

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 14 Jun 2006 22:35:40 -0700
From: "Larry" <larry.grant.dc@gmail.com>
Subject: Tk bug not fixed in CPAN
Message-Id: <1150349740.735550.305780@h76g2000cwa.googlegroups.com>

I experiencing a Tk bug, whereby starting another program would crash
my Tk program.  I found a description of the bug here:
http://tinyurl.com/zbej3  and installed the patch it recommended
(http://m19s28.vlinux.de/estel/debian/perl-tk.deb), and it seems to
have worked.

My question is: why hasn't Tk been updated in CPAN to include this fix?
 The bug description describes the severity as "Critical" (and rightly
so!), and the patch file is dated Jan. 2006.  The Tk I used was just
installed from CPAN a few days ago.



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

Date: 14 Jun 2006 22:58:41 -0700
From: "Larry" <larry.grant.dc@gmail.com>
Subject: Re: Tk bug not fixed in CPAN
Message-Id: <1150351121.029946.124900@i40g2000cwc.googlegroups.com>

Larry wrote:
> I experiencing a Tk bug, whereby starting another program would crash
> my Tk program.  I found a description of the bug here:
> http://tinyurl.com/zbej3  and installed the patch it recommended
> (http://m19s28.vlinux.de/estel/debian/perl-tk.deb), and it seems to
> have worked.
>
> My question is: why hasn't Tk been updated in CPAN to include this fix?
>  The bug description describes the severity as "Critical" (and rightly
> so!), and the patch file is dated Jan. 2006.  The Tk I used was just
> installed from CPAN a few days ago.

I just checked CPAN on the web and saw that Tk was last updated in
2004!  (I hadn't noticed that during the installation, because I did it
from the CPAN command line).  What's up with that?!  Is Tk not being
used much these days?



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

Date: 14 Jun 2006 22:58:41 -0700
From: "Larry" <larry.grant.dc@gmail.com>
Subject: Re: Tk bug not fixed in CPAN
Message-Id: <1150351121.523228.157140@p79g2000cwp.googlegroups.com>

Larry wrote:
> I experiencing a Tk bug, whereby starting another program would crash
> my Tk program.  I found a description of the bug here:
> http://tinyurl.com/zbej3  and installed the patch it recommended
> (http://m19s28.vlinux.de/estel/debian/perl-tk.deb), and it seems to
> have worked.
>
> My question is: why hasn't Tk been updated in CPAN to include this fix?
>  The bug description describes the severity as "Critical" (and rightly
> so!), and the patch file is dated Jan. 2006.  The Tk I used was just
> installed from CPAN a few days ago.

I just checked CPAN on the web and saw that Tk was last updated in
2004!  (I hadn't noticed that during the installation, because I did it
from the CPAN command line).  What's up with that?!  Is Tk not being
used much these days?



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

Date: Wed, 14 Jun 2006 22:57:58 +0000 (UTC)
From: Neelakantan Krishnaswami <neelk@cs.cmu.edu>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <slrne9153m.fgj.neelk@gs3106.sp.cs.cmu.edu>

In article <4fb97sF1if8l6U1@individual.net>, Pascal Costanza wrote:
> Torben Ęgidius Mogensen wrote:
> 
>> On a similar note, is a statically typed langauge more or less
>> expressive than a dynamically typed language?  Some would say less, as
>> you can write programs in a dynamically typed language that you can't
>> compile in a statically typed language (without a lot of encoding),
>> whereas the converse isn't true.
> 
> It's important to get the levels right here: A programming language
> with a rich static type system is more expressive at the type level,
> but less expressive at the base level (for some useful notion of
> expressiveness ;).

This doesn't seem obviously the case to me. If you have static
information about your program, the compiler can use this information
to automate a lot of grunt work away.

Haskell's system of typeclasses work this way. If you tell the
compiler how to print integers, and how to print lists, then when you
call a print function on a list of list of integers, then the compiler
will automatically figure out the right print function using your base
definitions. This yields an increase in Felleisen-expressiveness over
a dynamically typed language, because you would need to globally
restructure your program to achieve a similar effect.

More dramatic are the "polytypic" programming languages, which let you
automate even more by letting you write generic map, fold, and print
functions which work at every type.

> This doesn't seem to capture what I hear from Haskell programmers
> who say that it typically takes quite a while to convince the
> Haskell compiler to accept their programs. (They perceive this to be
> worthwhile because of some benefits wrt correctness they claim to
> get in return.)

This is true, if you are a novice learning the language, or if you are
an expert programming with good style.

If you encode your invariants in the types, then type errors will
signal broken invariants. But: learning how to use the type system to
encode significantly complex invariants (eg, that an abstract syntax
tree representing an HTML document actually satisfies all of the
constraints on valid HTML) takes experience to do well.

-- 
Neel Krishnaswami
neelk@cs.cmu.edu


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

Date: Thu, 15 Jun 2006 01:42:33 -0400
From: Raffael Cavallaro <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <2006061501423327544-raffaelcavallaro@pasdespamsilvousplaitmaccom>

On 2006-06-14 15:04:34 -0400, Joachim Durchholz <jo@durchholz.org> said:

> Um... heterogenous lists are not necessarily a sign of expressiveness. 
> The vast majority of cases can be transformed to homogenous lists 
> (though these might then contain closures or OO objects).
> 
> As to references to nonexistent functions - heck, I never missed these, 
> not even in languages without type inference :-)
> 
> I don't hold that they are a sign of *in*expressiveness either. They 
> are just typical of highly dynamic programming environments such as 
> Lisp or Smalltalk.

This is a typical static type advocate's response when told that users 
of dynamically typed languages don't want their hands tied by a type 
checking compiler:

"*I* don't find those features expressive so *you* shouldn't want them."

You'll have to excuse us poor dynamically typed language rubes - we 
find these features expressive and we don't want to give them up just 
to silence a compiler whose static type checks are of dubious value in 
a world where user inputs of an often unpredictable nature can come at 
a program from across a potentially malicious internet making run-time 
checks a practical necessity.



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

Date: Thu, 15 Jun 2006 01:58:24 -0400
From: Raffael Cavallaro <raffaelcavallaro@pas-d'espam-s'il-vous-plait-mac.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <2006061501582450878-raffaelcavallaro@pasdespamsilvousplaitmaccom>

On 2006-06-14 16:36:52 -0400, Pascal Bourguignon <pjb@informatimago.com> said:

> In lisp, all lists are homogenous: lists of T.

CL-USER 123 > (loop for elt in (list #\c 1 2.0d0 (/ 2 3)) collect 
(type-of elt))
(CHARACTER FIXNUM DOUBLE-FLOAT RATIO)

i.e., "heterogenous" in the common lisp sense: having different dynamic 
types, not in the H-M sense in which all lisp values are of the single 
union type T.



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

Date: Thu, 15 Jun 2006 02:43:31 GMT
From: "register_allocation" <register_allocation@lycos.com>
Subject: Why doesn't chdir (@args) work?
Message-Id: <nP3kg.13122$921.10188@newsread4.news.pas.earthlink.net>

The following code doesn't work for me:

    	@args = ('..');
    	chdir (@args) || die "Can't cd @args: $!";

It dies with "Can't ch ..: No such file or directory.  Same thing 
if I initialize @args = ();

However, the direct way of calling chdir works fine:

    	chdir ".." || die "Can't cd ..: $!";
    	print "ok\n";

prints "ok".  This happens under Windows/ActiveState v5.8.8 and
Linix v5.8.0.

Shouldn't this work like I expect?  I thought (unless there is a
prototype in scope) calling

    	foo (@args);

had the effect of mapping @args onto foo's @_ array.  Does chdir
have a prototype?  I havent seen one mentioned in the docs...

Thanks for any help,
register_allocation


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

Date: 15 Jun 2006 03:02:47 GMT
From: xhoster@gmail.com
Subject: Re: Why doesn't chdir (@args) work?
Message-Id: <20060614230307.749$WU@newsreader.com>

"register_allocation" <register_allocation@lycos.com> wrote:
> The following code doesn't work for me:
>
>         @args = ('..');
>         chdir (@args) || die "Can't cd @args: $!";
>
> It dies with "Can't ch ..: No such file or directory.  Same thing
> if I initialize @args = ();
>
> However, the direct way of calling chdir works fine:
>
>         chdir ".." || die "Can't cd ..: $!";
>         print "ok\n";
>
> prints "ok".  This happens under Windows/ActiveState v5.8.8 and
> Linix v5.8.0.
>
> Shouldn't this work like I expect?  I thought (unless there is a
> prototype in scope) calling
>
>         foo (@args);
>
> had the effect of mapping @args onto foo's @_ array.  Does chdir
> have a prototype?

$ perl -le 'print prototype("CORE::chdir")'
;$

Yep, it does.  So @args is in a scalar context and is evaluated to 1.
Presumably, there is no directory named "1".

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Thu, 15 Jun 2006 03:05:56 GMT
From: Spurrious Umlaut <not-for-email@example.com>
Subject: Re: Why doesn't chdir (@args) work?
Message-Id: <o84kg.13130$921.7784@newsread4.news.pas.earthlink.net>

"register_allocation" <register_allocation@lycos.com> wrote in 
news:nP3kg.13122$921.10188@newsread4.news.pas.earthlink.net:

> [...] Does chdir
> have a prototype?  I havent seen one mentioned in the docs...

I figured it out.  Looks like it's prototyped as chdir(;$),
which would force a scalar context on the argument list.
I tried

    	@args = ('..');
    	chdir @args;

in a directory with a sub-directory named "1", and sure enough
it worked and changed into the "1" directory.

-ra


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

Date: Thu, 15 Jun 2006 00:56:32 -0400
From: karl zero <karl_zero@free.net>
Subject: Re: WIN32::PIPE bug ?
Message-Id: <2O5kg.36525$G97.713505@weber.videotron.net>

Sisyphus wrote:
> 
> Sounds like it. Can you post some *minimal* server and client code that
> demonstrates the problem ? ... preferably so that the server and client
> script run on the same machine.

see below, made of the example from roth's website and slightly modified 
with an infinite loop
run the server, then the client and look at the server process memory usage.


server:

#!/usr/bin/perl -w

use Win32::Pipe;

$PipeName = "test";
$| = 1;

print "Creating pipe \"$PipeName\".\n";

if( $Pipe = new Win32::Pipe( $PipeName ) )
{
     print "Waiting for a client to connect...\n";

     if( $Pipe->Connect() )
     {
         my $In;

         while ($In = $Pipe->Read()) {
              print "Client sent us: ".$In."";
         }
         $Pipe->Disconnect();
   }
   $Pipe->Close();
}


client:


use Win32::Pipe;

$PipeName = "\\\\.\\pipe\\test";
print "Connecting to $PipeName\n";

if( $Pipe = new Win32::Pipe( $PipeName ) )
{
   print "\nPipe has been opened, writing data to it...\n";
   my $Data;

   while (1) {
     $Data = "Time on " . Win32::NodeName() . " is: " . localtime() . "\n";
     $Pipe->Write( $Data );
   }
   $Pipe->Close();
}




> 
> I ran the following server script:
> 
> --- server.pl ---
> use warnings;
> use Win32::Pipe;
> 
> while(1) {
>      $pipe = new Win32::Pipe("mypipe");
>      if(!defined($pipe)) {die "Error 1"}
> 
>      $ok = $pipe->Connect();
>      if(!$ok) {warn "Something is not right on the server side\n"}
> 
>      $data = $pipe->Read();
> 
>      print"Client sent: ",  $data, "\n";
> 
>      $pipe->Disconnect();
> 
>      $pipe->Close();
> }
> __END__
> --------------
> 
> And then tried the following client script (from a different cmd console on
> the same machine):
> 
> --- client1.pl ---
> use warnings;
> use Win32::Pipe;
> 
> $cl_pipe = new Win32::Pipe("\\\\.\\pipe\\mypipe");
> 
> if(!defined($cl_pipe)) {die "Error 1"}
> 
> $ok = $cl_pipe->Write("Howdy! This is cool!");
> if(!$ok) {warn "Something is not right on the client side\n"}
> 
> $cl_pipe->Close(); # makes no difference if I remove this line
> __END__
> ----------------
> 
> The server script stays alive, but the client script simply connects once,
> sends its message and exits. For some reason, every time I run the client
> script, the server script outputs:
> 
> Client sent: Howdy! This is cool!
> Something is not right on the server side
> Use of uninitialized value in print at server.pl line 13.
> Client sent:
> 


I cannot reproduce your problem, may be something related to the module 
version (mine is latest : 20030419 , which i took directly from roth 
site, latest activestate perl8 distro is not up to date with WIN32::Pipe)
to make it short, your two scripts are behaving as expected here, no 
error reported.
although the creation of a new pipe object in each iteration is not 
optimal, a call to connect/disconnect inside the loop is enough to 
achieve the same effect.


> Some how or other the blocking fails every second time ... and I don't see
> much point in looking for memory leaks until I get that bit sorted out.
> Maybe I'm doing something stupid - which is one reason that it would be
> useful to see what you have been doing. (The other reason is that it would
> have saved me the bother of writing test scripts :-)
> 
> Incidentally, I normally use IO::Socket for this sort of thing on Win32
> (where I'm actually transferring files from one computer to another) and
> have found it to be quite reliable .... not that I've ever checked for
> memory leakage.
> 
> I've not seen questions about Win32::Pipe before - I wonder how extensively
> it has been used.
> 

Looks like some scenario have been overlooked during the testing phase.
or is it just me ?

> For the cliet script did you try the open() option:
> open( PIPE, "< \\\\server\\pipe\\My Named Pipe" );
> 
> If so, did that make any difference to the behaviour ?
> 

i tried this trick on the client side and memory usage was normal.
This memory leak would likely be triggered with a call to $Pipe->Read() 
method, so far it never happened after a call to Write().
Also, i would rather like to avoid calling open when i use a Pipe object 
on my other script, i find it dirty :)

How do my snipets behave on your host, see the memory leak ?
Karl.

> Cheers,
> Rob
> 
> 


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

Date: Thu, 15 Jun 2006 08:05:40 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: WIN32::PIPE bug ?
Message-Id: <e6r52l.164.1@news.isolution.nl>

Sisyphus schreef:


Some alternatives for your code, assuming that $^E contains relevant
error information:

> use warnings;

  use strict ;
  use warnings ;


>      $pipe = new Win32::Pipe("mypipe");
>      if(!defined($pipe)) {die "Error 1"}

       my $pipename = 'mypipe' ;
       my $pipe = new Win32::Pipe( $pipename )
           or die "Error 1 with '$pipename': $^E, stopped" ;

(replace the  ", stopped"  by  "\n"  if you don't want the "at line
#\n")


>      $ok = $pipe->Connect();
>      if(!$ok) {warn "Something is not right on the server side\n"}

       $pipe->Connect()
           or warn "Problem on the server side: $^E" ;


>      print"Client sent: ",  $data, "\n";

       print "Client sent: $data\n" ;


> $cl_pipe = new Win32::Pipe("\\\\.\\pipe\\mypipe");
> if(!defined($cl_pipe)) {die "Error 1"}

  my $pipename = '//./pipe/mypipe' ;
  my $cl_pipe = new Win32::Pipe( $pipename )
      or die "Error 1 with '$pipename': $^E, stopped" ;


> $ok = $cl_pipe->Write("Howdy! This is cool!");
> if(!$ok) {warn "Something is not right on the client side\n"}

  $cl_pipe->Write( 'Howdy! This is cool!' )
      or warn "Problem on the client side: $^E" ;


> open( PIPE, "< \\\\server\\pipe\\My Named Pipe" );

  my $pipename = '//server/pipe/My Named Pipe' ;
  open my $pipe, '<',  $pipename
      or die "Error with open '$pipename': $!, stopped" ;

-- 
Affijn, Ruud

"Gewoon is een tijger."




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

Date: Thu, 15 Jun 2006 16:33:39 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: WIN32::PIPE bug ?
Message-Id: <4491005d$0$31402$afc38c87@news.optusnet.com.au>


"karl zero" <karl_zero@free.net> wrote in message
news:2O5kg.36525$G97.713505@weber.videotron.net...
> Sisyphus wrote:
> >
> > Sounds like it. Can you post some *minimal* server and client code that
> > demonstrates the problem ? ... preferably so that the server and client
> > script run on the same machine.
>
> see below, made of the example from roth's website and slightly modified
> with an infinite loop
> run the server, then the client and look at the server process memory
usage.
>

Yes - I now see the mistake I made in the code I had tried - one should do a
$Pipe->Read() if and only if $Pipe->Connect() returns true.

However, using the scripts you supplied (below) I don't get any memory
leaks. I let it run for a couple of minutes and memory usage remained
constant. If there's a leak there on my machine it must be a very slow one.
I inserted a 'print $$' into the 2 scripts so that I knew what their
repective PID's were, and kept an eye on the memory usage for both of those
PID's on Task Manager's 'Processes' page. I also kept an eye on the total
memory usage (which is visible at the bottom of the Task Manager window, no
matter which page you happen to be on). Everything remained constant -
though the total memory usage fluctuated a little from time to time. I
didn't see anything untoward.

What version of perl are you using ?
If you're running ActiveState perl, which build ?
Which version of Win32::Pipe are you running ?

I'm running perl 5.8.8, AS build 817, Win32:Pipe-0.22:

E:\>perl -e "print $ActivePerl::VERSION"
817
E:\>perl -MWin32::Pipe -e "print $Win32::Pipe::VERSION"
0.022
E:\>

Cheers,
Rob

>
> server:
>
> #!/usr/bin/perl -w
>
> use Win32::Pipe;
>
> $PipeName = "test";
> $| = 1;
>
> print "Creating pipe \"$PipeName\".\n";
>
> if( $Pipe = new Win32::Pipe( $PipeName ) )
> {
>      print "Waiting for a client to connect...\n";
>
>      if( $Pipe->Connect() )
>      {
>          my $In;
>
>          while ($In = $Pipe->Read()) {
>               print "Client sent us: ".$In."";
>          }
>          $Pipe->Disconnect();
>    }
>    $Pipe->Close();
> }
>
>
> client:
>
>
> use Win32::Pipe;
>
> $PipeName = "\\\\.\\pipe\\test";
> print "Connecting to $PipeName\n";
>
> if( $Pipe = new Win32::Pipe( $PipeName ) )
> {
>    print "\nPipe has been opened, writing data to it...\n";
>    my $Data;
>
>    while (1) {
>      $Data = "Time on " . Win32::NodeName() . " is: " . localtime() .
"\n";
>      $Pipe->Write( $Data );
>    }
>    $Pipe->Close();
> }
>




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

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


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