[9742] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3336 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 4 02:05:40 1998

Date: Mon, 3 Aug 98 23:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 3 Aug 1998     Volume: 8 Number: 3336

Today's topics:
    Re: <SELECT multiple...> only returns 1st value <ben@sofnet.com>
    Re: [Q] Namespace collisions (Andrew M. Langmead)
    Re: cannot alias $_ in perl 5.005 (Dan Sugalski)
    Re: ch <rootbeer@teleport.com>
    Re: Disrib. with other apps? (Andrew M. Langmead)
    Re: get path of working directory? <rootbeer@teleport.com>
    Re: gethostbyname (nobody)
    Re: hiding user input (Gary L. Burnore)
    Re: hiding user input (Chris Nandor)
    Re: hiding user input steve.cooke@wmc.com.au
    Re: hiding user input (nobody)
    Re: hiding user input tigger@io.nospaam.com
    Re: hiding user input (Scratchie)
    Re: hiding user input (Gary L. Burnore)
    Re: How to extrat characters from string <alf@orion.it>
    Re: Overriding print?? alexshah@my-dejanews.com
    Re: perl problem on dec machine (Dan Sugalski)
    Re: Perl recipes (brian moore)
    Re: Perl5.005: any good Thread::kill workaround ideas? (Dan Sugalski)
    Re: substr vs. pattern matching: which is faster? <uri@sysarch.com>
    Re: Synchronizing input to processes..... (Andrew M. Langmead)
    Re: Using PUSH <alf@orion.it>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 3 Aug 1998 23:58:09 -0500
From: Ben <ben@sofnet.com>
Subject: Re: <SELECT multiple...> only returns 1st value
Message-Id: <35C64EBD.22E65278@sofnet.com>

Mr. Beta,

99% chance that the reason that it isn't working is due to your parser. You
are probably using what I loving refer to a 'hash' parser. That means that
your hash is only going to hold one item -- and one item only.

My suggestion -- use CGI.pm. It is a module that is included with Perl -- with
good reason. :) Use it, you'll love it.

BenJamin Prater
http://www.jipes.com


bigbeta69@my-dejanews.com wrote:

> Every time i try to use the <SELECT multiple...> statement in my HTML, perl
> only returns the 1st value of what i selected.  I initially thought my
> mistake was I set $topic=$form_data{'topic'}, but i've played with changing
> the $ to @'s and other stuff but nothing is working..  I've checked other
> postings but apparantly some people have gotten the <SELECT multiple...> to
> work.  Any help is appreciated..
>
> code snippets:
>
> $topic = "$form_data{'topic'}";
>
> then later...
>
>         <SELECT multiple name="topic" size=5">!;
>         if ($type_of_form eq "modify")
>          {
>          print "<OPTION SELECTED VALUE = \"0\">Don't Change\n";
>          }
>     foreach $topic_value (@topic_values)
>       {
>          print "<OPTION VALUE = \"$topic_value\">$topic_value\n";
>       }
>     print "</SELECT>";
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum





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

Date: Tue, 4 Aug 1998 05:10:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: [Q] Namespace collisions
Message-Id: <Ex5Fpz.8yr@world.std.com>
Keywords: objects, scope

k y n n <kj0@mailcity.com> writes:

>The name 'quux' in the call $frob->quux is taken to refer to the
>subroutine foo::quux.  I'm surprised that this is the quux that I'm
>seeing, and not the other, given that the use of the package foo is
>circumscribed to the method nother_method in frobozz.pm.  Clearly, I
>haven't yet fully grasped perl scopage.

I can think of a couple of points that might be of interest to you.

Imports works on packages, and so they are not lexically
scoped. Putting a "use" inside a subroutine do not limit its effects
to that subroutine.

To a great extent, importing is just a convenience. As implemented by
Exporter.pm, it creates an alias in the current packages symbol table
for data that exists elsewhere. (In reality the "import" method of a
package could do just about anything, but in general, one would assume
that it would import stuff into the current package) But since there
is only one symbol table for a package, you can get name collisions
like you see. You create a subroutine "quux", and then overwrite the
"quux" subroutine entry by the foo->import;

When the import function of a package is implemented by the Exporter
module, it gives you great flexibility in what gets imported. If you
say "use foo '!quux'", it imports everything in the @EXPORT list but
items named "quux". You can still refer to this subroutine by giving
it an explicit package name "foo::quux()" (But if you do import it,
there is no way to retrieve the old frobozz::quux) You can also tell
Exporter.pm not to import anything by giving it an empty import list
("use foo ();")

If you run perl with the "-w" switch, it warns you if a redefine a
subroutine. Including if you both create and subroutine in a package
and import a subroutine with the same name into that package.

-- 
Andrew Langmead


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

Date: 4 Aug 1998 04:52:00 GMT
From: sugalsd@peak.org (Dan Sugalski)
Subject: Re: cannot alias $_ in perl 5.005
Message-Id: <6q641g$g73$3@bashir.peak.org>

Ilya Zakharevich (ilya@math.ohio-state.edu) wrote:
: [A complimentary Cc of this posting was sent to Matthew White 
: <mwhite@csu.edu.au>],
: who wrote in article <35C5561B.9D387B91@csu.edu.au>:
: > Hi
: > 	Since moving to perl 5.005 from 5.004 I cannot do aliasing
: > on $_. I have used this "feature" in a rather confusticated piece of
: > code which is now broken.
: > 
: > for instance, on 5.004 this worked as (*I*) expected:
: > 
: > perl -e '$b = "z\n"; *_ = \$b; print;'
: > 
: > ie, it printed "\z".
: > 
: > but on perl 5.005 it prints nothing. What is going on here?
: 
: Same behaviour on 5.005.  
: 
: If you mean 5.005-threaded, then it is an absolutely different beast.
: All the special variables are "lexical" (or something close to
: lexical, do not remember details).

Lexical's right. If threaded perl had $_ as a package varible (as it is in
the non-threaded perl), it'd be shared amongst all running threads. Since
half of the functions in perl mess with $_ in one way or another, that's
just begging for disaster. Perl would be essentially non-functional.

Making it lexical's a little bit of a pain, but not that much. (There
isn't that much code out there that messes with $_ and friends out there,
is there?)

FWIW, this is documented in perldelta.pod.

					Dan


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

Date: Tue, 04 Aug 1998 05:03:27 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: ch
Message-Id: <Pine.GSO.4.02.9808032201560.14147-100000@user2.teleport.com>

On 3 Aug 1998, Fernando Miramontes wrote:

> Subject: ch

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> Problem: When I do the tar -xvzf....... it says "illegal option --z"; 

Sounds as if you don't have a tar program which understands the z option.
If this were a newsgroup (or manpage) about the tar program and the z
option, I'd tell you to use the gunzip program on your file, but I won't
since this is a Perl newsgroup. :-)  Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 4 Aug 1998 04:07:34 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Disrib. with other apps?
Message-Id: <Ex5CsM.qF@world.std.com>

"Steve Serrell" <foursuns@inetport.com> writes:

>What would be the legal issues of distributing perl 5.0 with an application
>written in C++, This application would cost money, and among other things,
>offers the user the ability to run PERL scripts.

If I were you, I'd start with the file named "Artistic" in the perl
distibution and read it. Then, if there are any issues that you want
clarified, consult a legal professional.

Do you think it is really a bright idea to trust your business to what
people on Usenet tell you?

It seems to me that the requirements of the license will affect you
differntly depending on whether you are just including an unmodified
copy of the standard perl package with your software (aggregation), or
producing a modifed version of perl.

When heading out to see your lawyer, don't worry too much. I've always
had the feeling that Perl's Artistic license is more concerned about
the copyright holder retaining control over what is called "Perl", and
preventing confusion by anyone receiving something that is supposed to
be "Perl", over any worry about whether you will or won't make a
zillion dollars from it.
-- 
Andrew Langmead


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

Date: Tue, 04 Aug 1998 05:09:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: get path of working directory?
Message-Id: <Pine.GSO.4.02.9808032206130.14147-100000@user2.teleport.com>

On Mon, 3 Aug 1998, Dan Baker wrote:

> I might just be missing the obvious, but what is the best way to get
> the full path of the current working directory?

There's no way to be sure of recovering it at all - it may not even have a
name! 

But maybe you want the Cwd module. Hope this helps!

> # If you would like to reply-to directly, remove the _ from my username

# If you would like to get direct replies, remove the _ from your username

:-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 4 Aug 1998 04:01:28 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: gethostbyname
Message-Id: <6q612o$2dg@newsserver.trl.OZ.AU>

Try
  chop($localHost = `hostname`);
instead of
  $localHost = `hostname` ;
to get rid of the extraneous(sp?) line feed.

AC.

Arvind K. Karandikar (akarandi@pcocd2.intel.com) wrote:
: Hi,

: i'm trying to obtain the full name of the machine that i'm running on. 
: 'hostname' and hostname() only return the name - eg what i'd like 
: to have is "craft.camp.clarkson.edu", but what i get is simply "craft"
: (i'm trying to connect to this machine via a socket). i've tried using
: gethostbyname, but get all undef values:

: >>code snippet
: $localHost = `hostname` ;

: print "current host is $localHost\n" ;

: ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname $localHost
: ;
: print "name is $name\n" ;
: print "aliases are $aliases\n" ;
: print "addrtype is $addrtype\n" ;
: print "length is $length\n" ;
: print "addrs are @addrs\n" ;


: $name = gethostbyname $localHost ;

: print "in scaler context, name is $name\n" ;
: >> end code

: >>output is 
: %getName.pl 

: current host is craft

: Use of uninitialized value at getName.pl line 8.
: name is 
: Use of uninitialized value at getName.pl line 9.
: aliases are 
: Use of uninitialized value at getName.pl line 10.
: addrtype is 
: Use of uninitialized value at getName.pl line 11.
: length is 
: addrs are 
: Use of uninitialized value at getName.pl line 17.
: in scaler context, name is 

: >> end output
: the camel book and perldoc don't give any more info. any suggestion?

: thanks,
: Arvind

: akarandi@pcocd2.intel.com.nospam

: my opinions. mine! mine!! mine!!


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

Date: Tue, 04 Aug 1998 03:02:28 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: hiding user input
Message-Id: <35d27979.123550003@nntpd.databasix.com>

On 03 Aug 1998 20:59:36 -0700, in article <kgciuk9wg5z.fsf@dervish.cray.com>,
justinb@ignored.cray.com wrote:

>
>gburnore@databasix.com (Gary L. Burnore) writes:
>
>> It's clear that both of you have NO clue what the difference is between email
>> and USENet.  While you're all so happy to see abigail abuse new users and
>> complaining that I say something about it you're being hypocrites by posting
>> sending private email and then posting the reply to USENet.   
>> 
>> I'll be sure to Call both Stanford and Dartmouth on Monday and let the admins
>> there know exactly what I think of your actions.  
>
>Good shit! You're really the draconian fascist I always imagined you
>to be!

Gee, thanks!  

> I wondered, and didn't really know (through the databasix crypto days)
>but you leave little to the imagination. Don't bother calling [sgi|cray],

Why would I? You didn't send me email let alone send any after I asked you to
stop as they have.

>as they're unlikely to be sympathetic.

Well, cgi maybe. But cray? :)

-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: Mon, 03 Aug 1998 23:13:30 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: hiding user input
Message-Id: <pudge-0308982313300001@192.168.0.3>

In article <35c86e27.120651216@nntpd.databasix.com>,
whatpartofdontemailme@dontyouunderstand wrote:

# I apologize. I consistently confuse you and a couple of other posters in this
# group. Not hard to do since you each do the same things over and over.  You
# didn't outright lie but omitting part of the follow up while ensuring the
# remainder makes it to dejanews is still being a bit dishonest.

It was not at all dishonest.  I simply don't want to have the majority of
my post be quoted material; this is ALSO against the netiquette you claim
to uphold.  I assume people have read previous posts, and if they have
not, that they can use the References header to go back and find it all
out.  That is how it is supposed to work, and it is bizarre to me to think
of this as dishonesty.


# >Seriously, you need professional help. 
# 
# So you don't agree with the way that I post and determine from that, that I
# need professional help?

It is from what you say in your posts, yes.  I have determined that I
believe you need professional help.  I also believe I could be wrong in
this assesment.  The best example of this is that in the SAME POSTS as you
are venomously attacking people, calling them bitch and asshole and
jerkoff, you are also stating the need for civility in answering posts and
decrying the lack of proper netiquette.  That to me shows some serious
emotional or mental problems that are best diagnosed and treated by a
professional.


# What about emailing someone when they ask you not to.

I do it just to piss you off.  Maybe that is not very nice of me; kinda
like kicking the crippled kid's crutches out from under him.  But we are
all flawed.


# What about continuing after being told to stop?

Well, I do it first to piss you off, and second because you continue to
attack people after begin asked not to, so I do things you ask me not to
do.  More of this sickly hypocritical behavior.


# I, like others, munged my Reply-to address and you emailed
# anyway. Just as you did during the RFD for .moderated.  Perhaps it's YOU that
# needs mental help?  Perhaps it's YOU that has a warped sense of reality.

No, just a slightly deviant sense of humor.  I think I pretty well
understand the reality of what is going on.  I also have this desire to
break things that are broken, so that people fix them.  I regularly cc:
Stanley, but it gets bounced before it gets to him, so he probably neither
cares nor even notices it.  Good for him; that is what he should do.  I
have no right to his mailbox, but I have a right to send the message.  If
he does not want me to get in with my Usenet replies, he should find a way
to keep me out.  And he does.  You should look into the same thing.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Tue, 04 Aug 1998 03:51:06 GMT
From: steve.cooke@wmc.com.au
Subject: Re: hiding user input
Message-Id: <6q60fb$edl$1@nnrp1.dejanews.com>

In article <gb-0108982036300001@jill.westfalen.de>,
  gb@hugo.westfalen.de (Georg Bauer) wrote:
> In article <lt1zr14kcp.fsf@asfast.com>, Lloyd Zusman <ljz@asfast.com> wrote:
>
> >But how do most "newbies" know that so many people have invested so
> >much time?  Being "newbies" means that they are unfamiliar with the
> >fact that this has occurred until *after* someone points it out
> >to them.  Should this pointing out be done rudely or politely?
>
> Huh? Almost _every_ newsgroup has a FAQ nowadays.
[snip]
> No, I have no mercy for those "newbies" that refuse to use their brain.
> Only difference between me and Abigail: I don't think those "newbies" are
> not worth the effort and I usually plonk them or just even don't do that.
> I don't flame them, because I think they are not worth it and in any case
> won't have enough brain to understand.

Calling all adults. . .all I can find in this newsgroup are childish
tit-for-tat's. Maybe the newsgroup name should be changed to reflect the
content. Maybe comp.lang.playpen or comp.lang.stupid.wankers. . .How about
getting a life. I'm trying to determine the heads from the tails in Perl and
all I see is crud.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 4 Aug 1998 04:08:19 GMT
From: ac1@fspc.netsys.itg.telecom.com.au (nobody)
Subject: Re: hiding user input
Message-Id: <6q61fj$2dg@newsserver.trl.OZ.AU>

C'mon people, surely we can hold a discussion without reverting
to name-calling.  It's only detracting from what I monitor (and
occasionally post to) this group for (ie. information transfer,
which may not necessarily be why other people use it, of course).

AC.

Gary L. Burnore (gburnore@databasix.com) wrote:
: On 31 Jul 1998 02:56:50 GMT, in article <6prbpi$493$1@client3.news.psi.net>,
: abigail@fnx.com (Abigail) wrote:

: >Scott Stark (sstark@informix.com) wrote on MDCCXCIV September MCMXCIII in
: ><URL: news:6pqtda$aql1@webint.na.informix.com>:
: >++ 
: >++ As a matter of fact I did check the faq and didn't find any such animal, exce
: >++ "Is there a way to hide perl's command line from programs such as "ps"?". Tha
: >++ one didn't make sense to me. So either there's something wrong with my eyes o
: >++ I'm too stupid to figure out the FAQ.
: >
: >
: >Must be the latter. Which doesn't surprise as you're too stupid to 
: >indicate on your email that you posted a copy as well.

: Doesn't surprise me that you're still acting like a bitch.  
: -- 
:         for i in databasix primenet ; do ; gburnore@$i ; done
: ---------------------------------------------------------------------------
:                   How you look depends on where you go.
: ---------------------------------------------------------------------------
: Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
:                                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
: DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
:                                       |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
: spamgard(tm):  zamboni                |     Official Proof of Purchase
: ===========================================================================


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

Date: 4 Aug 1998 04:38:50 GMT
From: tigger@io.nospaam.com
Subject: Re: hiding user input
Message-Id: <6q638q$esj$1@hiram.io.com>

x.com> <6q5hu8$9vh$2@nswpull.telstra.net>
Organization: 
Reply-To: tigger@io.nospaam.com


Well, as one of the newest newbies (new, but *not* clueless) on this
newsgroup, I'm going to put in my $.02 in here. I've been following this
thread, and outside of one or two voices of reason that got drowned out
early on, this is the most virulent, hateful, bandwidth-wasting bunch of
postings I've ever seen! I've never seen such a car-crash
(car-crash=something too awful to stop watching--sort of like Jerry
Springer) in my life.  The one and only saving grace of this thread is
that it is only *one* thread, and as such is easy to skip over.

Paul

PS. Over 185 postings in one thread--wow!



Martien Verbruggen <mgjv@comdyn.com.au> spewed forth with:
> In article <35cdacde.163142343@nntpd.databasix.com>,
> 	gburnore@databasix.com (Gary L. Burnore) writes:

>> So if you're tired of answering over and over ..., shut the fuck up and go
>> away.

> Why don't you follow your own advice, and stay away? It seems pretty
> clear that no one here really needs a troll like you to foul the
> atmosphere even more than it is already. If you can't deal with a
> little heat, then you should stay away from the fire.
> -- 
> Martien Verbruggen                      |
> Webmaster www.tradingpost.com.au        | "In a world without fences,
> Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
> NSW, Australia                          |

-- 
     _________________________________________________________________
     * Tech Support: "I need you to boot the computer."
     * Customer: (THUMP! Pause.) "No, that didn't help."
     ________________________________________________________________


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

Date: Tue, 04 Aug 1998 00:59:45 -0400
From: upsetter@ziplink.net (Scratchie)
Subject: Re: hiding user input
Message-Id: <upsetter-0408980059450001@mfs-01-46.port.shore.net>

In article <35df4cb9.112091956@nntpd.databasix.com>,
whatpartofdontemailme@dontyouunderstand wrote:

: On 3 Aug 1998 23:39:59 GMT, in article <6q5hof$9vh$1@nswpull.telstra.net>,
: mgjv@comdyn.com.au (Martien Verbruggen) wrote:
: 
: >In article <35c6f0e6.49468449@nntpd.databasix.com>,
: >       gburnore@databasix.com (Gary L. Burnore) writes:
: >
: >> Please, if all PERL EXPERTS are this rude, then I'm taking perl out of my
: >> resume.
: >
: >Please do.
: 
: Make me.

Thanks for taking this discussion to levels I never would have imagined
possible. And to think, I was actually on your side at the beginning.

--Art

---------------------------------------------------------------------
                     National Ska & Reggae Calendar
            http://www.ziplink.net/~upsetter/ska/calendar.html
---------------------------------------------------------------------


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

Date: Tue, 04 Aug 1998 05:16:09 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: hiding user input
Message-Id: <35c69868.255863745@nntpd.databasix.com>

On Tue, 04 Aug 1998 00:59:45 -0400, in article
<upsetter-0408980059450001@mfs-01-46.port.shore.net>, upsetter@ziplink.net
(Scratchie) wrote:

>In article <35df4cb9.112091956@nntpd.databasix.com>,
>whatpartofdontemailme@dontyouunderstand wrote:
>
>: On 3 Aug 1998 23:39:59 GMT, in article <6q5hof$9vh$1@nswpull.telstra.net>,
>: mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>: 
>: >In article <35c6f0e6.49468449@nntpd.databasix.com>,
>: >       gburnore@databasix.com (Gary L. Burnore) writes:
>: >
>: >> Please, if all PERL EXPERTS are this rude, then I'm taking perl out of my
>: >> resume.
>: >
>: >Please do.
>: 
>: Make me.
>
>Thanks for taking this discussion to levels I never would have imagined
>possible. And to think, I was actually on your side at the beginning.
>

My side? Surely you mean the side against abusing new posters? Do you mean
that since you disagree with what I've posted recently you've changed your
mind about the subject?  Funny, I never though of your posts as defending me.
I though you were giving your opinion on an issue.  My mistake.
  
-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: 02 Aug 1998 19:02:37 +0200
From: Alessandro Forghieri <alf@orion.it>
Subject: Re: How to extrat characters from string
Message-Id: <m34svvtiz6.fsf@aldebaran.orion.it>


Greetings.

ijg@csc.liv.ac.uk (I.J. Garlick) writes:
[...]
> This is probably not the most efficient way but surely substr like this
> will work
> 
> 	my $sub = substr($string, $index, 1);
[...]

I was wondering whether this would be more efficient:

my $sub=chr(vec($string,$index,8));

Probably not?

Cheers,
	Alessandro

-- 
One standard to rule them all, one standard to find them,
One standard to bring them all, and in darkness bind them.
In the land of Microsoft, where the Shadow lie.

Alessandro Forghieri              http://www.orion.it/~alf


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

Date: Tue, 04 Aug 1998 04:17:33 GMT
From: alexshah@my-dejanews.com
Subject: Re: Overriding print??
Message-Id: <6q620t$ht2$1@nnrp1.dejanews.com>

Try VelociGen, it uses the Perl 5.004_04 for Windows NT.
http://www.binevolve.com

>
> I'm basically trying to redirect perl's print through ISAPI's
> WriteClient call.  No, I don't want to use PerlIS from ActiveState.  Any
> other ideas?
>
> Thanks for your help.
> Kevin
>
>

Alex

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 4 Aug 1998 04:43:06 GMT
From: sugalsd@peak.org (Dan Sugalski)
Subject: Re: perl problem on dec machine
Message-Id: <6q63gq$g73$2@bashir.peak.org>

Henryrb (henryrb@aol.com) wrote:
: Hi, we have a dec machine at our company that has trouble with dbaccess()
: commands in the perl scripts.  The scripts run fine on machines of other
: architectures.  The perl representative here doesn't know how to help up
: because it's unsupported public-domain software.  Does anyone know of a perl
: expert who can help us with this problem?  We tried running both 5.4.1 and
: 5.4.4, and get the same memory faults or null values when trying to do
: dbaccess().

Dec machine's kinda vague. What OS is it running? Unix? VMS? RSTS/E? (and
I wanna know who did the perl port if it is) RSX? TOPS?

The answer depends quite heavily on that one thing.

					Dan


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

Date: 4 Aug 1998 04:40:26 GMT
From: bem@news.cmc.net (brian moore)
Subject: Re: Perl recipes
Message-Id: <slrn6sd45s.ch6.bem@thorin.cmc.net>

On Mon, 03 Aug 1998 22:51:38 -0400, 
 Steve Linberg <linberg@literacy.upenn.edu> wrote:
> In article <35C6444E.4DC5@oreilly.com>, lisam@oreilly.com wrote:
> 
> > The Perl Cookbook, by Tom Christiansen & Nathan
> > Torkington, is a collection of problems, solutions,
> > and examples for anyone programming in Perl. It contains
> > hundreds of Perl "recipes," including recipes for parsing 
> > strings, doing matrix multiplication, working witharrays 
> > and hashes, and performing complex regular expressions. 
> > Over the next three weeks, O'Reilly will provide two new 
> > recipes a day free on the web site:
> > http://perl.oreilly.com/cookbook/
> 
> This is very nice!  Is the book out yet?

And what's on the cover?  Grumble.... time to fire up Lynx and
see which animal to ask for.

-- 
Brian Moore                             Kill A Spammer For Jesus
Sysadmin, C/Perl Hacker, Usenet Vandal 


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

Date: 4 Aug 1998 04:34:19 GMT
From: sugalsd@peak.org (Dan Sugalski)
Subject: Re: Perl5.005: any good Thread::kill workaround ideas?
Message-Id: <6q630b$g73$1@bashir.peak.org>

Jozsef Hollosi (hollosi@sbcm.com) wrote:
: I just built the new Perl5.005 on Digital Unix and I am trying out the
: cool threads.
: 
: My first test is a simple network server that starts two threads (reader
: and writer) for
: each accepted connection. The problem is, that when the writer decides
: it is time to
: finish, there is no trivial way to tell the reader to also finish,
: because that is waiting
: on a file descriptor (until there is some activity on that file
: descriptor).
: 
: It would be nice to have something like Thread:kill, but there is none.

While on the surface what you're asking for doesn't seem all that
difficult, it's actually quite a challenge to do. Some of the issues are:

1) Perl threads are mapped on top of your OS' thread libraries. Most OSes
use POSIX threads, and there's no way to kill off an individual POSIX
thread. Besides, killing a thread has a number of non-trivial problems, as
a thread might be waiting on a mutex, or have aquired one, or have
incremented/decremented a semaphore or something like that. Exiting an OS
thread with no cleanup would leave you in an inconsistent state.

2) Even if there *were* a way to nuke a thread with the OS' threading
libraries, It Would Be Bad. When a thread exits, it also leaves at least
one block, with all the cleanup that entails. (Refcounts decremented on
any variables that go out of scope, objects destroyed because they go out
of scope, etc). Just up and kill a thread and that wouldn't happen, and
you'd leak memory. 

It's certainly possible for Perl to provide a way to stop a thread
executing perl code. It'd involve some extra overhead, and the changes to
the guts likely wouldn't be all that pretty. (though I expect a patch to
runops() might handle it if you don't mind exit checks at the op level, or
something like that)

This wouldn't do you much good, though, since you were blocking on an OS
call, and that requires OS assistance.

What's really needed is support for killing a thread in the threading
libraries in conjunction with perl's support. Since most OSes *don't*
provide that support, we're all kinda out of luck.

				Dan


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

Date: 04 Aug 1998 00:30:16 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: substr vs. pattern matching: which is faster?
Message-Id: <x7sojd5pyf.fsf@sysarch.com>

>>>>> "RD" == Rick Delaney <rick.delaney@shaw.wave.ca> writes:

  RD> Robert Watkins wrote:
  RD> [snipped--subject says it all]

  RD> You can use the Benchmark module to compare the speed of different code
  RD> segments.  Try it.  

  RD> However, a quick search of dejanews would show you that substr is always
  RD> faster than pattern matching.

and unpack may be faster than substr since there are 2 fixed fields
here. it's 1 call vs. 2.

again benchmark is the way to test it out.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Tue, 4 Aug 1998 04:35:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Synchronizing input to processes.....
Message-Id: <Ex5E2E.Dx0@world.std.com>

"R. Player" <player@avoidspam.com> writes:

> A simple example of what I am doing is
>shown below. What I get is that the 
>"Print P1 <file1>;" all execute first and then "Print P2 <file2>" get
>executed instead of getting executed in the 
>same sequence as speciifed in the script file.

The readline operator "<FILEHANDLE>", like many of perl's operators,
behaves differently depending on whether it is called in a list or a
scalar context. In a scalar context, it returns a single line, in a
list context, it returns all remaining lines. The "print" function
provides a list context to its arguments. Maybe you want:

    print P1 scalar <file1>;

But even when you do that, I'm not sure you will get the
syncronization that you want. The first problem is the buffering
issue, but that can be solved with the $| variable. The second problem
is that the kernel's scheduling of processes is outside of your
control. Your program might get through three output calls before the
system decides to suspend you. The program that got the two lines
might be scheduled next, and have enough time to read both of them in
its timeslice.

Thats going to be a bigger problem, although you might get lucky and
it will seem to work for a while.

-- 
Andrew Langmead


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

Date: 02 Aug 1998 18:49:19 +0200
From: Alessandro Forghieri <alf@orion.it>
Subject: Re: Using PUSH
Message-Id: <m367gbtjlc.fsf@aldebaran.orion.it>


Greetings.

Mark Simonetti <se96ms@english.iielr.dmu.ac.uk> writes:

[...]
> #START
> 
> $$hash{'thingy'} = [];
> push($$hash{'thingy'}, 'hmm');
> 
> #END
> 
> $$hash{'thingy'} evaluates to an array ?  
[...]

You're taking a ref. to an arry and trying to deref it to obtain a scalar.
That's unkosher.

This appears to work as intended:

$h{a}=[];
push(@{$h{a}}, 'pippo');
print(@{$h{a}}),"\n";

It prints:

pippo

(I am a little surprised myself...)

Cheers,
	Alessandro


-- 
One standard to rule them all, one standard to find them,
One standard to bring them all, and in darkness bind them.
In the land of Microsoft, where the Shadow lie.

Alessandro Forghieri              http://www.orion.it/~alf


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3336
**************************************

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