[24339] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6528 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 6 06:05:45 2004

Date: Thu, 6 May 2004 03:05:11 -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, 6 May 2004     Volume: 10 Number: 6528

Today's topics:
    Re: At wits end! LWP and IIS(?) <gisle@ActiveState.com>
        for loop <obeseted@yahoo.com>
    Re: for loop <mark.clements@kcl.ac.uk>
    Re: for loop <tore@aursand.no>
    Re: for loop <Joe.Smith@inwap.com>
    Re: free source authentication script <bik.mido@tiscalinet.it>
    Re: free source authentication script <bik.mido@tiscalinet.it>
        Getting Function Name <georgekinley@hotmail.com>
    Re: Getting Function Name (Anno Siegel)
    Re: Getting Function Name <georgekinley@hotmail.com>
    Re: HTML::LinkExtor or me ? <gisle@ActiveState.com>
    Re: Komodo as a editor? <bik.mido@tiscalinet.it>
        mod_perl flush problem (Daoud)
    Re: newbie regexp question <Joe.Smith@inwap.com>
        Perl exporter <mail@mail.com>
    Re: Perl exporter (Anno Siegel)
    Re: Perl exporter <mail@mail.com>
    Re: Perl exporter <mail@mail.com>
    Re: Printing in Perl <mail@mail.com>
    Re: reading an active directory server? <mark.clements@kcl.ac.uk>
        Removing a section of text <budman@somewhere.net>
    Re: Sort Hash o Hash accordint to two keys (Anno Siegel)
    Re: Text repetition operator <mark.clements@kcl.ac.uk>
    Re: Text repetition operator (Anno Siegel)
    Re: Text repetition operator <mark.clements@kcl.ac.uk>
        Text::Autoformat sucks! <admin@asarian-host.net>
    Re: Text::Autoformat sucks! <admin@asarian-host.net>
    Re: Text::Autoformat sucks! (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 06 May 2004 01:57:08 -0700
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: At wits end! LWP and IIS(?)
Message-Id: <m37jvqszkr.fsf@eik.g.aas.no>

"gnari" <gnari@simnet.is> writes:

> I have never used these for file upload, and can't be bothered to do
> research, but I suspect that you at least need to specify
> multipart/form-data in the POST call, and probably some more
> work. an upload post is in a pretty different format that regular
> posts, and I am not sure HTTP::Request::Common supports it, thus the
> "501 (Not Implemented)" message.

HTTP::Request::Common certainly do support file uploads.

-- 
Gisle Aas


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

Date: Thu, 06 May 2004 10:51:40 +0200
From: Fatted <obeseted@yahoo.com>
Subject: for loop
Message-Id: <c7cucf$2eqhv$1@ID-216008.news.uni-berlin.de>

Consider code snippit:

my @array = qw(first second third fourth);

for(@array)
{
	print $_."\n";
}

Which prints to stdout:
first
second
third
fourth

Now try:

my @array = qw(first second third fourth);
my $i;

for($i = 0, @array, $i++)
{
	print $_."\n";
}

This prints:
1
first
second
third
fourth
0

What are the 1 and 0 values?


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

Date: Thu, 06 May 2004 10:23:24 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: for loop
Message-Id: <409a0400$1@news.kcl.ac.uk>

Fatted wrote:


> for($i = 0, @array, $i++)
> {
>     print $_."\n";
> }
> 
> This prints:
> 1
> first
> second
> third
> fourth
> 0

You have the syntax for "for" incorrect (OK - it's "correct", but isn't what you want to do 
here). Try

for(my $i = 0 ; $i < $#array ; $i++){

note ; instead of ,
also, @array replaced by $i < $#array. Unless you are modifying @array (not a good variable 
name, by the way), then it will always be true in this case.

The reason your version works at all is due to how for (or foreach - they are synonymous ) 
processes arguments when they consist of just a list, and I'm feeling a bit to lazy to work it 
out properly to explain it.

Mark

Mark


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

Date: Thu, 06 May 2004 11:39:20 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: for loop
Message-Id: <pan.2004.05.06.09.36.24.817382@aursand.no>

On Thu, 06 May 2004 10:51:40 +0200, Fatted wrote:
> my @array = qw(first second third fourth);
> my $i;
> 
> for($i = 0, @array, $i++)
> {
> 	print $_."\n";
> }
> 
> This prints:
> 1
> first
> second
> third
> fourth
> 0
> 
> What are the 1 and 0 values?

What are you actually trying to do?  That 'for' loop looks a little weird
to me, but Perl does excactly what you tells it to;

You tell Perl to loop through a list containing:

  1. $i = 0
  2. The elements in @array
  3. $i++

Is that what you _really_ want Perl to do?


-- 
Tore Aursand <tore@aursand.no>
"What we see depends mainly on what we look for." (Sir John Lubbock)


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

Date: Thu, 06 May 2004 09:40:57 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: for loop
Message-Id: <JKnmc.30956$TD4.4911738@attbi_s01>

Fatted wrote:

> Consider code snippit:
> my @array = qw(first second third fourth);
> my $i;
> for($i = 0, @array, $i++) {print $_."\n";}

The C-style for() loop requires semicolons, not commas.

   for ($i = 0; $i < @array; $i++) { print "$array[$i]\n"; }

> This prints:
> 1
> first
> second
> third
> fourth
> 0
> 
> What are the 1 and 0 values?

One is from $i=0, the other is from $i++.

 > for($i = 0, @array, $i++) {print $_."\n";}

That is the same as
   $i = 0;
   for $_ ($i, 'first', 'second', 'third', 'fourth', $i) {...}
except that the post-increment is done at an unexpected place.

	-Joe


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

Date: Thu, 06 May 2004 08:30:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: free source authentication script
Message-Id: <0lmi909f8vgvj10qfch3o8o3hftbelq1h0@4ax.com>

On Wed, 5 May 2004 10:33:55 -0800, "Robin" <webmaster @ infusedlight .
net> wrote:

>>   * You're _still_ not checking the outcome of 'open()'.
>
>Yeah, I figure that there won't be too much of a race condition or anything
>like that because there's only one person who accesses the code who runs the
>files, unless there's more than one person who has the password and even so
>it's minimal...
>
>Also, this is a modified older script, I will get around to it, and I
>apologize for not "doing my best" before posting it.

Well, 'open() or die' is such a common Perl idiom that it'd better
soon become deeply etched in your brain. It has not necessarily to do
with race conditions: just do that! At the very least, a simple 'die
$!' will do!


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Thu, 06 May 2004 08:30:11 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: free source authentication script
Message-Id: <9jqi90lete93v2j4fmfbv5u5cm9ukoi6nn@4ax.com>

On Wed, 5 May 2004 14:52:14 -0400, Paul Lalli <ittyspam@yahoo.com>
wrote:

>> It's indented in the way I like it. How would you define "properly"?
>>
>
>How many people have told you to read perldoc perlstyle so far?  You
>clearly haven't done it.  From said doc:
>
>     Regarding aesthetics of code lay out, about the only thing
>     Larry cares strongly about is that the closing curly bracket
[snip]
>are good.  What you do:
>
>if ($foo)
>   {
>   bar();
>   }
>
>is not.

Of course I'm not Larry, but if it counts, it is horrible by my
aesthetics standards too!


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: Thu, 06 May 2004 08:59:48 GMT
From: "George Kinley" <georgekinley@hotmail.com>
Subject: Getting Function Name
Message-Id: <88nmc.15819$g4.305947@news2.nokia.com>

Bosses,
I have defined a Function which prints Error, it takes couple of Parameters,
What I want is, IF I can some how send the name of the function as one of
the parameter so that when the Error Function prints the message it also
tells me from which function it has been called
is it possible as my Script Executes





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

Date: 6 May 2004 09:03:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Getting Function Name
Message-Id: <c7cv1u$3ut$3@mamenchi.zrz.TU-Berlin.DE>

George Kinley <georgekinley@hotmail.com> wrote in comp.lang.perl.misc:
> Bosses,
> I have defined a Function which prints Error, it takes couple of Parameters,
> What I want is, IF I can some how send the name of the function as one of
> the parameter so that when the Error Function prints the message it also
> tells me from which function it has been called
> is it possible as my Script Executes

perldoc -f caller

Anno


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

Date: Thu, 06 May 2004 09:08:36 GMT
From: "George Kinley" <georgekinley@hotmail.com>
Subject: Re: Getting Function Name
Message-Id: <ognmc.15820$g4.306089@news2.nokia.com>

Thanks,

I wonder  Why we ask these stupid question , that we should find ourselves

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:c7cv1u$3ut$3@mamenchi.zrz.TU-Berlin.DE...
> George Kinley <georgekinley@hotmail.com> wrote in comp.lang.perl.misc:
> > Bosses,
> > I have defined a Function which prints Error, it takes couple of
Parameters,
> > What I want is, IF I can some how send the name of the function as one
of
> > the parameter so that when the Error Function prints the message it also
> > tells me from which function it has been called
> > is it possible as my Script Executes
>
> perldoc -f caller
>
> Anno




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

Date: 06 May 2004 02:04:49 -0700
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: HTML::LinkExtor or me ?
Message-Id: <m33c6esz7y.fsf@eik.g.aas.no>

vahu@novonordisk.com (Saya) writes:

> This is the code:
>
> sub Escape{
> 	$item = shift;
> 
> 	use HTML::LinkExtor;
> 	
> 	$p = HTML::LinkExtor->new(\&replaceURL, "");
> 	$p->parse($item);
> 	
> 	return $item;
> }

What are you actually trying to do?  Please describe that and remove
unrelated details from your example program before you post.

If you want to do substitutions on links in an HTML document, then
this example program might be a good start.

  http://search.cpan.org/src/GAAS/HTML-Parser-3.36/eg/hrefsub

-- 
Gisle Aas


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

Date: Thu, 06 May 2004 08:30:10 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Komodo as a editor?
Message-Id: <68mj909bhando8bh4mfdr1p4396dlh18lo@4ax.com>

On Tue, 04 May 2004 23:05:23 GMT, don't email me <I'll@email.you>
wrote:

>for the past 12 years. I think emacs, M$word and all other editors out 
>there are garbage... But hey, this is just me... you might think otherwise. 

Huh?!? I know that (i) you're clearly stating it's just you, and (ii)
vi and emacs are the immortal contenders in the everlasting flame
about the best (*NIX) editor, but said this, isn't it just a bit too
extreme to put emacs side by side with a made-in-Redmond-wp in the
garbage?

I do not use emacs myself, but your claim sounds to me just like if
one were a declared *bsd fan claiming that in his opinion Linux and M$
Windoze are garbage...


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: 6 May 2004 01:48:24 -0700
From: duder@bio.vu.nl (Daoud)
Subject: mod_perl flush problem
Message-Id: <8b209487.0405060048.7f4a5a26@posting.google.com>

Hi,

I recently migrated from RedHat 9 to gentoo, and ever since I'm having
a hard time sleeping because I can't get a mod_perl script to
autoflush! Well actualy I did manage to flush the output by calling
$r->rflush(), but in my opinion it should be possible to just set $|
to a non zero value. Has something changed in apache or mod_perl that
prevents autoflush in this manner?

Here are some version numbers:

Gentoo Base System version 1.4.9
mod_perl 1.99.11
apache 2.0.49-r1
CGI 3.00

I made this very simple test script to investigate the problem:

Running it as CGI script will autoflush the output but running it as a
mod_perl script doesn't. I commented out the lines that will flush the
ouput manually.
----------------------

#!/usr/bin/perl -w

use CGI qw/:standard/;

$| = 1;
#my $r = shift;

print header();
print start_html();
for (my $i = 0;$i < 10;$i++) {
  print $i, br;
  #$r->rflush();
  sleep 1;
}
print end_html();

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

Help is much apreciated,..

Daoud


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

Date: Thu, 06 May 2004 09:12:53 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: newbie regexp question
Message-Id: <pknmc.40871$I%1.2670399@attbi_s51>

Zachary Turner wrote:

> Why doesn't this work like I expect it to?
> 
> if ($string =~ /$pattern/) {
>     ...
> }
> 
> Basically I built the pattern on the fly, so I can't hardcode it.  My guess
> is that it's not interpolating the variable.

I'd say your guess is wrong.  It's probably interpolating too much.
Go re-read the regular expression docs until you find \Q and \E.
	-Joe


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

Date: Thu, 6 May 2004 09:34:56 +0100
From: "bob" <mail@mail.com>
Subject: Perl exporter
Message-Id: <T9CdnXNRVImpZATdSa8jmw@karoo.co.uk>

I have been struggerling with a problem for the last few days and have been
reading up but to no avail.
Hope fully someone here may be able to help.

I am using perl Exporter as i have done for the last 4 years.

Basically my exporter works if i do

use MyModule qw(function function_not_existing);
i.e. it throws the usual error that the function doesn't exist which is what
i want.

but does't when i do

use Path::MyModule qw(function
                                      function_not_existing)

it doesn't error.

Any help is appreciated. Im using perl 5.8 on Solaris.

Thanks




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

Date: 6 May 2004 08:59:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl exporter
Message-Id: <c7cupt$3ut$2@mamenchi.zrz.TU-Berlin.DE>

bob <mail@mail.com> wrote in comp.lang.perl.misc:
> I have been struggerling with a problem for the last few days and have been
> reading up but to no avail.
> Hope fully someone here may be able to help.
> 
> I am using perl Exporter as i have done for the last 4 years.
> 
> Basically my exporter works if i do
> 
> use MyModule qw(function function_not_existing);
> i.e. it throws the usual error that the function doesn't exist which is what
> i want.
> 
> but does't when i do
> 
> use Path::MyModule qw(function
>                                       function_not_existing)
> 
> it doesn't error.
> 
> Any help is appreciated. Im using perl 5.8 on Solaris.

I cannot reproduce this with perl 5.8.1.

Anno


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

Date: Thu, 6 May 2004 10:22:20 +0100
From: "bob" <mail@mail.com>
Subject: Re: Perl exporter
Message-Id: <SASdnRO3AJbJmQfdSa8jmA@karoo.co.uk>

interesting, i have to say i haven't had this problem before either.
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:c7cupt$3ut$2@mamenchi.zrz.TU-Berlin.DE...
> bob <mail@mail.com> wrote in comp.lang.perl.misc:
> > I have been struggerling with a problem for the last few days and have
been
> > reading up but to no avail.
> > Hope fully someone here may be able to help.
> >
> > I am using perl Exporter as i have done for the last 4 years.
> >
> > Basically my exporter works if i do
> >
> > use MyModule qw(function function_not_existing);
> > i.e. it throws the usual error that the function doesn't exist which is
what
> > i want.
> >
> > but does't when i do
> >
> > use Path::MyModule qw(function
> >                                       function_not_existing)
> >
> > it doesn't error.
> >
> > Any help is appreciated. Im using perl 5.8 on Solaris.
>
> I cannot reproduce this with perl 5.8.1.
>
> Anno




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

Date: Thu, 6 May 2004 10:49:43 +0100
From: "bob" <mail@mail.com>
Subject: Re: Perl exporter
Message-Id: <dcidnR0WhK8jlwfdSa8jmw@karoo.co.uk>

Apologies, me being an idiot and not fully qualifying the package names!!
Cheers
"bob" <mail@mail.com> wrote in message
news:SASdnRO3AJbJmQfdSa8jmA@karoo.co.uk...
> interesting, i have to say i haven't had this problem before either.
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:c7cupt$3ut$2@mamenchi.zrz.TU-Berlin.DE...
> > bob <mail@mail.com> wrote in comp.lang.perl.misc:
> > > I have been struggerling with a problem for the last few days and have
> been
> > > reading up but to no avail.
> > > Hope fully someone here may be able to help.
> > >
> > > I am using perl Exporter as i have done for the last 4 years.
> > >
> > > Basically my exporter works if i do
> > >
> > > use MyModule qw(function function_not_existing);
> > > i.e. it throws the usual error that the function doesn't exist which
is
> what
> > > i want.
> > >
> > > but does't when i do
> > >
> > > use Path::MyModule qw(function
> > >                                       function_not_existing)
> > >
> > > it doesn't error.
> > >
> > > Any help is appreciated. Im using perl 5.8 on Solaris.
> >
> > I cannot reproduce this with perl 5.8.1.
> >
> > Anno
>
>




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

Date: Thu, 6 May 2004 09:36:48 +0100
From: "bob" <mail@mail.com>
Subject: Re: Printing in Perl
Message-Id: <rNOdnTqW3NM0ZATdSa8jmw@karoo.co.uk>

No they are not needed.
print ""; works fine.

"Bill Soistmann" <bsoist@sdf.lonestar.org> wrote in message
news:slrnc5jrjt.cbn.bsoist@sdf.lonestar.org...
> Greetings
> I have not used perl in some time and I was wondering if I could ask a
> quick question.
>
> Are parenthesis now required for printing? I know that had not always
> been the case.
>
> If so, I have another quick question
> Is there an option to make old scripts work.
>
> -- 
> Bill Soistmann
> Always try to do things in chronological order; it's less confusing
> that way.




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

Date: Thu, 06 May 2004 09:37:54 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: reading an active directory server?
Message-Id: <4099f956$1@news.kcl.ac.uk>

Walter Roberson wrote:

> In article <109j8bj4mcelned@corp.supernews.com>,
> Mike  <mikee@mikee.ath.cx> wrote:
> :The company uses ADS to manage all user accounts and passwords. I want
> :to read the user ids and passwords from the ADS server from one of
> :my unix servers to then create an distribute password files as the
> :user passwords change.
 ....
> I'd be someone surprised if AD allowed you access to the raw passwords.
> It's LAPD based, isn't it? It's more likely to allow you to make a call
> to authenticate a user/password pair, with the security provided
> by the ability to encrypt the lapd transaction (via ssl I seem to
> recall.)
Modern unixes should contain the hooks to authenticate using ldap, via pam or otherwise. Solaris 
8+ does this natively, though there are modules available for previous versions (search for 
padl). Configuring your systems to use ldap authentication would obviate the need for 
distributing static files generated from the AD data.

Mark


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

Date: Thu, 06 May 2004 02:57:06 -0300
From: budman <budman@somewhere.net>
Subject: Removing a section of text
Message-Id: <pan.2004.05.06.05.57.04.768808@somewhere.net>

Hi,

I was trying to come up with automate a process
in which script files are generated for another app.

The line would be (with some possibilites of added white spaces)

    s( j1 ) and success(j2) or failure(j3 )

perl -le '$x="s( j1 ) and success(j2) and failure(j3 )"; 
   $r="j2";   
   $x=~s/\s*(?:and|not|or|)\s*\w+\(\s*$r\s*\)//;
   $x=~s/^\s*(?:and|or|not)\s*//;
   print $x'

Results with each different $r value:
j1 => success(j2) and failure(j3 )
j2 => s( j1 ) and failure(j3 )
j3 => s( j1 ) and success(j2)

This works fine. The 2nd substitute is to remove any leading 
and,or,not if the first item was removed.

I starting to play with lookups. 
Can the 2nd substitute be incorporated into the first using 
some type of lookup or is clearer this way?

Thanks,
Rich






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

Date: 6 May 2004 08:10:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sort Hash o Hash accordint to two keys
Message-Id: <c7crt4$1kr$1@mamenchi.zrz.TU-Berlin.DE>

Malik Yousef <yousef@pcbi.upenn.edu> wrote in comp.lang.perl.misc:
> Hi
> I have the fellwoing hash structure:
> %allresults{hdrnam}{WinPosition}

That's not Perl.

> First i would like to sort the hash according to the key "hdrname" and
> then to sort according to the WinPosition which is with numeric value.

Your specification makes no sense, specifically the part beginning
with "and then...".

"Sorting a hash" is a loose way of saying "sorting the keys of a hash".
So you want to sort the keys, alphabetically presumably.  But hash
keys are unique, so the sorting order is completely specified.  There
is no way to bring in a secondary sort order.

Anno


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

Date: Thu, 06 May 2004 09:33:16 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: Text repetition operator
Message-Id: <4099f83f$1@news.kcl.ac.uk>

Zachary Turner wrote:

> I was trying to draw a triangle using *'s, and while I did get a solution,
> it wasn't as elegant as I had hoped due to the length of my for loop which
> kept track of what line I was on, how many blank spaces to print, etc.  I
> thought it would be really cool if there was some way to maintain/modify
> state in between repetitions of the x operator. 
<snip>
check out perldoc overload, though bear in mind that this refers to overloading operations on 
objects, not for simple arithmetic. For the purposes of the original requirement, you could also 
take a look at recursion.

Mark


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

Date: 6 May 2004 08:52:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Text repetition operator
Message-Id: <c7cubi$3ut$1@mamenchi.zrz.TU-Berlin.DE>

Mark Clements  <mark.clements@kcl.ac.uk> wrote in comp.lang.perl.misc:
> Zachary Turner wrote:
> 
> > I was trying to draw a triangle using *'s, and while I did get a solution,
> > it wasn't as elegant as I had hoped due to the length of my for loop which
> > kept track of what line I was on, how many blank spaces to print, etc.  I
> > thought it would be really cool if there was some way to maintain/modify
> > state in between repetitions of the x operator. 
> <snip>
> check out perldoc overload, though bear in mind that this refers to
> overloading operations on 
> objects, not for simple arithmetic. For the purposes of the original
> requirement, you could also 
> take a look at recursion.

As Tony Curtis noted, "x" evaluates its argument only once, so the
result will always be a repetition of the same string, even if you
overload stringification (or tie a variable appropriately).

But even if it worked, the result would be seriously obfuscated code.
Exploiting side effects is always sneaky; using a side effect that
happens on every *access* is doubly so.

Anno


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

Date: Thu, 06 May 2004 10:14:44 +0100
From: Mark Clements <mark.clements@kcl.ac.uk>
Subject: Re: Text repetition operator
Message-Id: <409a01f8$1@news.kcl.ac.uk>

Anno Siegel wrote:


> As Tony Curtis noted, "x" evaluates its argument only once, so the
> result will always be a repetition of the same string, even if you
> overload stringification (or tie a variable appropriately).
sure - but it could probably be used to produce the required output in one fell swoop. You are 
right, though: it's unlikely that this is desirable.

> But even if it worked, the result would be seriously obfuscated code.
agreed.

> Exploiting side effects is always sneaky; using a side effect that
> happens on every *access* is doubly so.
overloading should always be used with caution, similarly tie. I got the impression that the OP 
was more interested in playing "I thought it would be really cool if..." than coming up with a 
real-world solution, but all the same my posting was probably not particularly helpful.

Mark


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

Date: Thu, 6 May 2004 10:56:05 +0200
From: "Mark" <admin@asarian-host.net>
Subject: Text::Autoformat sucks!
Message-Id: <c6adnSgq_bcuYATd4p2dnA@giganews.com>

Big time, really! I wrote the following test:


-------------------------------
$messy = '

> -knip-
>
> > > Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest
zul
> je
> > > ongetwijfeld vaker dingen tegenkomen die je niet interessant of niet
> leuk vind
> > > of zelfs dingen die je niet helemaal snapt.
> >
> > Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
> > aangezien niemand op dat slappe verhaal zit te wachten.
>
> -knip-
>
> Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> jezelf...

';

$tidied_all = autoformat ($messy, {left => 1, right => 72, all => 1});

print "\n$tidied_all\n";
-------------------------------


And that produces the following output:


-------------------------------
> -knip-
>
> > > Als je alle posts in deze nieuwsgroep altijd opent en ook nog
> > > leest
zul
> je
> > > ongetwijfeld vaker dingen tegenkomen die je niet interessant of
> > > niet
> leuk vind
> > > of zelfs dingen die je niet helemaal snapt.
> >
> > Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
> > aangezien niemand op dat slappe verhaal zit te wachten.
>
> -knip-
>
> Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> jezelf...
-------------------------------


Yeah, real brilliant. ) My God, Text::Autoformat really sucks! I know it was
pretty bad a few years ago; but I had hoped the author had finally improved
a bit on his product (God knows there is room for improvement!).

Now, let me show you what QuoteFix does (for Outlook family):


-------------------------------
> -knip-
>
>>> Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest zul
je
>>> ongetwijfeld vaker dingen tegenkomen die je niet interessant of niet
leuk vind
>>> of zelfs dingen die je niet helemaal snapt.
>>
>> Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
>> aangezien niemand op dat slappe verhaal zit te wachten.
>
> -knip-
>
> Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> jezelf...
-------------------------------


See, that is how it is supposed to be done! Why, O why, is such a thing not
available for Perl? And yes, this is a rant. I cannot believe there is
nothing in Perl even remotely worth considering, AutoFormat wise.

Blech!

- Mark




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

Date: Thu, 6 May 2004 11:00:26 +0200
From: "Mark" <admin@asarian-host.net>
Subject: Re: Text::Autoformat sucks!
Message-Id: <R6KdneUDN7klYwTdRVn-hg@giganews.com>

Mark wrote:

> Now, let me show you what QuoteFix does (for Outlook family):

Now I messed it up myself. :) THIS is how QuoteFix shows it:

-------------------------------
> -knip-
>
>>> Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest
>>> zul je ongetwijfeld vaker dingen tegenkomen die je niet interessant
>>> of niet leuk vind of zelfs dingen die je niet helemaal snapt.
>>
>> Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
>> aangezien niemand op dat slappe verhaal zit te wachten.
>
> -knip-
>
> Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> jezelf...
-------------------------------

- Mark




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

Date: 6 May 2004 10:03:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Text::Autoformat sucks!
Message-Id: <c7d2h9$6s1$1@mamenchi.zrz.TU-Berlin.DE>

Mark <admin@asarian-host.net> wrote in comp.lang.perl.misc:
> Big time, really! I wrote the following test:
> 
> 
> -------------------------------
> $messy = '
> 
> > -knip-
> >
> > > > Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest
> zul
> > je
> > > > ongetwijfeld vaker dingen tegenkomen die je niet interessant of niet
> > leuk vind
> > > > of zelfs dingen die je niet helemaal snapt.
> > >
> > > Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
> > > aangezien niemand op dat slappe verhaal zit te wachten.
> >
> > -knip-
> >
> > Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> > jezelf...
> 
> ';
> 
> $tidied_all = autoformat ($messy, {left => 1, right => 72, all => 1});
> 
> print "\n$tidied_all\n";
> -------------------------------

It's hard to say what you actually fed to Autoformat because of additional
line breaks added in news propagation.  You should have prepared a demo
that works with shorter, Usenet-safe lines.

> And that produces the following output:
> 
> 
> -------------------------------
> > -knip-
> >
> > > > Als je alle posts in deze nieuwsgroep altijd opent en ook nog
> > > > leest
> zul
> > je
> > > > ongetwijfeld vaker dingen tegenkomen die je niet interessant of
> > > > niet
> > leuk vind
> > > > of zelfs dingen die je niet helemaal snapt.
> > >
> > > Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
> > > aangezien niemand op dat slappe verhaal zit te wachten.
> >
> > -knip-
> >
> > Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> > jezelf...
> -------------------------------

Not for me.  For one, I see "leest" and "zul" on one line where your
output shows them on two.  Is this actually the output, or did you
mess up this one too?

> Yeah, real brilliant. ) My God, Text::Autoformat really sucks! I know it was
> pretty bad a few years ago; but I had hoped the author had finally improved
> a bit on his product (God knows there is room for improvement!).

All you say is that you don't like the result.  What exactly are you
complaining about?  Be specific.

> Now, let me show you what QuoteFix does (for Outlook family):

[I have inserted the corrected text from your second post]

> -------------------------------
> > -knip-
> >
> >>> Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest
> >>> zul je ongetwijfeld vaker dingen tegenkomen die je niet interessant
> >>> of niet leuk vind of zelfs dingen die je niet helemaal snapt.
> >>
> >> Vast. Ik vind 10 KB rant behoorlijk een verspilling van resources,
> >> aangezien niemand op dat slappe verhaal zit te wachten.
> >
> > -knip-
> >
> > Hoe weet jij waar iedereen wel of niet op zit te wachten? Spreek voor
> > jezelf...
> -------------------------------

That's arguably wrong.  

Look at lines 5, 6, and 7 in the original:

> > > Als je alle posts in deze nieuwsgroep altijd opent en ook nog leest zul
> je
> > > ongetwijfeld vaker dingen tegenkomen die je niet interessant of niet

The quote marks indicate that "je" comes from a different posting than
the surrounding lines.  (Never mind if that is actually true, that is
what we see.)  Yet QuoteFix joins it with the surrounding lines.

> See, that is how it is supposed to be done!

If you say so...

>                                             Why, O why, is such a thing not
> available for Perl? And yes, this is a rant.

Unfortunately, it is nothing but.  If you had given *any* detailed
complaints, that might have actually helped.

Anno


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

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


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