[26820] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8854 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 15 18:05:28 2006

Date: Sun, 15 Jan 2006 15:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 15 Jan 2006     Volume: 10 Number: 8854

Today's topics:
        Blather-Adjusting Programs vjp2.at@at.BioStrategist.dot.dot.com
    Re: ExpatXS: 'Can't call method "read" on an undefined  xhoster@gmail.com
    Re: ExpatXS: 'Can't call method "read" on an undefined  <matthew.garrish@sympatico.ca>
    Re: ExpatXS: 'Can't call method "read" on an undefined  xhoster@gmail.com
    Re: ExpatXS: 'Can't call method "read" on an undefined  <nomail@sorry.com>
    Re: ExpatXS: 'Can't call method "read" on an undefined  <nomail@sorry.com>
    Re: ExpatXS: 'Can't call method "read" on an undefined  <nomail@sorry.com>
        Strategy about browser cache and generated pages <d.larylor@globalinc.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 15 Jan 2006 19:35:06 +0000 (UTC)
From: vjp2.at@at.BioStrategist.dot.dot.com
Subject: Blather-Adjusting Programs
Message-Id: <dqe85a$2mq$4@reader2.panix.com>


   You folks mean to tell me there's no program out there that would
take a file of simple text and blatherise it to the level of another
"reference" file? Or Adjust the "Fog Index" of a text file up or down
from its input level. I'm totally serious. I'm tired of fighting.
I just want to "get along".

Message-ID: <dn55rq$mov$1@reader2.panix.com>

   I'm sure I've seen programs that generate blather but now I
can't find one.  I'm stuck in a wierd situation that comes up often
enough:  Some third-worlders insist you write pretentious casuistry
when a few simple words are enough. It is sad in these day of "Fog
Index" that we have people who are commitedly ideological and even
theologically dogmatic about making prose incomprehensibly obfuscated
and complicated. I want it in perl so it can be extremely portable.

   However, I want something I can control. For example, when it sees
the word "customer" or "strategy" it should randomly chose one of
three flowing phrases.  I can write a simple one-to-one in sed, but I
really hope some ingenious soul has already compiled a blatherisation
table that I only need to tweak.  The issue is the text should require
no more than, say, ten percent editing to make it seem like it came
from a genuinely glib casuistrous bullshit artist.

   I wouldn't mind if the program is ingenious enough to go both ways,
or even to be adjustable (ie, "please set the fog index").  I am
confronted with enough blathermaniacs and antiblathermaniacs to make
my life way too complicated. By the time I get used to one lunatic, I
have to instead conform to the other.  

Message-ID: <do5j5i$2da$3@reader1.panix.com>

I think you could broadly generalise the most common writing styles are:

   1. Cryptic misappropriated connotation (demanded by "scholars")
   2. Telegraphic commercial (Taught by "Communications" programs)
   3. Latinate bureaucratic (demanded by 3rd world bureaucrats)
   4. Literary Synonymania (demanded by "English" professors/teachers)

   And these variances seem to be used to discriminate and segregate
dogmatically and unfairly. "Can't we just all get along?"

Message-ID: <dnvsup$p3u$1@reader1.panix.com>

   I went hunting on google for "chatterbot perl knowledge base". I
"knew" Hugh Kenner back on BiX ca 1988.  Foggy is a riot, but not what
I needed, though I think sometime it may prove valuable when 
frustration with fools triggers my evil streak.  I need foggy with a
twist - a knowledge base I can tweak like foggy, but it should take a
simple paragraph and turn it into a long blatherous paper that I can
then spend a few minutes editing and it will say pretty much the same
thing as my simple paragraph.  For example I write "The customer is a
petunia" and it writes "Our customers are very important to us. One of
our multifarous customers has proven to be a petunia. Wheretofore and
heretofore, this important,vaulabel and significant datum will be
assessed strategically and applied to our models wherefrom we shall
therefore optimise our tactics, strategy and operations so that we
fully capture the economic benefits derivable from this customer."
One form would work with a knowledge base where it is triggered by
words like customer and petunia into random but reasonably meaningful
ramblings. The other would be even better if it took a file with
writing similar to the target and transformed the source using the
target as a model (for style and size). I would really wish this was
in perl so I could use it on the fly anywhere!


nyc.transit Tue, 20 Dec 2005 23:19:28 +0000 (UTC)

   You remind me of how my folks got mistreated. They spoke with a
heavy accent but at the university level.  A lot of academics would
love to converse endlessly with their precise and inquiring minds.
Some "customer service" types would just hang up the phone when they
heard the accent. One of my English teachers couldn't get over it how
my folks had the nerve to correct her spelling.

   I was born here and once I had a boss say that the reason I
disgreed on policy issues was I needed to improve my writing since I
was Greeks and sent me to a writing class (she was Cuban and spoke
with an accent, but I don't have an accent). Once someone asked me
"You speak English so well, when did you come here" I looked at my
watch and said "Oh, about 120 yrs ago." (Technically true, though my
stowaway ancestors got sent back a month later) I once went to speak
to a dean about something and he mentioned the essence of the
conversation to a reporter and I saw in print that he described me as
a foreign student (he, too, had an accent and was foreign born). When
a previous president of my alma mater was introduced to alums, he saw
my name badge and said "Ohhhh, Greek" shaking his head knowingly as I
was seriously thinking of swatting him on the head like a fly.



				- = -
    Vasos-Peter John Panagiotopoulos II, Columbia'81+, Bio$trategist
	      BachMozart ReaganQuayle EvrytanoKastorian
       http://ourworld.compuserve.com/homepages/vjp2/vasos.htm
  ---{Nothing herein constitutes advice.  Everything fully disclaimed.}---
   [Homeland Security means private firearms not lazy obstructive guards]
 [Fooey on GIU,{MS,X}Windows 4 Bimbos] [Cigar smoke belongs in veg food group]


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

Date: 15 Jan 2006 21:09:30 GMT
From: xhoster@gmail.com
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <20060115160930.889$50@newsreader.com>

"Matt Garrish" <matthew.garrish@sympatico.ca> wrote:
> "Arvin Portlock" <nomail@sorry.com> wrote in message
> news:dq9gb7$219p$1@agate.berkeley.edu...
> > In using ExpatXS to parse large batches of XML files
> > something curious happens. After parsing something close
> > to 500 files the program crashes with the error:
> >
> > Can't call method "read" on an undefined value at
> > /xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
> > XML/SAX/ExpatXS.pm line 155.
> >
>
> You aren't checking whether you succesfully get an object. I would doubt
> it's a memory leak or your system would have ground to a halt.

But it could easily be a file-handle leak.  Around 500 would be a common
per-process limit on open file-handles.

Xho

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


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

Date: Sun, 15 Jan 2006 16:32:26 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <Hbzyf.5937$xk1.69804@news20.bellglobal.com>


<xhoster@gmail.com> wrote in message 
news:20060115160930.889$50@newsreader.com...
> "Matt Garrish" <matthew.garrish@sympatico.ca> wrote:
>> "Arvin Portlock" <nomail@sorry.com> wrote in message
>> news:dq9gb7$219p$1@agate.berkeley.edu...
>> > In using ExpatXS to parse large batches of XML files
>> > something curious happens. After parsing something close
>> > to 500 files the program crashes with the error:
>> >
>> > Can't call method "read" on an undefined value at
>> > /xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
>> > XML/SAX/ExpatXS.pm line 155.
>> >
>>
>> You aren't checking whether you succesfully get an object. I would doubt
>> it's a memory leak or your system would have ground to a halt.
>
> But it could easily be a file-handle leak.  Around 500 would be a common
> per-process limit on open file-handles.
>

That seems more likely. I just wonder what the read method is that is being 
called on what undefined object. It's not a particularly helpful error 
message. It could be coming right from Expat from the sound of it.

Matt 




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

Date: 15 Jan 2006 22:30:36 GMT
From: xhoster@gmail.com
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <20060115173036.153$F8@newsreader.com>

Arvin Portlock <nomail@sorry.com> wrote:
> In using ExpatXS to parse large batches of XML files
> something curious happens. After parsing something close
> to 500 files the program crashes with the error:
>
> Can't call method "read" on an undefined value at
> /xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
> XML/SAX/ExpatXS.pm line 155.
>
> Of course I examined the files where the errors occurred
> and there is nothing wrong with them. I can do this on any
> batch of files and get the same problem--permissions are
> always set correctly, the files are confirmed well-formed,
> etc.
>
> Sounds like something's leaking.
>
> I reduced my big complex program down to something very
> simple which doesn't actually do anything. It still crashes
> after (successfully) parsing around 500 files. Can somebody
> test this script on a large batch of files, or otherwise tell
> me what I'm (or ExpatXS) is doing wrong? Maybe it's a problem
> with XML::Filter?

I've used your program to parse 10_000 files.  No problem.

> # $Id: ExpatXS.pm,v 1.39 2005/11/10 09:38:31 cvspetr Exp $

I don't find that, but I get:

# $Id: SAX.pm,v 1.25 2005/10/24 19:39:45 matt Exp $

Maybe I am using the Pure perl method.  Can you force it to use the
pure-perl method and see what happens?

>
> This is perl, v5.8.7 built for sun4-solaris-thread-multi

This is perl, v5.8.0 built for i386-linux-thread-multi

Xho

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


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

Date: Sun, 15 Jan 2006 12:19:48 -0800
From: Arvin Portlock <nomail@sorry.com>
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <dqeap5$92k$1@agate.berkeley.edu>

Matt Garrish wrote:

> "Arvin Portlock"  wrote in message
> news:dq9gb7$219p$1@agate.berkeley.edu...
>
> >In using ExpatXS to parse large batches of XML files
> >something curious happens. After parsing something close
> >to 500 files the program crashes with the error:
> >
> >Can't call method "read" on an undefined value at
> >/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
> >XML/SAX/ExpatXS.pm line 155.
> >
>
>
> I don't see
> where you're trying to call a read method anywhere in your code

I don't understand what you mean by a read method. Isn't that
what $parser->parse_uri($fullpath) does? I'm doing something
right at least because the program works perfectly (reading and
manipulating xml files) until somewhere around the 500th file.

> , but I would
> suggest wrapping the objects in an eval and see if that gives you more 
> info.
> At the very least it should isolate which module is causing the problem:
>
> my ($filter, $parser);
>
> eval { $filter  = new XML::Filter::BufferText (Handler => $handler); };

I wrapped an eval around the $parser->parse_uri and it simply
gave me the same error message "Can't call method" about a
thousand times, for each of the subsequent files after the
first failure. In other words, it didn't give me an error for
a single file then happily continue working with the rest. Once
it fails it fails for good.

I tried your suggestion with the other objects but no error
messages there. And thank you for the idea, I'll try to go into
ExpatSX.pm and try it a few places in there to see if I can
get a little closer to the source of the problem.


use XML::SAX;
use XML::Filter::BufferText;
use File::Path;
use strict 'vars';

my $dir = '/home/xmldocs/lib1';
opendir (DIR, $dir);
my @xmlfiles = grep (/\.xml/, readdir (DIR));
closedir (DIR);

foreach my $file (sort @xmlfiles) {
    my $fullpath = "$dir/$file";
    print STDERR "$fullpath\n";
    my $handler = new MySAXHandler;
    my $filter  = new XML::Filter::BufferText (Handler => $handler);
    my $parser  = XML::SAX::ParserFactory->parser(Handler => $filter);
    $parser->parse_uri($fullpath);
    undef $parser;
    undef $filter;
    undef $handler;
}

package MySAXHandler;
use base qw(XML::SAX::Base);

sub start_element {
}

sub end_element {
}



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

Date: Sun, 15 Jan 2006 12:31:39 -0800
From: Arvin Portlock <nomail@sorry.com>
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <dqebfb$97r$1@agate.berkeley.edu>

Matt Garrish wrote:

> "Arvin Portlock"  wrote in message
> news:dq9gb7$219p$1@agate.berkeley.edu...
>
> >In using ExpatXS to parse large batches of XML files
> >something curious happens. After parsing something close
> >to 500 files the program crashes with the error:
> >
> >Can't call method "read" on an undefined value at
> >/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
> >XML/SAX/ExpatXS.pm line 155.
> >
>
>
> I would doubt it's a memory leak or your system would have ground to a 
> halt.

That's true. Now that I think about it it sounds more like
file handles aren't being closed and at some point I simply
run out. I would assume all that is taken care of during
parser destruction when it goes out of scope or is explicitely
deleted as I have done. Now I have something more concrete to
check.

Arvin.



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

Date: Sun, 15 Jan 2006 14:14:51 -0800
From: Arvin Portlock <nomail@sorry.com>
Subject: Re: ExpatXS: 'Can't call method "read" on an undefined value' after ca. 500 XML files
Message-Id: <dqehgs$auv$1@agate.berkeley.edu>

Matt Garrish wrote:

>  wrote in message
> news:20060115160930.889$50@newsreader.com...
>
> >"Matt Garrish"  wrote:
> >
> >>"Arvin Portlock"  wrote in message
> >>news:dq9gb7$219p$1@agate.berkeley.edu...
> >>
> >>>In using ExpatXS to parse large batches of XML files
> >>>something curious happens. After parsing something close
> >>>to 500 files the program crashes with the error:
> >>>
> >>>Can't call method "read" on an undefined value at
> >>>/xxx/perl5.8/lib/site_perl/5.8.7/sun4-solaris-thread-multi/
> >>>XML/SAX/ExpatXS.pm line 155.
> >>>
> >>
> >>You aren't checking whether you succesfully get an object. I would doubt
> >>it's a memory leak or your system would have ground to a halt.
> >
> >But it could easily be a file-handle leak.  Around 500 would be a common
> >per-process limit on open file-handles.
> >
>
>
> That seems more likely. I just wonder what the read method is that is 
> being
> called on what undefined object. It's not a particularly helpful error
> message. It could be coming right from Expat from the sound of it.
>
> Matt 

The line in question in ExpatXS is this:

$result = $args->{ParseFunc}->($args->{Parser},
   $args->{ParseFuncParam});

In some context that's:

sub _parse_systemid {
     my $self = shift;
     my $fh = IO::File->new(shift);
     $self->{ParseOptions}->{ParseFunc} = \&ParseStream;
     $self->{ParseOptions}->{ParseFuncParam} = $fh;
     $self->_parse;
}

sub _parse {
     my $self = shift;
     my $args = bless $self->{ParseOptions}, ref($self);
 ...
     my $result;
     $result = $args->{ParseFunc}->($args->{Parser},
       $args->{ParseFuncParam});

     ParserFree($args->{Parser});
 ...
}

See that ParseFuncParam is a filehandle. I don't know
enough about IO::File to know exactly what's going on
but I think some more evals might be helpful.

Arvin



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

Date: Sun, 15 Jan 2006 21:09:41 +0100
From: D. Lary Lor <d.larylor@globalinc.com>
Subject: Strategy about browser cache and generated pages
Message-Id: <MPG.1e34ca6f6052b17f98974c@news.tiscali.fr>

*******
Some difficulties to post in comp.infosystems.www.authoring.cgi (don't 
see even if right for my newsreader), then I do-it here !
*******

Hi. I'm working on a perl script (about techno-commercial notes 
depository ; close to a kind of dedicated guestbook working) which 
typically works like this :

#1 : input-form with submit and preview buttons
     (text, hidden, checkbox, textarea, POST method)

user click submit from #1 => #2aa : error-page OR #2ab : success-page
user click preview from #1 => #2b : preview-page with submit button

user click back from #2aa => #1
user click show from #2ab => #3
user click back from #2b => #1
user click submit from #2b => #2aa OR #2ab

#3 : list the existing contributions (including new one if any)

Of course, the user can diretly go in #3 if he doesn't have to 
contribute at this time.

Well, all sounds right but my current concern is about browser (and 
proxy) caching.

If I let all like this, every one (co-users of any computer) can 
navigate to previous generated page (#1 with field filled, all #2 with 
their status messages, #3 which may be ou-of-date).

At a first step, I've decided to build two types of http response header 
: a first one called $nocache with "Cache-Control: no-cache\n" AND a 
second one called $agecache with "Cache-Control: max-age=900\n". Then, 
to apply $nocache everywhere except the input form in #1 which would 
take $agecache. 

This way because everyone must be able to be back to a previously 
informed input form (#1) from all of the #2 steps (error, success, 
preview. But nobody should be able to keep trace about #2 and #3.

So, does my way the good one ?

I've already seen some flaw which may become dammageable : for example, 
I've integrated a captcha mecanism and the "password-image" doesn't 
renew when user is back to the #1 (with $agecache) in the 900 seconds. 
So, in this case, how to force the pass-img reload (knowing a new one is 
generated at every "real" page reload). And it must exists others 
lack...

Of course, I've also observed what done in some public guestbook script 
(e.g. the one by Matt Wright, Adam Daley, etc) and it seems they just 
ignore the subject and just let thing like they are naturally : everyone 
can navigate in previous generated pages without renew).

Well, how would you proceed ? Any advice welcome : thanks


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

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


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