[19953] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2148 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 17 14:05:54 2001

Date: Sat, 17 Nov 2001 11:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006023911-v10-i2148@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 17 Nov 2001     Volume: 10 Number: 2148

Today's topics:
    Re: ActivePerl 5.6.1 and Internal Error 2355 <parmeet@emirates.net.ae>
        Algorithm question -- need help (Arkady)
    Re: Algorithm question -- need help (Clinton A. Pierce)
    Re: attach file <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Best language for low IQ programmers? <andrzej@chaeron.spamicide.com>
    Re: Binary issues.. <mds@wam.umd.edu>
    Re: Binary issues.. (Clinton A. Pierce)
    Re: Binary issues.. <flavell@mail.cern.ch>
    Re: Binary issues.. <vze33mmh@verizon.net>
    Re: Cancel button to exit confirmation page? (Stephen Patterson)
    Re: Cancel button to exit confirmation page? (David Kenneally)
        Compile error <a@b.com>
    Re: Compile error <piotr.maj@gekon.pl>
    Re: Exact match with the Regular expression (Sam)
    Re: Fast Portable Logical Shift Right in Perl ? (Garry Williams)
    Re: Fast Portable Logical Shift Right in Perl ? <slytobias@home.com>
    Re: how to create a file that doesn't exist? <parmeet@emirates.net.ae>
        if statements are not working! what am i missing? (B Smith)
    Re: if statements are not working! what am i missing? (Mark Jason Dominus)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 17 Nov 2001 21:46:40 +0400
From: "Parmeet" <parmeet@emirates.net.ae>
Subject: Re: ActivePerl 5.6.1 and Internal Error 2355
Message-Id: <9t67gs$nm71@news.emirates.net.ae>

please read the apache documentations and setup the server properly

--
--------------------------------------------
Parmeet.S.Khurana
email::parmeet@emirates.net.ae
-http://www.cgi.sphosting.com
-http://cloud9.nethop.com
--------------------------------------------
-http://www.shekharrahate.com
-http://www.ultimate-fashions.com
"Twist" <twist@o2.pl> wrote in message news:9t3vha$s7o$1@news.tpi.pl...
> I am attempting to install Active.. on a Windows 98 platform
> and received the following error: "Internal Error 2355". Has anyone had
> any experience with this type of error? What should I do?
> Is any way to resolve this problem?
>
>




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

Date: 17 Nov 2001 05:40:37 -0800
From: apinkhasov@hotmail.com (Arkady)
Subject: Algorithm question -- need help
Message-Id: <30d03e1.0111170540.196d9838@posting.google.com>

I have a list of machines and their respective parents.  One machine
is a root, and the others follow from it.  However, I cannot get the
right idea for a kind of data sttructure to work properly and
algorithm to populate it.

If anybody has any suggestions, please do not hesistate to help.

Thanks,

Arkady.


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

Date: Sat, 17 Nov 2001 17:09:12 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Algorithm question -- need help
Message-Id: <YQwJ7.30400$RI2.14182569@news2>

[Posted and mailed]

In article <30d03e1.0111170540.196d9838@posting.google.com>,
	apinkhasov@hotmail.com (Arkady) writes:
> I have a list of machines and their respective parents.  One machine
> is a root, and the others follow from it.  However, I cannot get the
> right idea for a kind of data sttructure to work properly and
> algorithm to populate it.

You obviously have some kind of tree.  Building trees from a list 
like this isn't incredibly hard.
 
> If anybody has any suggestions, please do not hesistate to help.

Whatcha want to use it for?  There's lots of ways of representing this,
but some make it easier to do what you want than others.

-- 
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org                Perl Developer's Dictionary
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sat, 17 Nov 2001 10:14:11 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: attach file
Message-Id: <9t59p3$1ti$06$1@news.t-online.com>

On Sat, 17 Nov 2001 15:53:33 +0800, Dennis wrote:
> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_029C_01C16F80.02A74C20
> Content-Type: text/plain;
> 	charset="big5"
> Content-Transfer-Encoding: 7bit
> 
> Take this,

1) Please quote a minimum of lines from the original message so that
people are not required to press a certain key-sequence to see the
posting you are referring to (ESC-p in my case).

2) Please do not post multipart messages.

3) Please do not post things that are targeted for a single individual
in this group. If someone requests a script, send it by mail and not
into this group (I admit, one can argue about the last point as long as
the script is in Perl).

Thank you,
Tassilo
-- 
Misfortunes arrive on wings and leave on foot.


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

Date: Sat, 17 Nov 2001 10:05:36 -0500
From: Andrzej Jan Taramina <andrzej@chaeron.spamicide.com>
Subject: Re: Best language for low IQ programmers?
Message-Id: <d3vcvto5f5126826rie6lbm4rekn1r3a90@4ax.com>


> BrianMetc@aol.com (Brian Metc) wrote in message news:<1004990076967295@aol.com>...
> > I would like to get into the programing field. My problem is that I have low IQ due to
> > early childhool learning deprivation and TV overdose. Simply said I am stuped, I am 
> > pretty good amongst my friends, but not solving problems. You know what I
> > mean. Anyways, I want to go into computor programing because of money
> > issue. I now need to choose languege for programming, simple enough
> > for me.

> > Would any one sugest the best language for me.

English.  If this is a "genuine" question, I think you need to rethink
whether programming is the best avenue for you to pursue.  A career in
QA/Testing might be more in tune with your abilities rather than
programming.

Oh...and turn the TV off and get some books out instead.


Andrzej Jan Taramina

Chaeron Consulting Corp
Enterprise System Solutions
http://www.chaeron.com

NOTE: Remove Spamicide(tm) before replying!!!


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

Date: Sat, 17 Nov 2001 03:13:51 -0500
From: "Mike Schmitt" <mds@wam.umd.edu>
Subject: Re: Binary issues..
Message-Id: <9t568u$cs0$1@hecate.umd.edu>

Martien Verbruggen wrote in message ...
>No need to do it byte by byte. The program I posted could do that, with
>a few little changes.

now all i have to do is figure out what exactly your algorithm does  :-P

>I thought you were only interested in the date
>segments, so that's all it deals with. The HTML segments are of course
>the exact inverse of the data segments, minus the tags themselves.

actually, it should be easier than this; the program i've already completed
deals with data and HTML plus formatting with its RE's (even when read in
from binary), so really all i need to do is figure out a scheme to read it
in chunks and check for the beginning of the next message segment (i.e. the
next "<hR>** ", which only appears in that capitalization at the beginning
of a message segment, i.e. any one chat session).

would it work if i read it in at, say, 1k at a time, checking each new
kilobyte (combined with the last one, perhaps) for the magic tag, and then
resetting the seek if it's found?
if so, could you explain a bit more clearly the use of determining the
position of a substring within a string? (i saw you use this, but don't
exactly understand its syntax.)  then i suppose all i'd have to do is apply
a (seek to -(position of tag in substring)) or something.  or is this too
inefficient?
(i'm not trying to subvert your way of doing it, just trying to build up my
understanding of what we're doing here)
thanks.
~Mike




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

Date: Sat, 17 Nov 2001 17:04:00 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Binary issues..
Message-Id: <4MwJ7.30396$RI2.14177761@news2>

[Posted and mailed]

In article <Pine.LNX.4.30.0111170138370.14258-100000@lxplus023.cern.ch>,
	"Alan J. Flavell" <flavell@mail.cern.ch> writes:
> On Nov 17, Clinton A. Pierce inscribed on the eternal scroll:
> 
>> Perl has no problems with binary data.  Since you mention AIM, is this Win32?
>> If so, remember to binmode() filehandles that might be involved in reading/
>> writing binary data.  That's Windows' fault, not Perl's.
> 
> The distinction between binary and text files is _not_ exclusive to
> OSes from the Great Monopolist; indeed the insistence by unixoid
> systems that there be no difference between different kinds of files
> is rather the exception than the rule.

Never said there weren't other systems where the distinction isn't made.
I've used a few of them.  Although most of them are now harboring rodents 
in a scrap heap somewhere.
 
> Preserving the distinction between text-mode and binary-mode files
> does no harm to unix: for portability reasons I'd recommend falling
> into line with that, unless you aim to stamp yourself as a unix bigot
> who is committed to damaging the portability that perl has rightfully
> established for itself.

Lighten up, man.  Sure I'm a Unix bigot.  But the OP clearly said
he was using AIM.  I'm not aware of AIM running on a platform that 
distinguishes binary/text other than Windows (that's not running in
a compatability mode like OS/2).   Are you?

Give it a rest. 

-- 
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org                Perl Developer's Dictionary
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sat, 17 Nov 2001 19:00:52 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Binary issues..
Message-Id: <Pine.LNX.4.30.0111171855240.30306-100000@lxplus023.cern.ch>

On Nov 17, Clinton A. Pierce inscribed on the eternal scroll:

> >> Perl has no problems with binary data.  Since you mention AIM, is this Win32?
> >> If so, remember to binmode() filehandles that might be involved in reading/
> >> writing binary data.  That's Windows' fault, not Perl's.
[...]
> Never said there weren't other systems where the distinction isn't made.

That's true.  My apologies, I read something into your posting that
I now realise hadn't been intended.

> Give it a rest.

I'm mostly using unix myself, but I'd still like to support an
attitude of maintaining Perl's portability.

On this occasion, I accept that I responded over-sensitively.  Sorry.



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

Date: Sat, 17 Nov 2001 18:29:39 GMT
From: sysop <vze33mmh@verizon.net>
Subject: Re: Binary issues..
Message-Id: <pan.2001.11.17.13.42.03.769641.3513@verizon.net>

On Fri, 16 Nov 2001 22:25:32 -0500, Mike Schmitt wrote:

> open(IN, "log");
> open(OUT, ">log.out");
> 
> $/="</data>"; #record seperator
> while(<IN>){
> 
> The problem here is, reading in the file from standard input (or file
> input as it were) doesn't preserve the binary stuff for some reason. The
> solution I found is to use read() in binmode(), and I got it to work
> with my test file.

Hmm.  Just to be certain, you can't just binmode before <IN>?  My
understanding (not having a windows machine) was that if you didn't use
binmode on a binary file; "\cM\cJ" in-stream would be converted to "\n",
and any output of "\n" would be converted back, and likewise with "\cZ"
<-> EOF.  I didn't know <> would further corrupt the data.

>                     Now my problem is, my real file is ~108 megs, and
> though the program works perfectly with the 8 meg test file, it is
> utterly unproductive with the test file (if it doesn't run my system out
> of memory, it just seems to go dead).  I'd like to read the data in by
> chunks (using "offset" and "length to read" settings with read()), but I
> can think of no good way to read a chunk, process it, then read the next
> chunk, since there's no way of telling where the different pieces of the
> file are located..  if you know what i mean.

What's your code look like now?  If its just running too slow, and 
chewing up memory, and you are using regexp's it just might need some 
tweeking of the regexp.


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

Date: Sat, 17 Nov 2001 15:10:03 GMT
From: spam@freeuk.com (Stephen Patterson)
Subject: Re: Cancel button to exit confirmation page?
Message-Id: <slrn9vcvg5.h1.spam@localhost.localdomain>

On 16 Nov 2001 23:39:46 -0800, David Kenneally wrote:
> Hello-
> 
> First off, maybe I should be in an html group instead, but bare with
> me, I'm learning here...
> 
> I am using perl/CGI to generate a confirmation page. From a html page,
> users submit the name of a file then want to delete. I use a cgi
> script to echo that info back to them, as in:
> 
> Are you sure you want to delete $filename?
> 
> Submit  Cancel
> 
> 
> From here I can easily get submit to call a perl script to go delete
> the file. My problem is I can't seem to find a way to make the cancel
> button exit them out, or return them to the original page.

One way would be to use 2 named submit buttons, one for delete, the
other for cancel.

<button name='delete' value='Del' type='submit'>
<button name='cancel' value='Cancel' type='submit'>

Then it's just a matter of determining which button has been pressed.
$delete = param('delete');
$cancel = param('cancel');

if ($delete) {
   # del file
} else {
  # don't delete
}

-- 
Stephen Patterson http://home.freeuk.net/s.patterson/
s.patterson@SPAM.freeuk.com (remove spam to reply)
ICBM address 54-22-0N 0-28-0W


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

Date: 17 Nov 2001 09:29:57 -0800
From: dwk@auto-graphics.com (David Kenneally)
Subject: Re: Cancel button to exit confirmation page?
Message-Id: <57a902f4.0111170929.a4c7bde@posting.google.com>

dwk@auto-graphics.com (David Kenneally) wrote in message news:<57a902f4.0111162339.2199c59b@posting.google.com>...
> Hello-
> 
> First off, maybe I should be in an html group instead, but bare with
> me, I'm learning here...
> 
> I am using perl/CGI to generate a confirmation page. From a html page,
> users submit the name of a file then want to delete. I use a cgi
> script to echo that info back to them, as in:
> 
> Are you sure you want to delete $filename?
> 
> Submit  Cancel
> 
> 
> From here I can easily get submit to call a perl script to go delete
> the file. My problem is I can't seem to find a way to make the cancel
> button exit them out, or return them to the original page.
> 
> Any ideas would be welcome!
> 
> David

All-
After reading the faq (which I should have done first) I realize that
this should have been posted to the cgi group instead, which I have
done.

Thanks!

David


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

Date: Sat, 17 Nov 2001 08:57:19 -0500
From: christ0 <a@b.com>
Subject: Compile error
Message-Id: <3BF66CBF.BE2B94BE@b.com>

This code:
------------------------code----------------------
#! /bin/perl -w
use strict ;
use IO::Socket ;

$client = IO::Socket::INET->new( "www.oreilly.com:80") ;
------------------------code----------------------

Gives me this error:

> Global symbol "client" requires explicit package name at prog1.pl
line5.
> Execution of prog1.pl aborted due to compilation errors.

How do I resolve this symbol? Thanks.






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

Date: 17 Nov 2001 14:47:01 GMT
From: Piotr Maj <piotr.maj@gekon.pl>
Subject: Re: Compile error
Message-Id: <slrn9vcu47.g5e.piotr.maj@gekon.ae.wroc.pl>

In article <3BF66CBF.BE2B94BE@b.com>, christ0 wrote:
> This code:
> ------------------------code----------------------
> #! /bin/perl -w
> use strict ;
^^^^^^^^^^^^^^

> use IO::Socket ;
> 
> $client = IO::Socket::INET->new( "www.oreilly.com:80") ;


put "my" before $client.

-- 
pozdrawiam                              *Sygnaturka jest tendencyjna*
-> m@j <-                                 [http://silence.gekon.pl/]


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

Date: 17 Nov 2001 07:46:02 -0800
From: trac6637@hotmail.com (Sam)
Subject: Re: Exact match with the Regular expression
Message-Id: <820d061b.0111170746.5a3e830b@posting.google.com>

A geart thnx for all the guys here..

Regards
Sam

Michael Slass <mikesl@wrq.com> wrote in message news:<m3r8qytf33.fsf@thneed.na.wrq.com>...
> "Mina Naguib" <spam@thecouch.homeip.net> writes:
> 
> >"Michael Slass" <mikesl@wrq.com> wrote in message
> >news:m3668auu6o.fsf@thneed.na.wrq.com...
> >> trac6637@hotmail.com (Sam) writes:
> >>
> >>
> >> You want to match "c or b followed by one or more digits", which will
> >> necessarily exclude ca...
> >>
> >> [ab][0-9]+
> >
> >I think Mike meant [cb][0-9]+
> >just a brain fart I'm sure since he wrote it right in the sentence right
> >above.
> >
> >Also if your limitation is "1 character and numerals" as opposed to only c
> >or b, then you can use
> >/^[a-z][0-9]+$/i;
> >
> Oops - right you are.  Thanks for catching that, Mina.


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

Date: Sat, 17 Nov 2001 12:45:52 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Fast Portable Logical Shift Right in Perl ?
Message-Id: <slrn9vcn04.4je.garry@zfw.zvolve.net>

On Sat, 17 Nov 2001 04:35:59 GMT, David Sletten <slytobias@home.com> wrote:
> Mark Shelor wrote:
> 
> I'm curious what tests you conducted to conclude that Perl performs an 
> arithmetic right shift?

My version of perl (built with 32-bit ints) seems to do logical right
shifts: 

  $ perl -wle '$x=-1;print$x;$x=$x>>1;print$x;$x=$x>>1;print$x'   
  -1
  2147483647
  1073741823
  $ perl -v

  This is perl, v5.6.1 built for sun4-solaris

-- 
Garry Williams


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

Date: Sat, 17 Nov 2001 18:17:44 GMT
From: David Sletten <slytobias@home.com>
Subject: Re: Fast Portable Logical Shift Right in Perl ?
Message-Id: <3BF6AA0B.4030308@home.com>

Mark,

It appears I may have spoken too soon. I just noticed in the 3rd edition 
of the Camel book that entry for shift operators does not specifically 
address whether the right shift is 'arithmetic' or 'logical'. But it 
does contain the explicit warning: 'Results on large (or negative) 
numbers may vary depending on the number of bits your machine uses to 
represent integers.' This seems to suggest that the MSB cannot be relied on.

On the other hand, 'Advanced Perl Programming' (pg. 329) discusses 
Perl's datatypes and mentions '. . . two important typedefs, I32 and 
U32, which represent signed and unsigned integral quantities that are 
*at least* 32 bits wide and big enough to hold a pointer (it will be 64 
bits on a 64-bit machine).' I believe these types are used by Perl 
internally when converting to/from double floats.

The bottom line, however, is that my (clearly non-exhaustive) empirical 
evidence is unconvincing. You are right in using caution.

David Sletten

David Sletten wrote:

> It's not quite what you meant, but your code is entirely portable (at 
> least for the time being) since Perl converts numeric scalars from 
> double precision floats to unsigned 32-bit ints before applying 
> bit-shifting ops:
 ...
> Again, at least for the time being, you can probably count on any Perl 
> implementation behaving this way.
> 

> 
> David Sletten
> 
> Mark Shelor wrote:
> 
>> Crypto algorithms often require a "logical right shift" operation.  
>> Perl's
>> right shift operator (>>) appears to be arithmetic: i.e. the
>> most-significant bit (MSB) remains set after shifting to preserve 
>> sign.  In
>> contrast, a logical right shift operation would shift a zero bit into the
>> MSB.
>>
>> A function such as
>>
 ...
>>
>> isn't portable since it assumes a 32-bit integer.  Also, it doesn't seem
>> particularly efficient.  Of course, one could do this in C, but I'm 
>> looking
>> for a good implementation in straight Perl.
>>
>>
>>
> 



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

Date: Sat, 17 Nov 2001 21:45:17 +0400
From: "Parmeet" <parmeet@emirates.net.ae>
Subject: Re: how to create a file that doesn't exist?
Message-Id: <9t67ea$nm41@news.emirates.net.ae>

open(DATA2,">$db2file") or die "\"$db2file\" $!";
print DATA2 "whatever\n";
close(DATA2);

--
--------------------------------------------
Parmeet.S.Khurana
email::parmeet@emirates.net.ae
-http://www.cgi.sphosting.com
-http://cloud9.nethop.com
--------------------------------------------
-http://www.shekharrahate.com
-http://www.ultimate-fashions.com
"MAGiC MANiAC^mTo" <no_mto@hotmail.com> wrote in message
news:9t46d2$8bo$1@news.kabelfoon.nl...
> how can I create a file that doesn't exist before I read the data from the
> file...
>
> open(DATA2,$db2file) or die "\"$db2file\" $!";
>   ^^ overhere?... how?
>   @data2lines=<DATA2>;
> close(DATA2);
>
> can you help me?
>
>
>
>




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

Date: Sat, 17 Nov 2001 17:24:08 GMT
From: sceva_17@yahoo.com (B Smith)
Subject: if statements are not working! what am i missing?
Message-Id: <3bf69cb6.87164005@news.wcu.edu>

when comparing a character in a string to a single letter, say c, is
there anything special I have to do? i'm using an if statement to
compare and then act on the value of the character of the string. if i
use a number, then the if statement works perfectly. i change it to a
character, and it quits working

This works:
sub manufacturer00 {
	if ($charPos[0] == "") {
		print "<p></p>";
	} elsif ($charPos[0] == 1) {
		print "<p>Manufacturer: USA</p>";
	}
}


This does not work:
sub manufacturer00 {
if ($charPos[1] == "") {
		print "<p></p>";
	} elsif ($charPos[1] == c) {
		print "<p>Make: Ford</p>";
	}
}


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

Date: Sat, 17 Nov 2001 17:50:20 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: if statements are not working! what am i missing?
Message-Id: <3bf6a35c.4f0e$164@news.op.net>

In article <3bf69cb6.87164005@news.wcu.edu>,
B Smith <sceva_17@yahoo.com> wrote:
>when comparing a character in a string to a single letter, say c, is
>there anything special I have to do? 

You must use 'eq' instead of '=='.

'==' is only for comparing numbers.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;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.  

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


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