[10987] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4587 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 10:07:37 1999

Date: Fri, 8 Jan 99 07:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 8 Jan 1999     Volume: 8 Number: 4587

Today's topics:
    Re: Can I execute Perl Scipt from VB ? <ebohlman@netcom.com>
    Re: extract MULTIPLE form data <ebohlman@netcom.com>
    Re: is there a hex print of strings? <richardsonja@logica.com>
    Re: messageboard <vdweiden@casema.net>
        More efficient way to program this? Maybe Daemon? nkaiser@my-dejanews.com
        newbee sort question <lexing@ibm.net>
    Re: newbee sort question (Stephen Clouse)
    Re: Perl Criticism <tripp.lilley@perspex.com>
    Re: Perl Criticism <tripp.lilley@perspex.com>
    Re: Perl on Apache 1.3.3 running on Windows 95/NT dturley@pobox.com
        regexp and broken MY reference <marty@catnmoose.com>
        Uploading PC files works - but not Mac files <henrik@byggeinfo.dk>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 8 Jan 1999 14:06:15 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Can I execute Perl Scipt from VB ?
Message-Id: <ebohlmanF58v6F.4Fr@netcom.com>

Barry G. Sumpter <bsumpter@msn.com.au> wrote:
: This is a multi-part message in MIME format.

Please post single-part messages in text format.
: We would love to be able to execute Perl scripts using VB / VBScript / =
: VBA / C++.

: Does anyone know of an activex control either a .dll or .exe or .ocx =
: that would
: allow us to do this?

I think ActiveState's PerlScript is what you want: it provides an ActiveX 
scripting interface to perl.  It comes free with ActiveState's 
implementation of Perl.



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

Date: Fri, 8 Jan 1999 14:04:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: extract MULTIPLE form data
Message-Id: <ebohlmanF58v3K.4C5@netcom.com>

Michael Reutter <mw@workmail.com> wrote:
: I use this code to see what data my forms send to my cgi-script:

[snip typical cut-and-pasted parameter decoder]
: but what will I have to do if I want to see data sent by

: <select name="flavors" MULTIPLE>
: <option value="pistachio">Pistachio
: <option value="walnut">Walnut
: <option value="creme">Creme
: </select>

: I will always see the last selection (if selected walnut AND creme, I
: will only see creme 'cause creme overwrites walnut!)

Yes, that's a limitation of your typical cut-and-paste parameter 
decoder.  Fortunately, it's a limitation not shared by the parameter 
decoder in CGI.pm, so you've got a ready-made solution staring you in the 
face.  Read the docs for CGI.pm, and possibly buy Lincoln Stein's 
definitive guide to using it.



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

Date: Fri, 8 Jan 1999 14:01:47 -0000
From: "James Richardson" <richardsonja@logica.com>
Subject: Re: is there a hex print of strings?
Message-Id: <77536b$6ot@romeo.logica.co.uk>


Brian McCauley wrote in message ...
>stevenba@ccpl.carr.org (Steven Barbash) writes:
>
>> Is there a function or module or ... that inputs a string and outputs its
>> hex value?
>
>> source: "this is a test"
>> output: "7468697320697320612074657374"
>
>( unpack "H*", "this is a test" )[0]
>


Damn, i wanted to do this yesterday, and had a complete brain failure!

The answer I came up with was:


join('', map (sprintf("%.2x", ord($_)), split(//,$string)));

But there's always more than one way to do it!

James







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

Date: Fri, 8 Jan 1999 15:22:35 +0100
From: "robin" <vdweiden@casema.net>
Subject: Re: messageboard
Message-Id: <77549u$n0c$1@news.casema.net>


no it was not my idea to get the script here
especially with YOU hanging around here
is just wanted to know if i could do it





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

Date: Fri, 08 Jan 1999 14:00:45 GMT
From: nkaiser@my-dejanews.com
Subject: More efficient way to program this? Maybe Daemon?
Message-Id: <77532b$1q4$1@nnrp1.dejanews.com>

I have a program which needs to constantly be running. Basically, it looks
for files in a directory, and if it finds a file it will handle it.  It is
important that only 1 file is being handled at a time, since they access
shared information. Right now, it is something like this:

while (1) {
  &handleTypeA;
  &handleTypeB;
  .. etc
}

However, doing it this way really starts to consume the CPU of my server. Is
there a better way to do this?

Thanks,

Neal

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 08 Jan 1999 15:13:16 +0100
From: lexing <lexing@ibm.net>
Subject: newbee sort question
Message-Id: <3696127C.FFE7CB43@ibm.net>

i'm a newbee and have a small question about variables.

i have 5 variables like:

mike = 1
sandra = 3
john = 2
jasmin = 5
george = 4

(or a hash for it.)
and i have to sort the 5 variables to the assosciated numbers and give
those variable in the sorted order like this:

mike = 1
john = 2
sandra = 3
george = 4
jasmin = 5

i know that the solution must be very simple but i can't find how i can
do this.



and one more question: is the something like "is Not a Number" function
in perl?



thx,
alias lexing.


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

Date: Fri, 08 Jan 1999 14:33:31 GMT
From: see.sig@for.address (Stephen Clouse)
Subject: Re: newbee sort question
Message-Id: <369616d7.2678900@news.kc.net>

On Fri, 08 Jan 1999 15:13:16 +0100 in message <<3696127C.FFE7CB43@ibm.net>
comp.lang.perl.misc>, lexing <lexing@ibm.net> wrote:

>and i have to sort the 5 variables to the assosciated numbers and give
>those variable in the sorted order like this:

See the Hashes section of perlfaq4.

>and one more question: is the something like "is Not a Number" function
>in perl?

http://www.perl.com/CPAN-local/doc/FMTEYEWTK/is_numeric.html

-- 
Stephen Clouse -- steve at acme-labs dot com (Anti-Spam enabled)
Acme Labs -- Resident Megalomaniac (http://www.acme-labs.com)


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

Date: Fri, 08 Jan 1999 09:09:30 -0500
From: Tripp Lilley <tripp.lilley@perspex.com>
Subject: Re: Perl Criticism
Message-Id: <3696119A.69503AC8@perspex.com>

Bart Lateur wrote:

> You sound like a "Python" kind of person. Try it out. Most Perl people
> have done that at one time or another.

"Why don't you try W. H. Smith's?"

"Ah did, They sent me here."

"DID they."

http://www.intriguing.com/mp/scripts/bookshop.txt




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

Date: Fri, 08 Jan 1999 09:39:21 -0500
From: Tripp Lilley <tripp.lilley@perspex.com>
Subject: Re: Perl Criticism
Message-Id: <36961899.4AC48014@perspex.com>

topmind@technologist.com wrote:

> 1. Very tough to mix arrays and scalars unless you have only one array at the
> end of the list.

&foo $zero, $one, $two, [ @three ], $four, [ @five ], $six;

sub foo {
    my( $zero, $one, $two, $three, $four, $five, $six ) = @_;
    #...
}

or, if you prefer to not use refs

sub foo {
    my( $zero, $one, $two, $four, $six ) = @_[0, 1, 2, 4, 6];
    my @three = @{$_[3]};
    my @five = @{$_[5]}
    #...;
}



> 2. "Getting used to" means it is tougher to learn, with little benefits in
> return.

This is opinion. I found it tough to learn Perl. I found it the most god-awful,
ugly, inconsistent, not-like-anything-I-was-taught-a-good-language-should-be
language I had ever encountered. Then I spent a 48 or 72 hour stretch with it in
the midst of a very thorny problem that I /had/ to solve /then/, no exceptions. It
saved my butt. I decided to take a second look at why I loved it and why I hated
it.

I can't give you the specific point/counterpoint answers you want because that is
precisely /why/ I love Perl. It's /not/ mechanistic. It is a programming language
for intelligent, thoughtful, conscientious humans. Thus, like natural languages, it
can be approached rigorously or not, depending on your tastes. I could write to you
in a perfectly mechanistic, predictable prose that anyone would be able to
"maintain", and you would choke on reading it every time!

I'm reminded of those who gag on Shakespeare, Blake, Byron, because they don't
"just say what it is they're saying". What this perspective misses (and what defies
analysis) is that they /do/ say what they're saying, /and so much more/. Witness
the direct, clearly comprehensible, and utterly maintable phrase:

"Juliet, you're very beautiful..."

Now, an admittedly indirect, but /far/ more expressive statement of the same
fundamental concept:

        But, soft! what light through yonder window breaks?
    It is the east, and Juliet is the sun.
    Arise, fair sun, and kill the envious moon,
    Who is already sick and pale with grief,
    That thou her maid art far more fair than she:

Now, I can accept that you might not find this appealing. I'm not going to stop you
from being less powerful than I. As another has suggested, you might like Python,
or one of a number of other languages. And I'm not going to go point/counterpoint
with you, because Perl is not that for me. Perl fits me, it doesn't fit you. Leave
it. It won't miss you any more than music misses Salieri in the wake of Mozart.


> Optional = stupid programmers will overuse it and stick SOMEBODY ELSE with the
> mess! Hit and run programming.

You should be firing these stupid programmers and erasing signs of their existence.
This is not to be taken lightly. If you find gifted but inexperienced programmers,
you should keep them, and help them understand how to write elegant, flexible,
extensible, maintainable code. All are possible in Perl (as in any language) with a
good programmer.

Do not blame the language for the faults of the speaker.

"Successful software production is much more like producing a film than harvesting
a crop. It is a cooperative undertaking involving a number of highly specialized,
very talented people. It is the artistic quality of this kind of synergy that makes
a great film and it is the artistic quality of this kind of synergy that makes a
great piece of technology".

William Beckett, _Metamorphosis: A Programmer Looks at the Software Crisis_
 http://www.amazon.com/exec/obidos/ASIN/0966033396/perspeximagework/





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

Date: Fri, 08 Jan 1999 14:20:48 GMT
From: dturley@pobox.com
Subject: Re: Perl on Apache 1.3.3 running on Windows 95/NT
Message-Id: <77547t$2sd$1@nnrp1.dejanews.com>

In article <369583CA.7747A34B@nwcis.com>,
  Steve Shawl <admin@nwcis.com> wrote:
> Hey!
> How do I install Perl on Apache 1.3.3 running on Windows 95/NT?
> Where do I get the install file(s)?

Well, you don't really install Perl on Apache. You install both perl and
Apache on your computer.

get Perl from www.activestate.com
get apache from www.apache.org

both are self installing binaries. Look at
www.bianry.net/dturley/cgi_testing.html if you need help configuring apache.

Further posts should be directed to omp.infosystems.www.authoring.cgi which is
the proer newsgroup for web-related Perl questions
____________________________________
David Turley
dturley@pobox.com
http://www.binary.net/dturley/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 08 Jan 1999 09:34:26 -0500
From: Marty Landman <marty@catnmoose.com>
Subject: regexp and broken MY reference
Message-Id: <36961772.F81A633@catnmoose.com>

FOA thanks for previous replies pointing me to the Perl FAQ for symbolic
substitution in a regexp.  This has lead me to another misunderstanding
I'd appreciate clearing up.  Here's my  code:

 open (Signon,"$Signon") || die "cannot open  sign-on file $!\n";
 my $HTML;
 $HTML .= $_ while <Signon>;
 no strict;
 $HTML =~ s/\$(\w+)/${$1}/g;
 use strict;

--    I found that use strict gave compile errors so I turned it off for
the substitution.  Is this proper thinking?

The main reason I'm posting though is that originally I had the '$1'
vble declared as local, i.e. if I'm looking to substitute  the value of
$japh into the text where it says $japh, i'd coded

my $japh = 'just another perl hacker';

This didn't work, but you already knew that.  So I 'fixed' it if that's
the right word by adding $japh to my 'use vars' quoted word list instead
of having it as a 'my' vble declared in the subroutine.

What am I missing here?  How can I do this better, and not have a global
variable which could otherwise happily exist as local?

tia

--
 Marty Landman - web programming and graphics
 Cat 'n Moose dot com     http://www.catnmoose.com/




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

Date: Fri, 08 Jan 1999 15:08:12 +0100
From: Henrik Hansen <henrik@byggeinfo.dk>
Subject: Uploading PC files works - but not Mac files
Message-Id: <3696114C.1D1BB8F0@byggeinfo.dk>

Hi.
I'm working on a project were we uploads files using a browser.
I have made a perl program which receives the files from the html form.
All
this works perfect when dealing with PC files, but when uploading Mac
files
the Resource Fork part is missing (a Mac file consist of a Resource Fork
and a Data Fork).

I then tried using the uploader.exe which is included with the Website
Pro Web server but alas, same result!

My fear is that is the browser which dosn't send the Resource Fork part,
if so i'm F...
The strange thing is that MSI4 and NS4 on Mac seems to behave
differently when sending
files, It seems like that MSI4 tries to send the Resource Fork but fails
anyway (When recieving the same file the byte count differs between the
two browsers, MSI4 > NS4 ).

Is there anybody out there which have expirenced the same problems (and
might have a solution).


Kind regards
Henrik Schak Hansen
henrik@byggeinfo.dk



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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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