[25250] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7495 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 8 09:05:58 2004

Date: Wed, 8 Dec 2004 06:05:07 -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           Wed, 8 Dec 2004     Volume: 10 Number: 7495

Today's topics:
        [ANNOUNCE] New module Class::IntrospectionMethods <domi@komarr.grenoble.hp.com>
        An ENCODING problem: Windows-1251 dshan@web.de
    Re: An ENCODING problem: Windows-1251 <spamtrap@dot-app.org>
    Re: An ENCODING problem: Windows-1251 dshan@web.de
        ANNOUNCE: Data::Page::Viewport <ron@savage.net.au>
    Re: Dynamic Search Tool <newsgroups@xtracold.co.uk>
    Re: examples using PDF::Template <amead@comcast.net>
    Re: examples using PDF::Template <bik.mido@tiscalinet.it>
    Re: Generate Squential Numbers? <josef.moellers@fujitsu-siemens.com>
    Re: grammar function [OT - English Grammar] <mritty@gmail.com>
    Re: grammar function <apeiron+usenet@coitusmentis.info>
    Re: grammar function <ken_sington@nospam_abcdefg.com>
        How to call PL/SQL procs using Oraperl ? <ziogas@cern.ch>
    Re: How to handle a HTTP::Request with gzip, deflate he <leifwessman@hotmail.com>
    Re: How to handle a HTTP::Request with gzip, deflate he <gisle@activestate.com>
    Re: New comp.lang.perl.misc mirror site at lampforums.o <abigail@abigail.nl>
    Re: Paragraph separation for DOS files on Unix <uri@stemsystems.com>
    Re: Paragraph separation for DOS files on Unix (Oliver Heidelbach)
    Re: Question on loops and return values (Anno Siegel)
    Re: why the following HereDoc print don't work? <bart.lateur@pandora.be>
        Zoidberg 0.92 <j.g.karssenberg@student.utwente.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 6 Dec 2004 13:12:52 GMT
From: Dominique Dumont <domi@komarr.grenoble.hp.com>
Subject: [ANNOUNCE] New module Class::IntrospectionMethods
Message-Id: <I8Enr0.1qzE@zorch.sf-bay.org>



Hello

I've uploaded to CPAN a brand new perl package which provides
Class::IntrospectionMethods.  A module to create methods with
introspection feature.

In other words, this module provides:

- A way to set up a lot of get/set method. These get/set methods can
  access plain scalars, array, hash. These scalar, hash or array can
  be tied (See perltie) with classes specified by the user. The
  element of these arrays or hashes can be constrained to be object,
  tied scalar.

- A way to later query the object or class to retrieve the list of
  methods (aka slots) created by this module.

- A way to organize these slots in several catalogs.

- A way to backtrack from contained object to container object: When a
  slot contains object or tied scalars hashes or arrays, the contained
  object can be queried for the container object. In other words, the
  parent object (the one constructed by Class::IntrospectionMethods
  contains a child object in one of its slots either as a plain object
  or an object hidden behind a tied
  construct. Class::IntrospectionMethods will provide the child object
  a method to retrieve the parent object reference.

You may notice similarities between this module and
Class::MethodMaker. In fact this module was written from
Class::MethodMaker v1.08, but it does not provide most of the fancy
methods of Class::MethodMaker. Only scalar, array and hash accessors
(with their tied and objects variants) are provided.

For more details, see:
http://search.cpan.org/~ddumont/Class-IntrospectionMethods-1.001/IntrospectionMethods.pm

THANKS
------

To Martyn J. Pearce for Class::MethodMaker and the enlightening
discussion we had a while ago about parent and catalog.

To Matthew Simon Cavalletto for the parameter translation idea that I
pilfered from Class::MakeMethods.


-- 
Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner




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

Date: 8 Dec 2004 03:00:26 -0800
From: dshan@web.de
Subject: An ENCODING problem: Windows-1251
Message-Id: <1102503626.477268.194010@c13g2000cwb.googlegroups.com>

SGkgYWxsIQoKCkknbSB1c2luZyBhIFBlcmwgc2NyaXB0IHRvIHJlYWQgZnJvbSBhbiBIVE1MIGZp
bGUgYW5kIHNlbmQgdGhlCmluZm9ybWF0aW9uIHRvIFNURE9VVC4gVGhlIHByb2JsZW0gaXMgdGhh
dCBJIG5lZWQgdGhlIFdpbmRvd3MtMTI1MQpjaGFyYWN0ZXIgc2V0IChhcyBkZWZpbmVkIGluIHRo
ZSBIVE1MIGZpbGUpLCBidXQgSSBnZXQgdGhlIElTTy04ODU5LTEKb3V0cHV0IGluIHRoZSBJbnRl
cm5ldCBFeHBsb3Jlci4KClNvLCBJIGdldCAiw5HDrsOnw6TDoMOyw7wgw6TDqMOxw6rDs8Oxw7HD
qMO+IiBpbnN0ZWFkIG9mCiLQodC+0LfQtNCw0YLRjCDQtNC40YHQutGD0YHRgdC40Y4iIChSdXNz
aWFuKS4KCldoZW4gSSBvcGVuIHRoZSBIVE1MIGZpbGUgd2l0aCB0aGUgSW50ZXJuZXQgRXhwbG9y
ZXIsIGV2ZXJ5dGhpbmcgaXMgT0suCkhvdyBjYW4gSSBzb2x2ZSB0aGUgcHJvYmxlbT8gCgpUaGFu
a3MgZm9yIHlvdXIgaGVscCEKCmRzaGFuCg==



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

Date: Wed, 08 Dec 2004 06:22:59 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: An ENCODING problem: Windows-1251
Message-Id: <McWdnUHOBouJeSvcRVn-og@adelphia.com>

dshan@web.de wrote:

> I'm using a Perl script to read from an HTML file and send the
> information to STDOUT. The problem is that I need the Windows-1251
> character set (as defined in the HTML file), but I get the ISO-8859-1
> output in the Internet Explorer.

IE is probably using the charset specified in the HTTP response headers, 
rather than the one specified in the HTML.

Assuming you're using CGI.pm, you can add the proper header to your 
response like this:

print $query->header(
         -type => 'text/html',
         -charset => 'windows-1251',
     );

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: 8 Dec 2004 04:36:15 -0800
From: dshan@web.de
Subject: Re: An ENCODING problem: Windows-1251
Message-Id: <1102509375.738330.62200@z14g2000cwz.googlegroups.com>

thanks! It works!

Sherm Pendley wrote:

> IE is probably using the charset specified in the HTTP response
headers,
> rather than the one specified in the HTML.
>
> Assuming you're using CGI.pm, you can add the proper header to your
> response like this:
>
> print $query->header(
>          -type => 'text/html',
>          -charset => 'windows-1251',
>      );
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org



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

Date: Sun, 5 Dec 2004 03:23:54 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: Data::Page::Viewport
Message-Id: <I8Enq4.1qvp@zorch.sf-bay.org>

The pure Perl module Data::Page::Viewport V 1.00
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.

On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.

An extract from the docs:
1.00  Thu Dec  2 12:54:45 2004

Data::Page::Viewport is a pure Perl module.

This module keeps track of what items are on the 'current' page,
when you scroll forwards or backwards within a data set.

Similarly to Data::Page, you can call sub offset(N), for + or - N, to
scroll thru the data a page at a time.

And, like Set::Window, you can call sub offset(N), for + or - 1,to
scroll thru the data an item at a time.

Clearly, N does not have to be fixed.

The viewport provides access to the 'current' page, and the code shifts
indexes into and out of the viewport, according to the parameter passed
to sub offset().

Note that the data is not passed into this module. The module only keeps
track of the indexes within the viewport, i.e. indexes on the 'current' page.

You call sub bounds() on the object (of type Set::Window) returned by
sub offset(), to determine what indexes are on the 'current' page at any
particular point in time.

Also note that, unlike Set::Window, the boundaries of the viewport are
rigid, so that changes to the indexes caused by sub offset() are
limited by the size of the data set.

That is, when trying to go back past the beginning of the data set, the
bounds will be locked to values within 0 .. data_size.

Similarly, a call which would go beyond the other end of the data set,
will lock the bounds to the same range.

In short, you can't fall off the edge by calling sub offset().

This in turn means that the values returned by sub bounds() will
always be valid indexes within the range 0 .. data_size.

The module implements this by building 2 objects of type Set::Window,
one for the original data set (which never changes), and one for the
'current' page, which changes each time sub offset() is called
(until the boundaries are hit, of course).

Note: It should be obvious by now that this module differs from Data::Page,
and indeed all such modules, in that they never change the items which are
on a given page. They only allow you to change the page known as the
'current' page. This module differs, in that, by calling
sub offset(+ or - N), you are effectively changing the items which are
deemed to be on the 'current' page.

--
Cheers
Ron Savage, ron@savage.net.au on 5/12/2004
http://savage.net.au/index.html




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

Date: 8 Dec 2004 00:20:24 -0800
From: "xtracold" <newsgroups@xtracold.co.uk>
Subject: Re: Dynamic Search Tool
Message-Id: <1102494024.539778.208840@f14g2000cwb.googlegroups.com>


A. Sinan Unur wrote:
> "xtracold" <newsgroups@xtracold.co.uk> wrote in
> news:1102447370.007509.127060@f14g2000cwb.googlegroups.com:
>
> > Now, simply put, has anyone ever attempted this before?
>
> What have _you_ tried so far and what do you need help with?
>
> Please read the posting guidelines for this group:
>
> http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
>
> If you need someone to write something to your specifications, this
is not
> the right place to ask. Instead, you might want to head over to
> http://jobs.perl.org/
>
> Sinan

I'm not looking for a written solution, i'm looking for peoples past
experience of binding to each keystroke event in an Tk::Entry widget
and what performance I can expect. Perhaps there is another existing
add-on that I don't know about that already does this?



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

Date: Wed, 08 Dec 2004 01:03:06 -0600
From: Alan Mead <amead@comcast.net>
Subject: Re: examples using PDF::Template
Message-Id: <pan.2004.12.08.07.03.04.767916@comcast.net>

Star date: Tue, 07 Dec 2004 12:50:58 -0800, botfood's log:

Dan,

I think you'll find this group a whole lot more helpful if you give it a
try and then when you hit a sticking point, post about that specifically
with code.

> I have a possible project I am looking into that is basically creating
> a "mail-merge" utility that would chew through a big CSV spreadsheet
> and merge the fields into a template to generate a big .pdf document.
> The reason the client wants to go .pdf is to have a "print ready"
> format.

You could also consider creating a format that can be turned into PDF.  If
you play your cards right, you might be able to generate multiple versions
(on-line, print-ready, editable, etc.) from one source.

> After poking through CPAN, it looks like PDF::Template and/or
> PDF::Create are along these lines.... It is a little unclear to me how
> involved it would be to set up the template that I would "merge" into.
> There seem to be a LOT of parameters that would need to be set up in a
> root document, and I am wondering if there is a reasonably easy way to
> do this.
> 
> Like...
> - Can I take an existing authored .pdf page and clone all the margins
> settings and stuff like that?

Can you take a PDF file and use it this way?  Try and see.. I doubt it
highly.

> - Can I author a template with any special tags where I want to plug in
> my variable fields?

Yeah.  There are a million template solutions and you can always write
your own.  I like Text::Template because it is simple and it uses Perl as
the template language.  Template::Toolkit is the hot one and it is
feature-filled... "simple" is not applicable.

> If you have any tips, tutorials, or examples illustrating these modules
> that would help me determine if this is the way to go.... 

Have you tried googling "PDF::create" to see if you can find any code that
uses it?

-Alan


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

Date: Wed, 08 Dec 2004 09:47:34 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: examples using PDF::Template
Message-Id: <bnacr051oe09rkmj93397cdpvcs3950v4d@4ax.com>

On 7 Dec 2004 12:50:58 -0800, "botfood" <botfood@yahoo.com> wrote:

>I have a possible project I am looking into that is basically creating
>a "mail-merge" utility that would chew through a big CSV spreadsheet
>and merge the fields into a template to generate a big .pdf document.
>The reason the client wants to go .pdf is to have a "print ready"
>format.

Not really an answer to your question, but have you considered using
pdf(La)TeX for this purpose? Of course you can still use perl to build
the source...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Wed, 08 Dec 2004 09:07:41 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Generate Squential Numbers?
Message-Id: <cp6cjo$3jg$1@nntp.fujitsu-siemens.com>

Andrew Hamm wrote:
> A. Sinan Unur wrote:
>=20
>>>Use the time as a key so long as you are never likely to get 2 calls
>>>in the same second.
>>
>>'never likely' is not a meaningful statement. Something is either
>>possible or not possible. If you cannot rule out the possibility, the
>>fact that the probability might be small is not important.
>=20
>=20
> Yes indeed. "Unlikely" is the death-knell of any
> multi-user/multi-processing system. It leads to occasional conficts whi=
ch
> are some of the worst bugs to fix and the only evidence is a few corrup=
t
> records amongst millions.

Isn't "unlikely" a synonym for "will not happen during tests or qa, but=20
will happen when the customer does important work"?
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Wed, 08 Dec 2004 13:20:44 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: grammar function [OT - English Grammar]
Message-Id: <McDtd.4981$MS6.4287@trndny01>

"Ken Sington" <ken_sington@nospam_abcdefg.com> wrote in message
news:HJmdnb8C-OEc-CvcRVn-pw@speakeasy.net...
>
> chair remains chair if there are one or zero.

You have "zero chair"?  "zero desk"?  That doesn't especially sound like
correct (American) English to me.  Singular is used for one item.
Plural is used for not-one items.

Paul Lalli



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

Date: 8 Dec 2004 05:53:40 GMT
From: Christopher Nehren <apeiron+usenet@coitusmentis.info>
Subject: Re: grammar function
Message-Id: <slrncrd5n4.7cl.apeiron+usenet@prophecy.dyndns.org>

On 2004-12-08, Ken Sington scribbled these
curious markings:
> I'm hoping other's can add ideas to it.
             ^^^^^^^
Do you perhaps mean "others"? Writing a grammar checker is a laudible
goal, but you only add to the mess of bad grammar checkers (I offer the
grammar check in MS Word as a prime example) if you write one without
full mastery of the target language(s).

/me adds yet another item to the list of statements made by others
wherein they make statements claiming to be authoritative sources of
information on particular languages and coincidentally make grammar
mistakes in those same declarations of authority (this actually happens
a *lot* more often than one would think).

>                 $returnIt = $word . "es"; # box -> boxes

I disagree with this, for two separate but related reasons. First,
there's "boxen", which could be the ancient dual number (i.e., there
used to be three separate noun numbers in English: singular, dual, and
plural). Second, why box -> boxes but ox -> oxen? One of the reasons
that English is so difficult is because of its inconsistencies.

Best Regards,
Christopher Nehren
-- 
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated".  -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.


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

Date: Wed, 08 Dec 2004 07:02:27 -0500
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: Re: grammar function
Message-Id: <pKmdne9cxuG6cCvcRVn-iQ@speakeasy.net>

Christopher Nehren wrote:

> On 2004-12-08, Ken Sington scribbled these
> curious markings:
> 
> Do you perhaps mean "others"? Writing a grammar checker is a laudible
*smack* arrrg!
I was just smacking some else about that.  He put up a sign in the toilet "wash your hand's"

> goal, but you only add to the mess of bad grammar checkers (I offer the
> grammar check in MS Word as a prime example) if you write one without
> full mastery of the target language(s).
I was hoping for something simple. a simple checker where you'd feed a number to it.

But I soon realized I'd have a very long list of rules.

so everyone's (is...) telling me I should give up I guess.

> plural). Second, why box -> boxes but ox -> oxen? One of the reasons
> that English is so difficult is because of its inconsistencies.
And I'm using American English where colour became color and centre became center.
Or worst, "culla" "centa". 



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

Date: Wed, 08 Dec 2004 11:32:25 +0100
From: ziogas <ziogas@cern.ch>
Subject: How to call PL/SQL procs using Oraperl ?
Message-Id: <cp6l7p$ms1$1@sunnews.cern.ch>

Hello,
does anyone know how to call PL/SQL stored procedures using the Oraperl 
module ?
Is it possible or do I have to use the DBD::Oracle perl module ?
Appologies if this is the wrong forum but I can't seem to find a 
definite answer to this.
Nick


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

Date: 8 Dec 2004 00:07:48 -0800
From: "Leif Wessman" <leifwessman@hotmail.com>
Subject: Re: How to handle a HTTP::Request with gzip, deflate headers
Message-Id: <1102493268.755306.156990@f14g2000cwb.googlegroups.com>


Leif Wessman wrote:
> Gisle Aas wrote:
> > "Leif Wessman" <leifwessman@hotmail.com> writes:
> >
> > > $res->decoded_content now returns the decoded content for
webpages
> with
> > > Content-Encoding: gzip. However, when Content-Encoding is
'deflate'
> I
> > > get empty content. The website I'm testing on is Amazon.fr (they
> use
> > > deflate) so I guess the problem is in my code. Should it work
with
> > > deflate automatically?
> >
> > Yes, the code is there, but I have not actually tried it on a site
> > that use 'deflate' yet.  Can you give my an URL to try?
> >
> > --
> > Gisle Aas
>
> Sure. I tried this page:

Gisle, did decoding 'deflate' work when you tried it?
> http://www.amazon.fr/exec/obidos/ASIN/0136609112/t/



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

Date: 08 Dec 2004 14:15:38 +0100
From: Gisle Aas <gisle@activestate.com>
Subject: Re: How to handle a HTTP::Request with gzip, deflate headers
Message-Id: <87brd5exs5.fsf@ask.g.aas.no>

"Leif Wessman" <leifwessman@hotmail.com> writes:

> > I did not manage to get it to pass back deflated content to me.  I
> > just got back plain text/html.  Can you provide a complete example?
> 
> 
> This works for me:
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> use LWP::UserAgent;
> 
> my $ua = LWP::UserAgent->new;
> $ua->agent("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
> $ua->default_header("Accept-Encoding" => "gzip, deflate");
> my $url = "http://www.amazon.fr/exec/obidos/ASIN/0136609112/t/";
> my $req = HTTP::Request->new(GET => $url);
> 
> my $res = $ua->request($req);
> if ($res->is_success) {
> #print $res->content;
> print $res->decoded_content;
> } else {
> print "Error: " . $res->status_line . "\n";
> }
> 
> decoded_content is uninitialized in the above example, since deflate
> decoding doesn't seem to work. When using $res->content you can see the
> undecoded text. When checking the headers, Amazon adds the deflate
> header:
> 
> HTTP/1.1 200 OK
> Date: Wed, 08 Dec 2004 10:39:12 GMT
> Server: Stronghold/2.4.2 Apache/1.3.6 C2NetEU/2412 (Unix)
> amarewrite/0.1 mod_fastcgi/2.2.12
> Content-Encoding: deflate

What I found out is that they actually output the wrong format here as
"Content-Encoding: deflate" is supposed to imply that the content is
in the "zlib" format (see [1] as well as RFC 2616).  What is
unfortunate is that the zlib format contains data in the "deflate"
format, so it is not that hard to see how they managed to get this
wrong.  According to [2] (item 36) Microsoft introduced this brain
damage, so perhaps that explains why they only sent data in this
format when _you_ claim to be MSIE.  I also noticed that Apache's
mod_deflate will only compress into the "gzip" format as suggested by
the zlib FAQ to avoid this misunderstanding.

I'll see if I can hack libwww-perl to retry decoding with the
"deflate" format if decoding according to "zlib" fails.  Seems like a
good idea to be MSIE bug compatible again :-(

[1] http://www.iana.org/assignments/http-parameters
[2] http://www.gzip.org/zlib/zlib_faq.html

-- 
Gisle Aas


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

Date: 08 Dec 2004 08:11:46 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: New comp.lang.perl.misc mirror site at lampforums.org
Message-Id: <slrncrddq2.k4s.abigail@alexandra.abigail.nl>

Jim Keenan (jkeen_via_google@yahoo.com) wrote on MMMMCXVII September
MCMXCIII in <URL:news:cVstd.4133$4Y5.3482@trndny05>:
$$  astro wrote:
$$  
$$ > Thanks Jim,
$$ > 
$$ > We actually had a debate here regarding that--I thought it was Perl,
$$ > but then, somebody convinced me it was an acronym and thus should be
$$ > PERL, like NASA.
$$ > 
$$  
$$  It's more a retronym, i.e., the name Perl came first, and then came 
$$  various attempts to figure out if that was an abbreviation for 
$$  something.  Most serious attempt:  Practical Extraction and Report 
$$  Language.  The less serious attempts are easily googled for.

It has to be said that the "retronym" 'Practical Extraction and Report
Language' existed before Larry released version 1.0, as the manual page
for perl1 uses 'Practical Extraction and Report Language' to explain
the name perl:

    $ nroff -man perl-1.0.0/perl.man.1 | head -6 | tail -2
    NAME
           perl - Practical Extraction and Report Language


(And it has done so ever since).



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


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

Date: Wed, 08 Dec 2004 05:33:01 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Paragraph separation for DOS files on Unix
Message-Id: <x7653ds6b6.fsf@mail.sysarch.com>

>>>>> "OH" == Oliver Heidelbach <ohei@nospam.snafu.de> writes:


  OH> The usual 

what usual?

  OH> $/ = "";

that is for reading records.

  OH> @paras = split(/""/,$_);

no records are read there. and does $_ really have "" (pairs of double
quotes) in it. for that is what you are splitting on.

  OH> works fine for DOS files on systems with DOS format and DOS-aware
  OH> Perl and for Unix files on Unix systems and Unix-aware Perl.

so what? the split is wacky on both platforms unless you use "" as a
paragraph separator.

  OH> However, it does not work for DOS files on Unix systems. I tried
  OH> everything which came to my mind, but nothing really works.

  OH> e.g.:
  OH> $/ = "^\r*$";
  OH> @paras = split(/"^\r*$"/,$_);

  OH> $/ = "^\r\n$";
  OH> @paras = split(/"^\r\n"/,$_);

  OH> $/ = "^\s*$";
  OH> @paras = split(/"^\s*$"/,$_);

where did you learn to use "" inside a regex? burn that book. a regex is
ALREADY a double quotish string and can interpolate variables and most
string escape sequences just fine.

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: 8 Dec 2004 11:39:03 GMT
From: ohei@nospam.snafu.de (Oliver Heidelbach)
Subject: Re: Paragraph separation for DOS files on Unix
Message-Id: <uYfUC0dMvCdn-pn2-y6QnIXdJ39Pt@ohei.snafu.de>

Uri Guttman <uri@stemsystems.com> schrieb/wrote:

> >>>>> "OH" == Oliver Heidelbach <ohei@nospam.snafu.de> writes:

>   OH> @paras = split(/"^\s*$"/,$_);
> 
> where did you learn to use "" inside a regex? burn that book. a regex is
> ALREADY a double quotish string and can interpolate variables and most
> string escape sequences just fine.
> 
> uri
> 

Thanks a lot, that was the problem.

$/ = "";
@paras = split(/^\r*$/,$_);

works as it should.

I don't know why I wanted the regexp inside the.quotes  :(

Mit freundlichen Gruessen
Oliver Heidelbach

-- 
Internet: ohei@snafu.de
WWW: http://home.snafu.de/ohei



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

Date: 8 Dec 2004 09:55:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question on loops and return values
Message-Id: <cp6j2g$lo$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCXVI
> September MCMXCIII in <URL:news:cp47no$d7l$2@mamenchi.zrz.TU-Berlin.DE>:
> __  Tad McClellan  <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> __ > delfuego <djcameron60616@yahoo.com> wrote:
> __  
> __  [...]
> __  
> __ > >   $grate = eval { ($gvalue / $last) * 100 }; # growth rate percentage
> __ > 
> __ > 
> __ > Can you tell us why you are using eval() there?
> __  
> __  It's probably a misguided way of saying
> __  
> __      $grate = ($gvalue / $last) * 100 if $last;
> 
> 
> Except of course that the latter can give you an "Illegal division by zero"
> error, since numeric context ain't the same as boolean context.
> 
> 
>     $str = "700 00";
>     ($gvalue, $last) =~ $str = /(\d+)\s+(\d+)/;
>     $grate = ($gvalue / $last) * 100 if $last;
>     __END__
>     Illegal division by zero

Yes, they're not equivalent, but "...if $last" is the far more common
idiom, and it does the job for numeric data.  The original code is too
botched to make out what to expect for $last.  Then again, the OP also
has

    $gvalue = eval { $curr - $last };

so it looks like the author used eval for no good reason at all.

Oh, and... good to see you back.

Anno


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

Date: Wed, 08 Dec 2004 07:36:53 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: why the following HereDoc print don't work?
Message-Id: <rnbdr0dcv803uj2f8bsinh5fe9uqqdqa4h@4ax.com>

ÕÔ±û·å wrote:

>Perl complained "Can't find string terminator "EOF" anywhere before EOF at
>XXX(line No.)".
>What happened and why?

Check your line holding the "EOF". It is likely there is some whitespace
on it.

-- 
	Bart.


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

Date: Wed, 8 Dec 2004 13:08:59 GMT
From: Jaap Karssenberg <j.g.karssenberg@student.utwente.nl>
Subject: Zoidberg 0.92
Message-Id: <I8EnrJ.1w79@zorch.sf-bay.org>

Uploaded a new version of the zoidberg shell to CPAN last night.

Zoidberg (a.k.a. zoid) provides a modular Perl shell written,
configured, and operated entirely in Perl. It aspires to be a fully
operational login shell with all the features one normally expects. But
it also gives direct access to Perl objects and data structures from the
command line, and allows you to run Perl code within the scope of your
command line.

A bug in the 'export' builtin was fixed. Both the 'history' and 'fc'
builtins do work now. The history facilities have been modified. The
GetOpt library now supports default '--usage' and '--help' switches for
all builtin commands.

-- 
   )   (     Jaap Karssenberg || Pardus [Larus]                | |0| |
   :   :     http://pardus-larus.student.utwente.nl/~pardus    | | |0|
 )  \ /  (                                                     |0|0|0|
 ",.*'*.,"   Proud owner of "Perl6 Essentials" 1st edition :)  wannabe




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

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


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