[15502] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2912 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 1 00:10:29 2000

Date: Sun, 30 Apr 2000 21:10:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957154214-v9-i2912@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 30 Apr 2000     Volume: 9 Number: 2912

Today's topics:
        Need info on perl modules <jb@grolly.com>
    Re: Need info on perl modules (Michael P. Soulier)
    Re: Need info on perl modules (Tad McClellan)
    Re: Need info on perl modules (Tad McClellan)
        Newbie Help! YAWN@YAWN.COM
    Re: Newbie Help! <tony_curtis32@yahoo.com>
    Re: Order of evaluation (Was: Re: regex) (Peter Scott)
    Re: Perl database Access <gellyfish@gellyfish.com>
        Perl msql prob.... <matts@nortelnetworks.com>
    Re: Perl/Oracle-SLQ*Loader error <rereidy@indra.com>
    Re: php, embPerl, mod_perl, help. (Neil Kandalgaonkar)
    Re: Please Explain ... print "Location: http:etc."; <makarand_kulkarni@My-Deja.com>
    Re: Please Explain ... print "Location: http:etc."; <flavell@mail.cern.ch>
    Re: Please Explain ... print "Location: http:etc."; <care227@attglobal.net>
    Re: program that prints itself <johnlin@chttl.com.tw>
    Re: program that prints itself <johnlin@chttl.com.tw>
    Re: program that prints itself (Sam Holden)
    Re: Retrieving the name of a variable <makau@multimania.com>
    Re: Retrieving the name of a variable <tony_curtis32@yahoo.com>
    Re: Retrieving the name of a variable (Tad McClellan)
    Re: Retrieving the name of a variable <makau@multimania.com>
        Telnetting <kamri@nortelnetworks.com>
    Re: Telnetting <care227@attglobal.net>
    Re: Unicode in Perl 5.6 - broken? (Ilya Zakharevich)
    Re: Unicode in Perl 5.6 - broken? <bertilow@hem.passagen.se>
    Re: uploading files with cgi-lib.pl <gellyfish@gellyfish.com>
    Re: Where is it found? (Neil Kandalgaonkar)
    Re: Windows Script Component using PerlScript <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Apr 2000 21:13:55 +0100
From: "JB" <jb@grolly.com>
Subject: Need info on perl modules
Message-Id: <8e7iiq$lr5$1@neptunium.btinternet.com>

I need to know what's involved in installing modules such as a date command
and qmail on a virtual server. The webspace (funmark) was advertised as
'full cgi-bin' but compared to my other host, Hypermart it's not user
friendly.

Am I being naive in thinking it's just a case of uploading the correct
modules?

I'm not an expert in Perl/cgi but have written several scripts of my own but
am at a loss when it comes to server configuration. I have Activeperl and
Apache installed locally.

Thanks to anyone who can offer advice.

--
JB.




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

Date: 1 May 2000 03:34:33 GMT
From: msoulier@storm.ca (Michael P. Soulier)
Subject: Re: Need info on perl modules
Message-Id: <slrn8gpv4n.bco.msoulier@localhost.localdomain>

On Wed, 26 Apr 2000 21:13:55 +0100, JB <jb@grolly.com> wrote:
>I need to know what's involved in installing modules such as a date command
>and qmail on a virtual server. The webspace (funmark) was advertised as
>'full cgi-bin' but compared to my other host, Hypermart it's not user
>friendly.

    Is this a server that you have full access to? It doesn't sound like
you're the sysadmin. There are ways around that, but the proper way would be
to ask whomever is administering the site to install the modules for you.

    Mike

-- 
Michael P. Soulier <msoulier@storm.ca>
--------------------------------------
"To listen to the words of the learned, and to instill into others the
lessons of science, is better than religious exercises."
                -- Prophet Muhammad (pbuh)


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

Date: Sun, 30 Apr 2000 22:41:14 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need info on perl modules
Message-Id: <slrn8gprma.85n.tadmc@magna.metronet.com>

On Wed, 26 Apr 2000 21:13:55 +0100, JB <jb@grolly.com> wrote:

>I'm not an expert in Perl/cgi but have written several scripts of my own but
>am at a loss when it comes to server configuration.

>Thanks to anyone who can offer advice.


I advise asking server questions in a newsgroup devoted
to discussing servers.

      comp.infosystems.www.servers.ms-windows


This here newsgroup is for discussing Perl. 

Perl does not _have_ a server.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 30 Apr 2000 22:44:24 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need info on perl modules
Message-Id: <slrn8gprs8.85n.tadmc@magna.metronet.com>

On Wed, 26 Apr 2000 21:13:55 +0100, JB <jb@grolly.com> wrote:

>I need to know what's involved in installing modules 


   perldoc -q module


   "What modules and extensions are available for Perl?  
    What is CPAN?  What does CPAN/src/... mean?"

   "How do I install a CPAN module?"

   "How do I keep my own module/library directory?"

   "How do I add the directory my program lives in to the 
    module/library search path?"


> such as a date command
            ^^^^
>and qmail
     ^^^^^


I have never heard of those Perl modules.

I think they probably are not Perl modules.


Do you have a question related to Perl to ask here
in the Perl newsgroup?



-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 30 Apr 2000 19:04:16 GMT
From: YAWN@YAWN.COM
Subject: Newbie Help!
Message-Id: <390d8532.35116819@news-server>

hi all:

  I am new to perl, i have just written a very very simple script in
attempt to launch FTP in unix and automatically sends files to another
machine.

  I was able to launch the FTP program in unix, but I don't know how
to control the program from there on, it doesn't seem to listen to the
perl script once I have launched the program.

here is my script:

#!/usr/local/bin/perl
#this part is successful
system "ftp";
#this following line does not work
system "open 168.168.1.1"

  I would appreciate it if anyone can direct me to some kind of FAQ
that talks about this issue.

TIA


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

Date: 30 Apr 2000 14:11:56 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Newbie Help!
Message-Id: <878zxvxv2b.fsf@shleppie.uh.edu>

>> On Sun, 30 Apr 2000 19:04:16 GMT,
>> YAWN@YAWN.COM said:

Your subject line is sure way to get lots of people to
ignore your post.  A better Subject would describe your
problem, e.g.

    Subject: problems interacting with an ftp session

> hi all: I am new to perl, i have just written a very
> very simple script in attempt to launch FTP in unix and
> automatically sends files to another machine.

perl has a module called Net::FTP which gives you an ftp
client.  No need then to fork and interact with another
client program (it's also non-portable).

"perldoc Net::FTP" for more info.  Install it with CPAN if
necessary

    # perl -MCOAN -eshell
    > install Bundle::libnet

hth
t


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

Date: Sun, 30 Apr 2000 17:24:43 GMT
From: peter@jetcafe.org (Peter Scott)
Subject: Re: Order of evaluation (Was: Re: regex)
Message-Id: <v%ZO4.10396$x4.355417@newsread1.prod.itd.earthlink.net>

In article <MPG.1374a95e311095a998a9b5@nntp.hpl.hp.com>,
 Larry Rosler <lr@hpl.hp.com> writes:
|> [Cross-postted to comp.lang.perl.moderated, because of a fundamental 
|> semantic issue.]
|> 
|> In article <8ee13m$t59$1@nnrp1.deja.com> on Sat, 29 Apr 2000 06:56:57 
|> GMT, jlamport@calarts.edu <jlamport@calarts.edu> says...
|> 
|> ... 
|> > > $one =~ s/book/script.pl/e;
[snip]
|> I know that you are going through this analysis as a long-winded way of 
|> answering 'no' to the original poster's question of whether this 
|> statement would 'work'.  But it raises a question that is interesting to 
|> me, and perhaps illustrative of the vaguely documented semantics of 
|> Perl.  (Ilya Zakharevich is vigorously nodding 'yes'.)
|> 
|> You state categorically that script() will be evaluated before pl(), 
|> implying a guaranteed order for their side effects, if any.  But all 
|> perlop says about this is:
|> 
|>    Binary ``.'' concatenates two strings.
|> 
|> In C, the order of evaluation of the operands of a binary operator is 
|> explicitly unspecified for most operators.  Left-to-right evaluation is 
|> guaranteed for only a few binary operators, as in Perl:  && || and 
|> comma.
|> 
|> Perl should document either that the order of evaluation of the operands 
|> of a binary operator is in general unspecified, or it should document 
|> that it is left-to-right.  In the absence of either specification, 
|> assertions such as yours are suspect.

 .. is documented as being left-associative.  Are there any cases where
evaluation happens in a different order from associativity?  It appears
there is language in perlop implying that associativity => evaluation order.

-- 
Peter Scott
peter@jetcafe.org


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

Date: 26 Apr 2000 20:56:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl database Access
Message-Id: <8e7hlo$jfo$1@orpheus.gellyfish.com>

On Wed, 26 Apr 2000 09:09:06 -0300 Gil Vautour wrote:
> Jonathan Stowe wrote:
> 
>> On Tue, 25 Apr 2000 14:54:22 -0300 Gil Vautour wrote:
>> >
>> > I was wondering if it is possible to access a MS Access database on a
>> > Solaris box using Perl and DBI?  If so, are there any good resources
>> > on the Web for this sort of thing?
>> >
>>
>> There are at least two optons.  Neither of which involves reading Access
>> file directly on the Solaris box.  Firstly you can export the data to
>> some format that can easily be read on the Unix machine (such as CSV) or
>> you can export it and import it into some database running on the
>> Solaris machine.  Alternatively you can run dbiproxy on some windows
>> machine with an ODBC DSN set up for your Access database and use the
>> DBI driver DBD::Proxy to access it from your Solaris.  Bear in mind that
>> Access is by no means a proper multiuser database and you are highly
>> likely to break it if you put it under any significant load.
>>
>
> With regard to your second alternative, how exactly does the Windows machine
> figure into the mix?  For an Access database to be accessible on the Web,
> does this mean the Windows machine would need to always be available for a
> connection on the Solaris box to occur?
> 

Yes.  The Windows machine is pretending to be a database server for
Access via dbiproxy.  There is no known way to directly access an Access
database except on Windows.  If you feel yourself disagreeing with me you
should check out the archives of comp.databases.ms-access on the subject ;-}

/J\
-- 
No matter how good you are at something, there's always about a million
people better than you.
-- 
fortune oscar homer


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

Date: Sun, 30 Apr 2000 23:18:41 -0400
From: Matt Smith <matts@nortelnetworks.com>
Subject: Perl msql prob....
Message-Id: <390CF791.6A2EF425@nortelnetworks.com>

Hi all,

Just finished installing latest version of mSQL perl module
(Msql-Mysql-modules-1.2213). Even though it seemed to go through just
fine, I'm now getting the following message when I try to connect:

"Can't find loadable object for module DBD::mSQL in @INC
(/opt/corp/local/perl-5.
004/lib/s700/5.004 /opt/corp/local/perl-5.004/lib
/opt/corp/local/perl-5.004/lib
/site_perl/s700 /opt/corp/local/perl-5.004/lib/site_perl .) at
/opt/corp/local/p
erl-5.004/lib/site_perl/Msql.pm line 13"

The mSQL.pm file is inside of DBD, and the path is set up fine. Any idea
why I'd be getting this error?

BTW, running Perl 5.004 on HP-UX 10.20.

Thanks!
Matt



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

Date: Sun, 30 Apr 2000 20:06:21 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Perl/Oracle-SLQ*Loader error
Message-Id: <390CE69D.80D4CB77@indra.com>

Bhavesh Gosar wrote:
> 
> Hi,
> 
> I am calling SQLLoader (which loads data from text file into
> Oracle DB) from a Perl Script (all env. variables are fine)...
> This used to work a couple of days earlier....But all of a sudden
> I am getting the foll. error...
> 
> ===============
> SQL*Loader: Release 8.0.5.0.0 - Production on Wed Apr 26 15:3:31 2000
> 
> (c) Copyright 1998 Oracle Corporation.  All rights reserved.
> 
> ORA-12545: Connect failed because target host or object does not exist
> SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [-1]
> ===============
> 
> I checked the Oracle Support web but without luck...
> 
> Any clue as to what is this...and what is the solution to this...
> 
> Thanks,
> Bhavesh Gosar

This is an Oracle error.  See the Oracle docs and get your DBA to take a
look at it.

-- 

Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: 30 Apr 2000 19:09:13 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: php, embPerl, mod_perl, help.
Message-Id: <8ei0cp$pnq$1@newsflash.concordia.ca>

In article <anthony-9691C0.02582630042000@news.slip.net>,
Anthony Boyd  <anthony@outshine.com> wrote:

>I'm looking to use mySQL on a Linux box with Apache.  I'll have about 5 
>"shell" pages that'll pull in data from mySQL.  Assuming the box is 
>around a 750mhz pentium III with 256 megs of RAM, how will any of the 
>following plans work for a site that gets about 100,000 hits/day?

Unfortunately that's not enough information... what your app does and how 
good of a programmer you are also issues. 
 

>1.  Build .shtml files, use SSI calls to .pl files that use DBI to pull 
>data from mySQL.  I like this because I can understand it, and it 
>separates Perl from HTML.  But my guess is this is too slow.

Probably too slow.

>2.  Use embPerl.  I gather it does a PHP kind of thing.  Is the concept 
>something like an Apache module that then parses all .html files for 
>Perl?  How fast is that?  Is PHP more robust and in wider use?

I've never used either. No comment. Only testing could show which is better.
PHP and Perl are both pretty solid AFAIK. PHP is in wider use than embperl,
but probably still not as popular as all perl-related web stuff combined.

>3.  What about mod_perl?  Do I need it for 100,000 hits/day?  If I 
>understand it correctly, mod_perl is an Apache module.  So if I have a 
>.cgi file in Perl, I do something like "#!/bin/apache -w" (am I close?) 

No, that's totally wrong. You're still writing perl scripts, it's just that 
the interpreter and many other perl hooks are embedded into Apache, for speed
and flexibility. A cursory examination of perl.apache.org will
explain it to you.

>instead of "#!/usr/bin/perl -w" in my Perl code?  It sounded like people 
>on c.l.p.m found mod_perl to be burdensome?

It's harder to write for mod_perl, but much more rewarding. Once you've got
the hang of it you can do much more per unit of work, so "burdensome" is 
a judgement call.

>4.  Is Apache::DBD something that extends Apache, or a Perl DBI driver?

There is no Apache::DBD module. (I checked... maybe somebody had found a way
to search web sites with SQL? :) You're thinking of Apache::DBI, which 
allows mod_perl to maintain a shared pool of connections to a db. This is
faster that opening and closing connections for each request. 

Search.cpan.org will lead you right to the docs.

>5.  Can anyone with experience in this area share some wisdom or 
>suggestions that might help me to have a more successful first-try?  I'm 
>not a fan of Perl's sprawling documentation, but I'll buy books on 
>recommendation, and print Web articles.

Buy "Apache Modules with Perl and C", Stein & MacEachern, O'Reilly. Despite
the C in the title this book is 90% about perl. 

perl.apache.org has invaluable guides, but the documentation is a little bit
disorganized right now. Be persistent and you'll get the hang of it.

perlmonth.com has regular features on mod_perl and stuff that uses mod_perl.


-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Sun, 30 Apr 2000 16:01:12 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Please Explain ... print "Location: http:etc.";
Message-Id: <390CBB37.D2D78806@My-Deja.com>

> I am a Perl newbie and am copying someone else's cgi script that works.
> After the input data from an HTML FORM  (POST) is processed and the MAIL is sent back,
> the following line "successfully" returns the correct web page to the client.
>
>    print  "Location: http://www.xxx/index.htm\n\n";
>
> Please explain what the <Location:> part is. I can find no reference to it in any books or on
> deja...

This is a HTTP response header. You will find information
about it in RFC  2068 that explains HTTP protocol.
check this
http://www.cis.ohio-state.edu/htbin/rfc/rfc2068.html
This has nothing to do with Perl or CGI

> Also..... and this is the most important part.
>
> I have included a "hidden" field in my form named "nextpage"
>    and it has a value of  "http://www.xxx/index.htm\n\n"
>
> Why does the following not work ???
>    print  "Location: $NEXTPAGE";

Because your are putting it in the body  and not the header.
This is NOT how you should use Location header.
Use normal anchors for the "next page" requirements




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

Date: Mon, 1 May 2000 01:52:03 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Please Explain ... print "Location: http:etc.";
Message-Id: <Pine.GHP.4.21.0005010132050.14968-100000@hpplus03.cern.ch>

On Sun, 30 Apr 2000, Makarand Kulkarni wrote:

> >    print  "Location: http://www.xxx/index.htm\n\n";
> >
> > Please explain what the <Location:> part is. I can find no reference to it in any books or on
> > deja...
> 
> This is a HTTP response header.

Excuse me, but I'd rate that as a CGI response header (sent from a CGI
process to its web server).  It's documented in the interface
specification for CGI.

There are two fundamentally different CGI Location: responses, only
one of which causes the server to return an HTTP response header to
the client.  That, as it happens, is the one.   (The other is resolved
internally in the server, and doesn't cause an HTTP redirection
transaction).

> You will find information
> about it in RFC  2068 that explains HTTP protocol.

Again to be pedantic, RFC2616 (which obsoleted RFC2068) specifies the
network transaction between the web server and the client.  It's only
indirectly related to the programming interface between a CGI
process and its web server.  The similarity between the headers is of
course intentional, but often causes confusion.

Indeed all this is off topic for c.l.p.misc, but as long as answers
are offered here, I'm afraid I do feel they ought to be accurate.

> This has nothing to do with Perl or CGI

If the hon Usenaut was writing a web server in Perl, then they'd be
writing to a network socket, and the above code would be wrong,
because the HTTP protocol mandates \015\012 as the newline terminator.  
(It would need a pair of those, since it's the last thing in the
header).

But when writing to the CGI, the local platform newline is OK, it's
the job of the web server to produce the canonical CRLF for the
network.

So I'd have to rate this as having everything to do with CGI (and
therefore to be properly on-topic at comp.infosystems.www.authoring.cgi)

sorry about that, I suppose I'm a bit stubborn on this issue, but I've
seen so much confusion around, which IMHO sticking to the accurate
story helps to clarify.

A co-production based on discussion from this very group is at
http://ppewww.ph.gla.ac.uk/~flavell/www/perlcgifaq.html

all the best



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

Date: Sun, 30 Apr 2000 22:06:05 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Please Explain ... print "Location: http:etc.";
Message-Id: <390CE68D.9ACAE4F7@attglobal.net>



"Alan J. Flavell" wrote:

> Again to be pedantic, RFC2616 (which obsoleted RFC2068) specifies the

<lots of impressive info snipped>

> all the best


Where do you learn all this???  Im consistently amazed.  
I know its been said about many before, but I think Alan
is a response-bot ;-)

Off topic, I know, but im trying to learn.


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

Date: Mon, 1 May 2000 08:52:51 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: program that prints itself
Message-Id: <8eikiv$24p@netnews.hinet.net>

Jeff Zucker wrote

> P.S., if you asked this because of a homework question, I get the 'A',
> not you.  No, wait, Abigail and Zenin get the 'A', not me.

No.  I am not a student.  I just think learning Perl is a lot of fun.  : )

Thanks for your answer.

John Lin





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

Date: Mon, 1 May 2000 09:42:30 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: program that prints itself
Message-Id: <8eing3$4nc@netnews.hinet.net>

Mark-Jason Dominus wrote

>         open+0;print<0>

I think I may learn something from this code, so I drill it down.

Does FILEHANDLE #0 mean STDIN?

Apparently not, because the following code doesn't work.

open STDIN;print<STDIN>

I guess it is related to $0 but it is not documented.  Can you explain it?

> Also see http://www.plover.com/~mjd/perl/quine.html

Ha ha, this is humorous.

John Lin




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

Date: 1 May 2000 02:21:18 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: program that prints itself
Message-Id: <slrn8gpqgu.9su.sholden@pgrad.cs.usyd.edu.au>

On Mon, 1 May 2000 09:42:30 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>Mark-Jason Dominus wrote
>
>>         open+0;print<0>
>
>I think I may learn something from this code, so I drill it down.
>
>Does FILEHANDLE #0 mean STDIN?
>
>Apparently not, because the following code doesn't work.
>
>open STDIN;print<STDIN>
>
>I guess it is related to $0 but it is not documented.  Can you explain it?

From perldoc -f open
       open FILEHANDLE,MODE,LIST
       open FILEHANDLE,EXPR
       open FILEHANDLE
	...
               If EXPR is omitted, the scalar variable of the
               same name as the FILEHANDLE contains the filename.


In this case the FILEHANDLE is 0, so the filename will be taken from $0.

You could take more characters and make it more obvious but less cool with:

open 0,$0;print<0>

-- 
Sam

Perl was designed to be a mess (though in the nicest of possible ways). 
	--Larry Wall


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

Date: Sun, 30 Apr 2000 23:43:21 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: Re: Retrieving the name of a variable
Message-Id: <8eigen$g1b$1@nnrp1.deja.com>


> >For example the follwing code :
> >
> >($var1,$var2,$var3) = ('value1','value2','value3');
> >
> >foreach ($var1,$var2,$var3) {
> >        print NameOfVar($_)."\n";
> >};
> >
> >should output:
> >
> >var1
> >var2
> >var3

> There is likely a better way to do what you want, but you
> have to tell us what you want (not how you think you can
> _get_ what you want, but what you ultimately want).

Thanks for the reply Tad but what I want to do is too complicated to
explain it to you. So if you could just tell me if what I am trying to
do is *actually* possible with Perl, it'd be extremely helpful!

Hoping to hear from you soon ...

/Makau

PS : I know I could use $hash{var1},$hash{var2},$hash{var3} to make it
easier, but I need to use scalars.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 30 Apr 2000 18:59:20 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Retrieving the name of a variable
Message-Id: <87hfcjywbq.fsf@shleppie.uh.edu>

>> On Sun, 30 Apr 2000 23:43:21 GMT,
>> Makau Divangamene <makau@multimania.com> said:

> Thanks for the reply Tad but what I want to do is too
> complicated to explain it to you. So if you could just
> tell me if what I am trying to do is *actually* possible
> with Perl, it'd be extremely helpful!

I know the answer to your question but it is too
complicated to explain to you.

Articles in this group quite often contain attempts to
solve some problem which ultimately turns out to be a
garden-path and a better approach is possible to solve the
_real_ problem which was obfuscated by the way the
original article was phrased.

Context is all.


hth
t


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

Date: Sun, 30 Apr 2000 20:14:03 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Retrieving the name of a variable
Message-Id: <slrn8gpj2b.7kc.tadmc@magna.metronet.com>

On Sun, 30 Apr 2000 23:43:21 GMT, Makau Divangamene <makau@multimania.com> wrote:

>> >foreach ($var1,$var2,$var3) {
>> >        print NameOfVar($_)."\n";
>> >};
>> >
>> >should output:
>> >
>> >var1
>> >var2
>> >var3
>
>> There is likely a better way to do what you want, but you
>> have to tell us what you want (not how you think you can
>> _get_ what you want, but what you ultimately want).


Here is a literal answer to your question:

   Don't do a loop.  Just do three print statements:

      print "var1\n";
      print "var2\n";
      print "var3\n";

or,

   Do a loop over the _names_ instead of over the variables:

      foreach ( qw/var1 var2 var3/ ) {
         print "$_\n";
      }


I expect both of those to be unsatisfying answers...

 ... because there is something that you aren't telling me....


>Thanks for the reply Tad but what I want to do is too complicated to
>explain it to you. 


 ... and it appears that you will not be telling me.   :-(


So I cannot help you.

I cannot solve a problem that I do not understand.


>So if you could just tell me if what I am trying to
>do is *actually* possible with Perl, it'd be extremely helpful!


Perhaps someone else here can understand the problem and
offer a solution.


>Hoping to hear from you soon ...


I think this followup was relatively snappy, but I bet its
content proves disappointing. Sorry.


>PS : I know I could use $hash{var1},$hash{var2},$hash{var3} to make it
>easier, 


And if I _was_ going to try and solve the "unknown problem", you
wouldn't follow my advice anyway, 'cause I would have shown how
to use a hash for your problem.


>but I need to use scalars.

Hash values _are_ scalars. So that must not be the real reason
to not use a hash.

Why not use a hash?




Good luck!


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 01 May 2000 03:08:05 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: Re: Retrieving the name of a variable
Message-Id: <8eisec$str$1@nnrp1.deja.com>


> I know the answer to your question but it is too
> complicated to explain to you.

I really doubt it.

Some people on this newsgroup will either never say that something
can't be done with Perl, or will prefer to give such an incredibly
helpful reply expressed above.

Talk about context. I may explain you *in depth* why I want to do that
and you will likely find a workaround to my problem. But what if
someone else has the same problem as mine, with a completely different
context? Just giving the solution to my problem problem would help
*everybody*. Giving a workaround to my specific case will virtually
profit noone else but me.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 01 May 2000 11:43:36 +1000
From: "Amri, Kuross [WOLL:4009-I:EXCH]" <kamri@nortelnetworks.com>
Subject: Telnetting
Message-Id: <390CE148.4F7C1600@nortelnetworks.com>

Hello,
	I have a telnet session running, but the output is incorrect because
the program is picking up the data from before the program gets to the
prompt after it has logged in.
	What I want to know is if there is some kind of wait() function that
allows a countdown of 4 seconds before the program starts again. The
waitfor function doesn't seem to be working & the prompt I designate is
not changing either. 
	If anyone has experienced the same problems, please feel free to share.

Thanks,
K Amri.


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

Date: Sun, 30 Apr 2000 22:19:59 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Telnetting
Message-Id: <390CE9CF.95B93343@attglobal.net>



"Amri, Kuross [WOLL:4009-I:EXCH]" wrote:
> 
> Hello,

Hi


>         What I want to know is if there is some kind of wait() function that
> allows a countdown of 4 seconds before the program starts again. The
> waitfor function doesn't seem to be working & the prompt I designate is
> not changing either.

Why re-invent the wheel?  Use Net::Telnet, available as part of the 
libnet bundle.

http://www.perl.com/reference/wrap.cgi?net-telnet

This should fit the bill nicely.

-DS


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

Date: 30 Apr 2000 18:28:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Unicode in Perl 5.6 - broken?
Message-Id: <8ehu16$nhj$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Bertilo Wennergren
<bertilow@hem.passagen.se>],
who wrote in article <8ehqat$92hv7$1@fu-berlin.de>:
> To summarize the problems I've met I concocted the following
> CGI-script. The result is meant to be read with at browser
> that can deal with UTF-8, and that can show the necessary
> glyphs for characters from Latin-1 Supplement and Latin

Download Tk and tkCon, start a tkCon.  Give the following commands:

   (tk) 1 % rename exec exec.int
   (tk) 2 % proc exec args {encoding convertfrom utf-8 [eval exec.int $args]}
   (tk) 3 % perl5.6.0 -Mutf8 -e {print "\x{5e1}"}

etc.  You got you UTF-8 development environment.

Ilya


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

Date: Sun, 30 Apr 2000 21:04:28 +0200
From: "Bertilo Wennergren" <bertilow@hem.passagen.se>
Subject: Re: Unicode in Perl 5.6 - broken?
Message-Id: <8ehvu1$934ks$1@fu-berlin.de>


"Ilya Zakharevich":

> <bertilow@hem.passagen.se>],

> > To summarize the problems I've met I concocted the following
> > CGI-script. The result is meant to be read with at browser
> > that can deal with UTF-8, and that can show the necessary
> > glyphs for characters from Latin-1 Supplement and Latin

> Download Tk and tkCon, start a tkCon.  Give the following commands:

>    (tk) 1 % rename exec exec.int
>    (tk) 2 % proc exec args {encoding convertfrom utf-8 [eval exec.int
$args]}
>    (tk) 3 % perl5.6.0 -Mutf8 -e {print "\x{5e1}"}

> etc.  You got you UTF-8 development environment.

Hmmm... Will these progs work in Windows 98? That's what I use.

BTW: I already have a working UTF-8 text editor in Windows 98,
but if there are more advanced UTF-8 development environments
for perl on Windows 98, I'll be glad to check them out.

Did you mean to imply that the problems I experienced were due to a
lack of UTF-8 support in my development environment? How so?

--
#####################################################################
                         Bertilo Wennergren
                 <http://purl.oclc.org/net/bertilo>
                     <bertilow@hem.passagen.se>
#####################################################################



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

Date: 26 Apr 2000 21:57:21 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: uploading files with cgi-lib.pl
Message-Id: <8e7l7h$v2p$1@orpheus.gellyfish.com>

On Tue, 25 Apr 2000 21:17:07 -0500 Z-man wrote:
> Hi all,
> I've run into a problem uploading files such as my document.doc (notice
> the space in the file name is intentional) Has any one else had this
> problem?Other than renaming the files is there any way to fixx this
> problem?just an fyi I'm running my scripts on a win98 box.Any help
> appreciated.
> 

This is probably a bug in the code you are using to decode the form
submission.  You might try this with CGI.pm to see if the problem
persists.

/J\
-- 
Well, let's just call them, uh, Mr. X and Mrs. Y. So anyway, Mr.X would
say, 'Marge, if this doesn't get your motor running, my name isn't Homer
J. Simpson.'
-- 
fortune oscar homer


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

Date: 30 Apr 2000 18:43:02 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Where is it found?
Message-Id: <8ehurm$6ld$1@newsflash.concordia.ca>

>PenPal asks for help:
>
>> How can I return the position where a regexp 
>> has found a result. For example:
>
>> $string = "This is just some string";
>> if ($string =~ /some/i) {
>>    print "Found some. It's was XXth word";
>> }

Some other options:

#!/usr/bin/perl
 
my $string = <<END;
Sometimes I think you can fool some of the people some of the time,
and some of the people all of the time.
END
 
print $string;
 
my $word;                                                                  

while ($string = /some/igs) {
   print pos($string), "\n";  # pos gives the position of a m//g match. like index.
}

----   

while ($string =~ /(\w+)/igs) {
   ++$word;
   $1 eq 'some' and
      print "found $1 at word $word, pos ", pos($string), "\n" ;
}   

----

# count only starts of words with sequence ^\w or \W\w ...
# otherwise \b would count twice

while ($string =~ /(?:^|\W)(?=\w)(?{++$word})(some)\b/igs) {
   print "found $1 at word $word, pos ", pos($string), "\n" ;
}
     
-----

# heh. Count the beginning as .5, then immediately a word boundary as .5,
# giving 1 for the first word.
# all other words are preceded by two word boundaries, so will be incremented + 1 

while ($string =~ /(?:^|\b)(?{$word+=.5})(some)\b/igs) {
   print "found $1 at word $word, pos ", pos($string), "\n" ;
}  

-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: 26 Apr 2000 22:13:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Windows Script Component using PerlScript
Message-Id: <8e7m5j$2fo$1@orpheus.gellyfish.com>

On Wed, 26 Apr 2000 11:05:11 -0400 Steven P. Woolet wrote:
> I'm trying to implement a Windows Script component using PerlScript. 
> When I attempt to register the component, I get a runtime error from
> regsvr32.exe of:  abnormal program termination.  This happens even when
> I try the "SayHello" example in the ActiveState documentation.  If I
> remove the part having to do with PerlScript, it will register
> successfully.  
> 
> Does anyone know if regsvr32 on Windows2000 can actually register a
> PerlScript?

Dunno about that but if you find the file in Windows Explorer and right
click on it it should have a 'register' menu item which will work fine.

If that doesnt work then you have a problem with you scripting host and
you should ask in some windows group.

/J\
-- 
If celebrities didn't want people pawing through their garbage and saying
they're gay, they shouldn't have tried to express themselves creatively.
-- 
fortune oscar homer


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 2912
**************************************


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