[25575] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7819 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 23 11:05:55 2005

Date: Wed, 23 Feb 2005 08:05:34 -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, 23 Feb 2005     Volume: 10 Number: 7819

Today's topics:
        =?ISO-8859-1?Q?Re=3A_unicode=3A_=E9=3D=3Ee=2C_=E1=3D=3E <flavell@ph.gla.ac.uk>
        ANNOUNCE: Search::InvertedIndex::Simple V 1.00 <ron@savage.net.au>
    Re: Annoying Problem with a Basic Perl app and XP Pro <jpmythic@ntlworld.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Annoying Problem with a Basic Perl app and XP Pro <tadmc@augustmail.com>
    Re: Comparing huge XML Files xhoster@gmail.com
        FTP from macro <JM@jm.biz>
    Re: FTP from macro <1usa@llenroc.ude.invalid>
    Re: FTP from macro <spamtrap@dot-app.org>
    Re: FTP from macro <jpmythic@ntlworld.com>
        glob <emanuele.matli@cern.ch>
    Re: Need help with CGI/ DBI error (permissions?) <pat@patmail.com>
    Re: Perl Hash problem (with registry) thomasjbs@gmail.com
    Re: Perl Hash problem (with registry) thomasjbs@gmail.com
        regexp <alexj@floor.ch>
    Re: regexp <do-not-use@invalid.net>
    Re: regexp <noreply@gunnar.cc>
    Re: regexp (Anno Siegel)
    Re: regexp <alexj@floor.ch>
        Time::Format with two $time strings <geen@mail.invalid>
    Re: Time::Format with two $time strings <1usa@llenroc.ude.invalid>
    Re: Time::Format with two $time strings <geen@mail.invalid>
    Re: unicode: =?iso-8859-1?q?=E9=3D=3Ee=2C_=E1=3D=3Ea?= <posted@cyberpomo.com>
    Re: unicode: =?iso-8859-1?q?=E9?==>e, =?iso-8859-1?q?=E <do-not-use@invalid.net>
    Re: Write-Only Socket <news@chaos-net.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 23 Feb 2005 14:35:47 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: =?ISO-8859-1?Q?Re=3A_unicode=3A_=E9=3D=3Ee=2C_=E1=3D=3Ea?=
Message-Id: <Pine.LNX.4.61.0502231422070.27184@ppepc56.ph.gla.ac.uk>

On Wed, 23 Feb 2005, Jürgen Exner wrote:

> while IE has many flaws

Somehow if "apples" are involved, I'm not sure that Win IE is the 
topic of discourse.  It might be worth stressing that Mac IE and Win 
IE are totally different products.

> it surely can display Unicode characters in dropdowns (even those 
> outside of the ASCII range) just fine provided you have the proper 
> code page installed

Erm, code pages, what?  I thought those went out of fashion with DOS, 
sorry.

I got my *Windows* borders, dropdowns, popups etc. to support a much 
wider character repertoire by going to control panel -> Display -> 
Appearance, and selecting a more-appropriate font for the various 
"Items" than the Windows installation had chosen by default.

However, what relevance that might have to Apples and Perls is
admittedly questionable.

> But this is way off topic in a Perl NG and you may want to discuss 
> this in a NG dedicated to web programming or IE.

Conceded ;-)


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

Date: Wed, 23 Feb 2005 10:16:58 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: Search::InvertedIndex::Simple V 1.00
Message-Id: <ICDEqp.nrA@zorch.sf-bay.org>

The pure Perl module Search::InvertedIndex::Simple 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:

The input to new(dataset => $a, keyset => $k) is an arrayref of data (each element of which is a hashref),and an arrayref of keys.

The arrayref of data is in the format returned by many DBI methods,eg DBI's fetchall_arrayref({}) and DBIx::SQLEngine's fetch_select().

The arrayref of keys is used to select a subset of the keys within each hashref.These selected keys become the primary keys in the hashref returned by the method build_index().

In the example in the synopsis, build_index() will return a hashref with the primary keys 'address' and 'time'.

The values (assumed to be strings) from the arrayref of data corresponding to those keys are used to create a set of secondary keys under each of these primary keys.

The secondary keys are created by taking these values, growing them one character at a time, and using these generated strings as the secondary keys in the hashref returned by the method build_index().

In the example in the synopsis, build_index() will return a hashref where the primary key 'address' will have these secondary keys: H, He, Hea, Heav, Heave, Heaven, Her, Here, T, Th, The, Ther, There.

This means that all data values for the key 'address', and all prefixes of those values, are used to create entries in the returned hashref.

Similary, the primary key 'time' will have a set of secondary keys.

It should be clear by now that these sets of secondary keys can be used for searching for the existence of values, eg by using as input user-supplied data of any length. At the same time, any number of keys can be searched for simultaneously.

Consider:

my($indexer) = Search::InvertedIndex::Simple -> new(...);
my($index)   = $indexer -> build_index();

Now we can tell instantaneously which elements of the dataset contain the results of a multi-key search:

my(@index) = $$index{'address'}{'He'} -> intersection($$index{'time'}{'T'}) );

That is, @index = (1). In other words, $$d[1] contains the only hashref where we have an address value starting with 'He' and a time value starting with 'T'.

Here, intersection() is a method available to objects of type Set::Array, and it returns a list.
--
Cheers
Ron Savage, ron@savage.net.au on 23/02/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company




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

Date: 23 Feb 2005 06:43:13 -0800
From: "arek" <jpmythic@ntlworld.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <1109169793.665185.212260@f14g2000cwb.googlegroups.com>

Yes XP Pro CAN BE more strict with file access..

I setup the XP Pro box with NTFS and used Fat32 on the Home box.
Several reason for that, I'll leave to the "Pros" to figure out.
That in itself will say ALOT about file access...

And since I got so little help from the "Pros", I'll leave it to the
"Pros"
to figure out where the BUG was in how it ran on XP Pro and XP Home...

So to state it simply, I fixed it with the help from ONE person out of
ALL
the other Garbage posts in this thread,  being the reminder to use
[ use warnings ] which got me on the right track.

The Troll



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

Date: Wed, 23 Feb 2005 09:32:36 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p8gk.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> Actually those were caused by Wrapping during post...


Then you should disable wrapping during posts, we are not mind readers.


> So a more usefull reply would be appreciated...


Then post the actual code.


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


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

Date: Wed, 23 Feb 2005 09:38:28 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p8rk.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> Can't edit the post to correct it...


So long then!


> As far as that goes, did ANYBODy even bother to Read what the Code was
> doing?


No, because we could see that it was not the actual code.


> Any body halfway decent at coding would have easily seen the need to
> change that to a
> shorter period to do testing...


Anybody halfway decent at coding...


> If people spent more time helping rather then groaning about simple
> typos and a


 ... would know that a syntax error is not a "simple typo".


> SMALL error in posted code...


How are we to know that the small error is not the cause of your problem?


> If you were Really good at Coding, that SMALL error shouldn't have even
> made you blink!
> ONE missing [ ( ] and everyone's bitching...


You expect hundreds of people to fix the mangled code, AND then
debug it for you?

We are volunteers here, if you make it hard to help you, then we're
likely to just move on to helping someone who makes it easy to
be helped.


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


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

Date: Wed, 23 Feb 2005 09:44:41 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p979.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> Rather useless post in
> many ways.


So was posting code that is not the code you are running.

You reap what you sow.


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


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

Date: Wed, 23 Feb 2005 09:46:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9bd.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> If your [Exhausted] from reading less then 2 pages of code,
> How the heck can you debug 10K lines worth of Code?


What you are willing to do is much different when volunteering
in comparison to working for pay.


> I work with programs that contain more then 500 seperate documents


We are all impressed, I'm sure.


> and your complaing about less then TWO pages Heavily Commented??


You are _working_.

We are _volunteering_.


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


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

Date: Wed, 23 Feb 2005 09:48:26 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9ea.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> Again...  Yes I am aware of That... 


What that is that?

Please post some context when composing a followup.


> I posted the full code as it is suppose to run...


I missed where you did that.

The only code I saw you post was not Perl.


> Sheesh.


Exactly.


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


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

Date: Wed, 23 Feb 2005 09:50:42 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9ii.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> SOOOooo  with all your gripes over simple errors in the post Nobody
> bothered to look at where it actually
> had a problem:


That's because the code was not Perl.

Review the angst and unhelpfulness evident in this thread.

Notice that none of it would have happened if you had posted
Real Perl code.

Maybe you should consider posting Real Code in the future to
avoid such silliness?


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


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

Date: Wed, 23 Feb 2005 09:52:34 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9m2.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> Never used XP Home eh? then how can you effectivley Answer my
> problem/question?


_Nobody_ can help with your problem, because nobody can
see the code that you are running.


> So I am a troll eh? 


Yes, that is patently obvious.


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


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

Date: Wed, 23 Feb 2005 09:53:39 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9o3.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:

> being the reminder to use
> [ use warnings ] which got me on the right track.


Have you seen the Posting Guidelines that are posted here frequently?

You could have been on the right track in seconds if you had...


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


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

Date: Wed, 23 Feb 2005 09:54:01 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <slrnd1p9op.5tn.tadmc@magna.augustmail.com>

arek <jpmythic@ntlworld.com> wrote:


> I don't think I will be back..


Thank you.


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


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

Date: 23 Feb 2005 16:02:22 GMT
From: xhoster@gmail.com
Subject: Re: Comparing huge XML Files
Message-Id: <20050223110222.373$PQ@newsreader.com>

"junnuthala" <junnuthula@yahoo.com> wrote:
> Hello,
>
> Can someone please suggest me a Perl module for comparing huge XML
> Files.

How about just an ordinary text-based file diff on them?


> I tried XML::SemanticDiff, but it is taking a lots and lots of time to
> load the XML File nodes, elements and attributes to the Hash.

Is it CPU limited or is it swapping itself silly?

Comparing huge XML files requires a huge amount of work, and
that takes a huge amount of resources, which often translates into
long processing times.  I doubt that finding another Perl module is
going to change that, unless it makes use of additional constraints on
the organization of the XML files to be compared, which you haven't given
us any information about.

Xho

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


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

Date: Wed, 23 Feb 2005 14:11:18 GMT
From: "J M" <JM@jm.biz>
Subject: FTP from macro
Message-Id: <aa0Td.40158$wi2.11982@newssvr11.news.prodigy.com>

How can I implement following in perl?  Multiline OS level command

/usr/bin/ftp -i $ftp_host  <<FTP_TAG
user $user $key
cd $remote_dir
put $localfile_with_full_path
quit
 FTP_TAG




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

Date: 23 Feb 2005 14:26:15 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: FTP from macro
Message-Id: <Xns960660013B4Basu1cornelledu@132.236.56.8>

"J M" <JM@jm.biz> wrote in news:aa0Td.40158$wi2.11982
@newssvr11.news.prodigy.com:

> How can I implement following in perl?  Multiline OS level command
> 
> /usr/bin/ftp -i $ftp_host  <<FTP_TAG
> user $user $key
> cd $remote_dir
> put $localfile_with_full_path
> quit
>  FTP_TAG

CPAN is your friend. Search for Net::FTP.

Sinan


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

Date: Wed, 23 Feb 2005 09:23:52 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: FTP from macro
Message-Id: <9vadnVhhef5kDIHfRVn-2Q@adelphia.com>

J M wrote:

> How can I implement following in perl?  Multiline OS level command
> 
> /usr/bin/ftp -i $ftp_host  <<FTP_TAG
> user $user $key
> cd $remote_dir
> put $localfile_with_full_path
> quit
>  FTP_TAG

If you want to implement the *exact* steps taken above - i.e. run /usr/bin
ftp and feed it some commands - have a look at the open() function. It can
pipe output to another process just as easily as to a file.

If you want to implement the same functionality, without relying on an
external program, have a look at the Net::FTP module.

And finally, if you want me to write it for you, pay me. ;-)

sherm--

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


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

Date: 23 Feb 2005 06:33:42 -0800
From: "arek" <jpmythic@ntlworld.com>
Subject: Re: FTP from macro
Message-Id: <1109169222.618324.298890@o13g2000cwo.googlegroups.com>

do a search for AutoFtp.pl

This was put out ages ago by one author and the basics work well
I did some modifications to it for my own purposes, altho I did
run into a few problems...

Solved those now, altho with very little help from here.



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

Date: Wed, 23 Feb 2005 15:48:52 +0100
From: Emanuele Matli <emanuele.matli@cern.ch>
Subject: glob
Message-Id: <cvi4lp$deq$1@sunnews.cern.ch>

Hi,

I have a problem using glob on my cgi perl program.
If I try to call glob twice the program crashes giving one of this errors:

*** malloc[2302]: error for object 0xbffffe20: Pointer being reallocated 
was not allocated
Out of memory!

*** malloc[2396]: Deallocation of a pointer not malloced: 0x65726c00; 
This could be a double free(), or free() called with the middle of an 
allocated block; Try setting environment variable MallocHelp to see 
tools to help debug
Segmentation fault

I'm using perl, v5.8.1-RC3 on MAC OSX.

Thanks,

E.


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

Date: Wed, 23 Feb 2005 14:40:45 GMT
From: "patrickg" <pat@patmail.com>
Subject: Re: Need help with CGI/ DBI error (permissions?)
Message-Id: <NB0Td.99539$qB6.84487@tornado.tampabay.rr.com>


"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns96059D1E83AE1asu1cornelledu@132.236.56.8...

> Then, I thought to myself, while the solution might be obvious to me,
> maybe you were frustrated by many fruitless Google searches or something
> because finding the right answer required coming up with a magic
> combination of keywords.
>
> So, I went to <URL: http://www.google.com/>, typed in
>
> perl iis oracle
>
 <snip>

> As I pointed out, this is not a Perl issue, but a web server + OS
> configuration issue.
>

1) Thanks
2) If the solution were so obvious to you, why didn't just give it instead
of all the previous BS?
3) If you believed it wasn't a Perl issue, then why was 'perl' the first
keyword you typed in the google search??
4) The solution stated "...The perl scripts need to go outside of the perl
directories to use Oracle stuff..."
     Therefor, this IS Perl *related*, and thus is NOT OT for this forum.

Reading through some of your other 'help' that you've given others, it seems
as though you get this sort of high in feeling superior to others because
you know something that they don't. Well, I (and most everyone else, for
that matter) have my own areas of expertise, and I  never patronize somebody
who needs help. We all started off on square one - remember that. If you
don't want to help, then don't. But leave your ego trip in Turkey.




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

Date: 23 Feb 2005 06:16:11 -0800
From: thomasjbs@gmail.com
Subject: Re: Perl Hash problem (with registry)
Message-Id: <1109168171.693736.3560@f14g2000cwb.googlegroups.com>


Dave Weaver wrote:
> On 23 Feb 2005 00:02:27 -0800, thomasjbs@yahoo.com
<thomasjbs@yahoo.com> wrote:
> >  Getting strange error message: "Can't coerce array into hash at
test.pl
> >  line 21 with the following code: (line 22 with added comment)
>
> >  	$q->GetValues(\%klist);
> ...
> >  	while (($k,$d)=each(%klist)) {
> ...
> >  			$d = %$d;
>
> What do you expect that last line to do?
>

Without the last line, the output shows array hashes instead of the
actual data.  Perhaps some of the entries do not need to be extracted
from the hash, but I don't how to tell whether a value needs to be
extracted from the hash.

> I know nothing about Win32::Registry, but according to the docs:
>
>   GetValues:
>     Populates the supplied hash reference with entries of the form
>
>     $value_name => [ $value_name, $type, $data ]
>
> i.e. the value of each entry ($d in your code) is an array ref. You
> are dereferencing it as though it was a hash ref.
>
> Instead of:
> >                       $d = %$d;
> >			print $k," ",$d,"\n";
>
> try:
> 	print "key: $k - $name: $d->[0]  type: $d->[1]  data: $d->[2]";
> 
> (untested).

Thanks, I'll try that.



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

Date: 23 Feb 2005 06:20:15 -0800
From: thomasjbs@gmail.com
Subject: Re: Perl Hash problem (with registry)
Message-Id: <1109168415.798142.99210@g14g2000cwa.googlegroups.com>


Peter Wyzl wrote:
> <thomasjbs@yahoo.com> wrote in message
> news:1109145747.375288.82950@g14g2000cwa.googlegroups.com...
> : Getting strange error message: "Can't coerce array into hash at
test.pl
> : line 21 with the following code: (line 22 with added comment)
> :
> : I'm very new at using hashes and Perl on registry.  The strange
part is
> : that it gets through processing about 50 items before the error
occurs.
> :
> : The goal is to simply read the registy and print out a list of
> : installed applications.  Although there might be simple methods to
do
> : this, the secondary goal is to learn to use hashes.
> :
> : Apparently the data is stored as a hash inside a hash.
> :
> : Anyone know what's going on?
>
> Maybe you have a problem in the registry?  It seems to work on my
system,
> with several caveats:
> :
> : (run on Windows XP system with Activestate perl).
>
> use warnings;
> use strict;
>
> # Will report a few little problems as detailed below.
>
> : use Win32::Registry;
>
> The docs say this is an obsolete module, use Win32::TieRegistry
instead...

I tried TieRegistry first, but I could not find any working examples
(even the examples in the documentation failed.)

>
> : my $Register =
> : "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
> : my ($hkey, @key_list, $key, @klist);
>
> @klist is declared here, but below you use %klist...
>
> : $cnt = 0;
>
> Here you set $cnt, and then never increment it...
>

I tried *many* different methods to extract the data from the hash - I
was aware that $cnt is notused in the most recent attempt.

> : $HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die $!;
> : $hkey->GetKeys(\@key_list);
>
> : print "$Register keys\n";
> : foreach $key (@key_list)
> : {
> : $tmpkey = $Register . "\\" . $key . $DisplayName;
>
> $DisplayName is used without being declared and is a null value
>
Originally that was "DisplayName".  the '$' was a typo in one of the
edits.

> : $HKEY_LOCAL_MACHINE->Open($tmpkey,$q) or next;
>
> What do you expect $q to be at this point?
>
> : $q->GetValues(\%klist);

I thought $q was a handle for the Registry read.  $q seemed to be
working fine as I got a lot of data into the klist hash.

> :
> : #print $klist{'Display Name'},"\n";
> : while (($k,$d)=each(%klist)) {
> : if (lc $k eq "display name") {
> : print $tmpkey,"\n";
> : print $d,"\n";;
> : ### Error is next line ###
> : $d = %$d;
> : print $k," ",$d,"\n";
> : #@e = %$d;
> : }
> : }
> : $q->Close();
> : # $cnt++;
> :
> : print "$key\n";
> : }
> : print $cnt;
> : $hkey->Close();
>
> My head hurts....

Mine too.

> 
> P
> -- 
> print "Just another Perl Hacker";



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

Date: Wed, 23 Feb 2005 15:29:48 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: regexp
Message-Id: <cvi40p$ug$1@news.hispeed.ch>

Hi does someone could clear my mind and tell me what would mean :

$loop_hs =~ s/\$HTML{\'$noteval\'}/\*HTML{\'$noteval\'}/g;

thx in advance


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

Date: 23 Feb 2005 15:43:37 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: regexp
Message-Id: <yzdacpvz692.fsf@invalid.net>


Alexandre Jaquet <alexj@floor.ch> writes:
> Hi does someone could clear my mind and tell me what would mean :
> 
> $loop_hs =~ s/\$HTML{\'$noteval\'}/\*HTML{\'$noteval\'}/g;

It assumes that the variable $noteval has a value; let's say it contains
"foo".

Then the statement takes the string $loop_hs and in it replaces all
occurrences of the character '$' with '*' when they are followed by
"HTML{'foo'}".

I imagine "noteval" is to be read "not eval[uate]".

I don't know if that will clear your mind...


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

Date: Wed, 23 Feb 2005 15:54:05 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regexp
Message-Id: <383jofF5h5m1lU1@individual.net>

Arndt Jonasson wrote:
> Alexandre Jaquet <alexj@floor.ch> writes:
>> Hi does someone could clear my mind and tell me what would mean :
>>
>> $loop_hs =~ s/\$HTML{\'$noteval\'}/\*HTML{\'$noteval\'}/g;
> 
> It assumes that the variable $noteval has a value; let's say it contains
> "foo".
> 
> Then the statement takes the string $loop_hs and in it replaces all
> occurrences of the character '$' with '*' when they are followed by
> "HTML{'foo'}".

Since there are several redundant backslashes, i.e.

     $loop_hs =~ s/\$HTML{'$noteval'}/*HTML{'$noteval'}/g;

would do the same, it also means that the programmer isn't very good at 
regular expressions in Perl. ;-)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 23 Feb 2005 15:00:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regexp
Message-Id: <cvi5rb$oeh$1@mamenchi.zrz.TU-Berlin.DE>

Alexandre Jaquet  <alexj@floor.ch> wrote in comp.lang.perl.misc:
> Hi does someone could clear my mind and tell me what would mean :
> 
> $loop_hs =~ s/\$HTML{\'$noteval\'}/\*HTML{\'$noteval\'}/g;

Where did you get that?  Whoever wrote it doesn't know Perl very well,
evidenced by the use of unnecessary escapes.  "'" is not special in a
regex, so

    s/\$HTML{'$noteval'}/\*HTML{'$noteval'}/g;

would do the same thing.

What it *means* is impossible to say without context.

What it *does* is basically change dollar signs ($) to asterisks (*)
if the conditions are right.  The conditions depend on the content of
$loop_hs and $noteval.

Example for the right conditions:

    my $loop_hs = q($HTML{'XXX'});
    my $noteval = 'XXX';
    print "$loop_hs -> ";
    $loop_hs =~ s/\$HTML{'$noteval'}/\*HTML{'$noteval'}/g;
    print "$loop_hs\n"; # $HTML{'XXX'} -> *HTML{'XXX'}

Anno


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

Date: Wed, 23 Feb 2005 16:26:35 +0100
From: Alexandre Jaquet <alexj@floor.ch>
To: Anno Siegel <anno4000@lublin.zrz.tu-berlin.de>
Subject: Re: regexp
Message-Id: <421CA0AB.5010408@floor.ch>

Anno Siegel a écrit :
> Alexandre Jaquet  <alexj@floor.ch> wrote in comp.lang.perl.misc:
> 
>>Hi does someone could clear my mind and tell me what would mean :
>>
>>$loop_hs =~ s/\$HTML{\'$noteval\'}/\*HTML{\'$noteval\'}/g;
> 
> 
> Where did you get that?  Whoever wrote it doesn't know Perl very well,
> evidenced by the use of unnecessary escapes.  "'" is not special in a
> regex, so
> 
>     s/\$HTML{'$noteval'}/\*HTML{'$noteval'}/g;
> 
> would do the same thing.
> 
> What it *means* is impossible to say without context.
> 
> What it *does* is basically change dollar signs ($) to asterisks (*)
> if the conditions are right.  The conditions depend on the content of
> $loop_hs and $noteval.
> 
> Example for the right conditions:
> 
>     my $loop_hs = q($HTML{'XXX'});
>     my $noteval = 'XXX';
>     print "$loop_hs -> ";
>     $loop_hs =~ s/\$HTML{'$noteval'}/\*HTML{'$noteval'}/g;
>     print "$loop_hs\n"; # $HTML{'XXX'} -> *HTML{'XXX'}
> 
> Anno

thanks guyz =)


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

Date: Wed, 23 Feb 2005 15:56:54 +0100
From: ruud <geen@mail.invalid>
Subject: Time::Format with two $time strings
Message-Id: <cvi5lo$lcb$2@box.nl-netwerken.com>

Is it possible to make with Time::Format two strings like this:

$time1{ddmmyyyy}
$time2{ddmmyyyy}

I only see one $ in the doc's...
-- 
Gr. Ruud
news://news.nl-netwerken.com


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

Date: 23 Feb 2005 15:45:10 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Time::Format with two $time strings
Message-Id: <Xns96066D613B4Dasu1cornelledu@132.236.56.8>

ruud <geen@mail.invalid> wrote in news:cvi5lo$lcb$2@box.nl-netwerken.com:

> Is it possible to make with Time::Format two strings like this:
> 
> $time1{ddmmyyyy}
> $time2{ddmmyyyy}
> 
> I only see one $ in the doc's...

What? Please try to paraphrase the question so it make sense.

Surely, you are not asking if the following is possible:

C:\Documents and Settings\asu1\My Documents> cat t.pl
use strict;
use warnings;

use Time::Format;

print "$time{'ddmmyyyy'}\n";
print "$time{'ddmmyyyy'}\n";

__END__


C:\Documents and Settings\asu1\My Documents> perl t.pl
23022005
23022005

Sinan


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

Date: Wed, 23 Feb 2005 16:50:18 +0100
From: ruud <geen@mail.invalid>
Subject: Re: Time::Format with two $time strings
Message-Id: <cvi8ps$lk0$1@box.nl-netwerken.com>

A. Sinan Unur wrote:

> Surely, you are not asking if the following is possible:
> print "$time{'ddmmyyyy'}\n";
> print "$time{'ddmmyyyy'}\n";

No, this is one string.

I have two dates, today and a timestamp from a file.
So i need two different strings in the ddmmyyyy format.

$today{ddmmyyyy};
$timestamp{ddmmyyyy};

Like that.

English is not my native language, so it's sometimes hard to explain what i
exactly want.
Sorry for that.
-- 
Gr. Ruud
news://news.nl-netwerken.com


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

Date: Wed, 23 Feb 2005 16:36:52 +0100
From: Calle Dybedahl <posted@cyberpomo.com>
Subject: Re: unicode: =?iso-8859-1?q?=E9=3D=3Ee=2C_=E1=3D=3Ea?=
Message-Id: <m2brabwanf.fsf@ulthar.bisexualmenace.org>

>>>>> "peter" == peter pilsl <pilsl@goldfisch.at> writes:

> I'm working on a project, that is fully implemented in unicode. We
> need to support non-unicode-able terminals in a very spartanic way. 
> By now we simple nuke everything that is not [a-z0-9] for these
> terminals. But I think it could be done a bit better by replacing
> common unicodes by their latin "nearbyes" like é=>e, á=>a ...

No, that would be worse. If you just remove the characters that can't
be displayed (preferably replacing them with question marks or
something similar), it's obvious that your text has been changed. If
you try to remove what you think are accents you are quite likely to
inadvertently change the meaning of the text. For example, in Swedish
text you would change the word for "to hear" ("höra") to the word for
"whore" ("hora"). In any reasonably professional context this will
very rarely be to your advantage.
-- 
		     Calle Dybedahl <calle@cyberpomo.com>
		 http://www.livejournal.com/users/cdybedahl/
   "Being stomped on by some sexy commie chick and her perfectly vegan Doc
	       Martens is not as hot as it sounds." -- babycola


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

Date: 23 Feb 2005 15:19:17 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: unicode: =?iso-8859-1?q?=E9?==>e, =?iso-8859-1?q?=E1?==>a
Message-Id: <yzdekf7z7dm.fsf@invalid.net>


peter pilsl wrote:
[...]
> terminals. But I think it could be done a bit better by replacing
> common unicodes by their latin "nearbyes" like é=>e, á=>a ...

Maybe the CPAN module Unicode::Lite does this - it seems from its
description that it might.


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

Date: Wed, 23 Feb 2005 15:06:28 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Write-Only Socket
Message-Id: <slrnd1p3f4.56b.news@maki.homeunix.net>

xhoster@gmail.com wrote :
> Martin Kissner <news@chaos-net.de> wrote:
>> The question is:
>> Why do I have to shutdown(0) $session _and_ $socket on the server?
>
> As far as I can tell, you don't.  I get the same behavior whether $socket
> is shutdown or not.

Yes, now I get the same result. I can't reproduce the behaviour I had
last time when I tried.

>> I had expected that the client would not be able to write to his $socket
>> if only $session on the server was shutdown(0)
>
> I don't see that happening regardless of what you shutdown.  It looks to me
> like the client is prohibited from writing to the socket only because
> server exits.  shutdown(0) does not seem to be enforced on the other
> end of the socket.

Yes, that seems to be true.
I changed my server script so it will not die but warn if 'getline'
fails. Now I get another unexpected result. The server starts reading
from the socket after one loop (Code and output below).
Can anyone explain this?
How could I permanently close the socket for reading?


Here is the new code of the server:
----
#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;

my $socket = IO::Socket::INET->new(
    Listen      => 1,
    LocalPort   => 1025,
    Proto       => 'tcp',
    Reuse       => 1);

my $session = $socket->accept;
$session->shutdown(0) or die;

while(1) {
    my $read = $session->getline or warn "I can not read: $!\n";
    print $read;
    sleep 1;
}
-----


Here is the output after I had started the client (with comments)
--- start output ---
		# first loop
I can not read: 
Use of uninitialized value in print at ./server.pl line 22.
		# second loop
Client tries to write
Client tries to write
Client tries to write
Client tries to write
		# Here I killed the client
I can not read: 
Use of uninitialized value in print at ./server.pl line 22, <GEN1> line 4.
I can not read: 
Use of uninitialized value in print at ./server.pl line 22, <GEN1> line 4.
		# Here I killed the server
^C
end output ---


Here is the client code (if anybody wants to try it him/herself)
--- client code ---
#!/usr/bin/perl

use warnings;
use strict;

use IO::Socket;

my $socket = IO::Socket::INET->new(
    PeerHost    => 'localhost',
    PeerPort    => 1025,
    Proto       => 'tcp') or die "Connection failed: $!\n";

while (1) {
    print "Client is printing to socket\n" if print $socket "Client
tries to write\n";    sleep 1;
}
--- end ---

-- 
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
 .114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
 s{sleep 1};sub p(){print "@_"}'


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

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


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