[18305] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 473 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 12 18:07:34 2001

Date: Mon, 12 Mar 2001 15:05:12 -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: <984438312-v10-i473@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 12 Mar 2001     Volume: 10 Number: 473

Today's topics:
    Re: $ENV{'HTTP_REFERER'} <rworth5@home.com>
        405 Method not Allowed brichards@cda.com
    Re: CGI RESET problem solved <mischief@velma.motion.net>
    Re: complex pattern matching with backslashes <bart.lateur@skynet.be>
    Re: complex pattern matching with backslashes (Malcolm Dew-Jones)
    Re: create a text file in DOS format. <flavell@mail.cern.ch>
    Re: Criticism? (comparing contents of two arrays) (Martien Verbruggen)
    Re: Detecting User Country in CGI Script <juex@deja.com>
    Re: Detecting User Country in CGI Script <mischief@velma.motion.net>
    Re: format/write to a variable not an output handle, po <webmaster@webdragon.munge.net>
        Formatting HTML using Perl <phibeta@newsguy.com>
    Re: Formatting HTML using Perl <wizard@psychodad.com>
    Re: from SETL to Perl (Jay Tilton)
    Re: Help to Install Perl (Avast)
        HTTP_WEFERER ???? <rworth5@home.com>
    Re: HTTP_WEFERER ???? <revjack@revjack.net>
    Re: HTTP_WEFERER ???? <sdfg@asd.g>
    Re: HTTP_WEFERER ???? <rworth5@home.com>
        Local and Global vairables(2) <milliwave@rfengineering.freeserve.co.uk>
    Re: Local and Global vairables(2) <sdfg@asd.g>
        local and global variables <milliwave@rfengineering.freeserve.co.uk>
    Re: local and global variables (Gwyn Judd)
    Re: Macbeth and Perl threads <vdhamer@msn.com>
    Re: Macbeth and Perl threads <dan@tuatha.sidhe.org>
    Re: Objects in Perl <mischief@velma.motion.net>
    Re: Perl And CGI <mark_shutt@hotmail.com>
        Reading and writing files <milliwave@rfengineering.freeserve.co.uk>
    Re: Removing spaces from a string. <galen.menzel@mail.utexas.edu>
    Re: Tk based alarm clock <sun_tong_001@yahoo.com>
        whats up <xbwfo@home.com>
        XS: Accessing 'enum' constants <mpapesch@gmx.de>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Mar 2001 19:55:28 GMT
From: "Richard" <rworth5@home.com>
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <QQ9r6.3609$rB2.288054@news1.rdc1.mb.home.com>

Unfortunatley I have already thought of that, but there is no change. Since
it is spelled the exact same way in many other scripts, as well as in the
books I have. The spelling should not affect this.


"Daniel Berger" <djberge@uswest.com> wrote in message
news:3AACDBA1.5C3E6960@uswest.com...
> Richard wrote:
>
> > I am wondering if anyone else is having a problem with this. I have had
a
> > line of code on my script for the past 3 months. It has been working
just
> > fine until about a week ago. I havent changed anything, and noticed for
some
> > unknown reason, it has stopped working.
> >
> > All I am doing is keeping a log of the referring pages.
> >
> > I have even tried something as simple as
> >
> > $name = $ENV{'HTTP_REFERER'};
> >
> > print "$name\n";
> >
> > and it won't even do that. I can get everyother environment variable to
> > print to screen except this inparticular.
> >
> > Was hoping someone could explain.
> >
> > Richard
>
> Uh-oh.  Did someone go and correct the spelling of "referer"?  Just
> for kicks, try "HTTP_REFERRER"  and see what happens.
>
> Also note that Referer is not always sent to the server.
>
> Dan
>
>
>




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

Date: 12 Mar 2001 21:26:44 GMT
From: brichards@cda.com
Subject: 405 Method not Allowed
Message-Id: <98jeuk$ncq$1@news.netmar.com>

What does this error mean?  When calling to SoapLite.com the client works. 
But when I connect to my server I get SOAP call failed.


 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: Mon, 12 Mar 2001 21:49:59 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: CGI RESET problem solved
Message-Id: <taqh473fh55nd4@corp.supernews.com>

BUCK NAKED1 <dennis100@webtv.net> wrote:
> Maybe sometimes CGI.pm isn't the best way? :-) I got this to work by
> using a sub. I know I should've coded the last elsif as else, and not
> used the last else{}.. oh well... it works. 

Not necessarily. It's good to have an error-catching else if you
don't really want a default action. I'd have my else actually
printing an error message about how none of the other matched,
though.

> elsif(param('do_it')) {
> print &do_it 
> } 

This makes it look like you're doing something interesting in
do_it and returning the result. 

> sub do_it {"doing the work now\n" }; 

Here, the subroutine is using its default return -- the last
expression evaluated. All you're doing here is creating a
subroutine call in order to set an anonymous variable for
your print. Better to code it as a literal for the print or
to set a variable before the print.

Chris

-- 
Christopher E. Stith
Ahhh, Altoids, Red Stripe, Guinness, and Partagas... Four of the
best things to ever come from an island.


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

Date: Mon, 12 Mar 2001 19:21:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: complex pattern matching with backslashes
Message-Id: <be8qatgpsg6d8srknb8q44s76krs2djsjc@4ax.com>

Hugo Bouckaert wrote:

>\\SomeComputer\directory1\directory2\directory3\filename.doc
>
>I would like to convert this to 
>
>/directory2/directory3/filename.doc

	s!\\\\SomeComputer\\directory1\\directory2\\!/! and tr!\\!/!;

-- 
	Bart.


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

Date: 12 Mar 2001 11:56:31 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: complex pattern matching with backslashes
Message-Id: <3aad29ef@news.victoria.tc.ca>

Randal L. Schwartz (merlyn@stonehenge.com) wrote:  : >>>>> "Terrence" ==
Terrence Monroe Brannon <terrence.brannon@oracle.com> writes: 

: Terrence> Why do you want to do this? Perl uses "/" internally always
: Terrence> regardless of machine...  

: No.  Perhaps you are getting confused recalling that Windows permits
: either / or \ in filepaths at the program level (not at the command
: level), so you can write programs (mostly) portable between Unix and
: Windows by always using forward slashes.

: However, MacPerl and VMS perl and OS/2 Perl are certainly not going to
: be accepting slashes. :)

The copy of Perl on VMS that I am using does accept / as a path seperator. 
It's just the most recent binary distribution I could find, I have no idea
how it was built. 

	$ create /directory [.sub]
	$ perl try.pl


	# try.pl
	open FILE , ">sub/newfile.txt" or die $!;
	print FILE "hello there\n" or die $!;
	close FILE or warn $!;

The file newfile.txt was successfully created.



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

Date: Mon, 12 Mar 2001 19:42:59 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: create a text file in DOS format.
Message-Id: <Pine.LNX.4.30.0103121936350.31827-100000@lxplus003.cern.ch>

On Mon, 12 Mar 2001, Philip Newton wrote:

> On Sat, 10 Mar 2001 15:04:46 -0000, Chris Stith
> <mischief@velma.motion.net> wrote:
>
> > End all your lines with qq{\r\l}
>
> ITYM qq{\r\n}.

  A common misconception in socket programming is that \n eq \012 everywhere.
  When using protocols such as common Internet protocols, \012 and \015 are
  called for specifically, and the values of the logical \n and \r (carriage
  return) are not reliable.

      print SOCKET "Hi there, client!\r\n";      # WRONG
      print SOCKET "Hi there, client!\015\012";  # RIGHT

(quoted from perlport).

My vote goes for perlport, _if_ DOS/Windows newlines are precisely
what you're trying to achieve (from any platform).  This corresponds
very closely to the socket scenario that perlport was discussing.

Don't forget binmode() for portability.

cheers



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

Date: Mon, 12 Mar 2001 22:17:36 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Criticism? (comparing contents of two arrays)
Message-Id: <slrn9aqio0.nts.mgjv@verbruggen.comdyn.com.au>

On Mon, 12 Mar 2001 21:58:37 +1100,
	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> 
> my %dsi;
> @dsi{@dsi) = (0 .. $#dsi);
> 
> This will give you a hash with the product keys as numbers, and the
                                             ^^^^^^^^^^^^^^^
Correction: ...product numbers as keys...

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 12 Mar 2001 13:22:04 -0800
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <3aad3dfc$1@news.microsoft.com>

"Mihai N." <nmihai_2000@yahoo.com> wrote in message
news:90616292MihaiN@24.1.64.32...
> Juha.Laiho@iki.fi (Juha Laiho) wrote in <98dfg0$d61$1@ichaos.ichaos-int>:
>
> Not the country. I remember it was a big talk about this when
> France asked Yahoo (and others) to block the search for nazi stuff
> for the clients in France.
>
> But if in fact what you wish to find out is the language or the acceptable
> encoding, a method is to check in the header of the request.
> Most of the browsers will include in the request header the
> Accept-Language and Accept-Charset fields.

Just keep in mind that a user with accept language="French" might sit in
Switzerland, Belgium or Canada, a user with "English" might be in South
Africa, NewZealand, or India, "Spanish" might be Spain or Mexico,
traditional Chinese could be Taiwan or Hongkong (or even Singapore) and even
"Portuguese" could come from the Iberian peninsula or from Brazil.
Bottom line: don't try to deduce a location from a language. It simply
doesn't work.

jue




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

Date: Mon, 12 Mar 2001 22:23:05 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Detecting User Country in CGI Script
Message-Id: <taqj29cgtms4e1@corp.supernews.com>

"Jürgen Exner" <juex@deja.com> wrote:
> "Mihai N." <nmihai_2000@yahoo.com> wrote in message
> news:90616292MihaiN@24.1.64.32...
>> Juha.Laiho@iki.fi (Juha Laiho) wrote in <98dfg0$d61$1@ichaos.ichaos-int>:
>>
>> Not the country. I remember it was a big talk about this when
>> France asked Yahoo (and others) to block the search for nazi stuff
>> for the clients in France.
>>
>> But if in fact what you wish to find out is the language or the acceptable
>> encoding, a method is to check in the header of the request.
>> Most of the browsers will include in the request header the
>> Accept-Language and Accept-Charset fields.

> Just keep in mind that a user with accept language="French" might sit in
> Switzerland, Belgium or Canada,

And possibly elsewhere, including certain parts of the Carribean, Africa,
or South America

> a user with "English" might be in South
> Africa, NewZealand, or India,

Or the US, Australia, Canada, UK, Belize, or possibly even Japan or parts
of Europe where the norm would be something else. I know many Germans,
for instance, who often browse in English as well as German since they are
fluent in both.

> "Spanish" might be Spain or Mexico,

Or the US or most of South America, and several southern North American
countries. There is a signifigant part of the US population which, even
if conversant in English, are more fluent in Spanish.

> traditional Chinese could be Taiwan or Hongkong (or even Singapore) and even
> "Portuguese" could come from the Iberian peninsula or from Brazil.
> Bottom line: don't try to deduce a location from a language. It simply
> doesn't work.

Good advice.

Chris

-- 
Christopher E. Stith
Try not. Do, or do not. The Force is binary. -- Yoda,
The Empire Strikes Back (paraphrased)



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

Date: 12 Mar 2001 20:24:49 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: format/write to a variable not an output handle, possible?
Message-Id: <98jbah$lgu$0@216.155.33.65>

In article <x7vgpgbzb7.fsf@home.sysarch.com>, Uri Guttman 
<uri@sysarch.com> wrote:

 |   SRG> I'd like to, if possible, use the format procedures to create a
 |   SRG> simple output template (without the need for Text::Template if
 |   SRG> possible, since the site where this is eventually going to be
 |   SRG> hosted is damned slow at upgrading their Perl modules.) However,
 |   SRG> the context in which I'll need this is for the eventual write to
 |   SRG> wind up inside a variable rather than to an output handle. Can I
 |   SRG> assign a write to the RHS and dump it into an array of lines?
 | 
 | have you read perlform? it's in there.

not all the way through yet, but I do have it here. Thanks, it's good to 
know that it's in there somewhere. :)

 .. off to peruse and twiddle ... peruse and twiddle. :>

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Mon, 12 Mar 2001 13:40:46 -0800
From: Nuet Lareton <phibeta@newsguy.com>
Subject: Formatting HTML using Perl
Message-Id: <gafqatkojk1ednngij52qmum13p3pbir2h@4ax.com>

Hi! I'm somewhat new to perl and I'm a little lost on something I
wanted to do. I want to format all the HTML documents in a folder the
same way. Mostly for neatness and to creat a template file. I've
already stripped out most of the beginning whitespace between the tags
using AWK, but I was thinking of doing something more with perl.
Here is something like a what I have
<HTML>
<Head>
<script></scrip>
</head>
<body>
<tag><Tagswithintags></tagswithintags></tag>
<Tag tagname="name"></tag> 
</body>
</html>
and I want to format it so that it looks like this:
<HTML>
  <HEAD>
    <SCRIPT>
    </SCRIPT>
  </HEAD>
  <BODY>
    <TAG>
    </TAG>
    <TAG>
      <TAGSWITHINTAGS>
      </TAGSWITHINTAGS>
    </TAG>
    <TAG TAGNAME="name">
    </TAG>
  </BODY>
</HTML>

In other words I want to strip out all of the text within the document
so I can see just the tags formatted with a variable spacing like
$space="  "; or $space="\t"; and that every time it finds a tag that
doesn't match the one found /<([^>]*)>/ != $prevmatch then it would
recursively go into a new subroutine and keep going until it matched
up and so on and so forth till it matched HTML.

I thought about it and said, "heh... someone must have already made
this." I then did a quick look at HTMLTree and was unable to get it to
work print $a->as_html; only gave me <HTML></HTML>

I tried working with it and am a bit lost. Like I said, I'm somewhat
new to perl so I'm unsure as to whether or not I even used HTMLTree
correctly.

Should I just make the recursive proggy I started on or is there a
module that will do what I am looking for?

Thanks guys.
Nuety


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

Date: Mon, 12 Mar 2001 16:18:44 -0600
From: "Michael D. Kirkpatrick" <wizard@psychodad.com>
Subject: Re: Formatting HTML using Perl
Message-Id: <3AAD4B42.FD4FCA08@psychodad.com>

A typical HTML editor like Claris Home Page or Hot Metal will
automatically format the HTML that way.  Check it out...

Nuet Lareton wrote:

> Hi! I'm somewhat new to perl and I'm a little lost on something I
> wanted to do. I want to format all the HTML documents in a folder the
> same way. Mostly for neatness and to creat a template file. I've
> already stripped out most of the beginning whitespace between the tags
> using AWK, but I was thinking of doing something more with perl.
> Here is something like a what I have
> <HTML>
> <Head>
> <script></scrip>
> </head>
> <body>
> <tag><Tagswithintags></tagswithintags></tag>
> <Tag tagname="name"></tag>
> </body>
> </html>
> and I want to format it so that it looks like this:
> <HTML>
>   <HEAD>
>     <SCRIPT>
>     </SCRIPT>
>   </HEAD>
>   <BODY>
>     <TAG>
>     </TAG>
>     <TAG>
>       <TAGSWITHINTAGS>
>       </TAGSWITHINTAGS>
>     </TAG>
>     <TAG TAGNAME="name">
>     </TAG>
>   </BODY>
> </HTML>
>
> In other words I want to strip out all of the text within the document
> so I can see just the tags formatted with a variable spacing like
> $space="  "; or $space="\t"; and that every time it finds a tag that
> doesn't match the one found /<([^>]*)>/ != $prevmatch then it would
> recursively go into a new subroutine and keep going until it matched
> up and so on and so forth till it matched HTML.
>
> I thought about it and said, "heh... someone must have already made
> this." I then did a quick look at HTMLTree and was unable to get it to
> work print $a->as_html; only gave me <HTML></HTML>
>
> I tried working with it and am a bit lost. Like I said, I'm somewhat
> new to perl so I'm unsure as to whether or not I even used HTMLTree
> correctly.
>
> Should I just make the recursive proggy I started on or is there a
> module that will do what I am looking for?
>
> Thanks guys.
> Nuety



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

Date: Mon, 12 Mar 2001 20:12:29 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: from SETL to Perl
Message-Id: <3aad22f0.175838714@news.erols.com>

On Sun, 11 Mar 2001 23:58:42 -0500, "cyberian bear"
<cyberian_bear@hotmail.com> wrote:

>The thing is, if at least I knew what the
>'Euler path construction', or 'Prime factors' are, I could just program them
>on my own without looking at the SETL code, but i don't.

You would do yourself a great favor by researching them.  Neither
concept is especially difficult to grasp.  In fact, this would be more
appropriately posted to a math newsgroup.  Since SETL is a
mathematics-oriented language, you might even find a SETL guru there,
if there is such a beast.

Designing code around an algorithm is (usually) easier than
translating existing code.  What happens when you want to construct an
Eulerian Path in 3-space?  Or if you need to change the Eulerian Path
routine to handle directed paths?  Or even, heaven forbid, when it's
time to debug a misbehaving routine?

Boss: "This is great stuff!  Do you think it can be used to design a
more efficient route for our delivery trucks?  There's a fat bonus in
it for you."

You: "Well...ah...erm...that is to say..."

Ok.  That scenario teeters on the edge of plausibility, but you get
the point.  :)

>Basically I just
>want to ask some good soul if he could translate these two programs for me
>from SETL to Perl.

Sorry to say, that's not likely.

>    procedure Euler_path(G);                -- constructs Eulerian path for

Given a set of points (nodes) and lines connecting them (edges), an
Eulerian Path traverses each edge once and only once.  If there is a
node with an odd number of edges (an 'odd' node), it must be either
the starting or ending point.  If there are two odd nodes, one must be
the starting point and the other the ending point.  If there are more
than two odd nodes, an Eulerian Path cannot be constructed.

[Not that it's important, but a path that touches each node once is
called a Hamiltonian Path.]

Understanding what an Eulerian Path is, being able to logically guess
SETL's syntax, and reading the commenting in the code (be sure to
thank the author for that) will give you a solid start on writing an
equivalent routine in any other language.

>    procedure prime_factors(n);            -- get tuple  of prime factors of

That's even easier.  A number's prime factors are the prime numbers
that will result in the original number when multiplied together .  I
seem to recall some code that does exactly that being posted here very
recently.  It's probably still in your newsfeed queue.


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

Date: Mon, 12 Mar 2001 21:40:32 GMT
From: avast@hortonsbay.com (Avast)
Subject: Re: Help to Install Perl
Message-Id: <3aad414e.4776465@news.mco.edu>

On Sat, 10 Mar 2001 07:43:54 GMT, "Suzanne" <dream1625@aol.com> wrote:

>hmmmm .... a classic case of top-posting obsession disorder ... relax Scott,
>take a deep breath ... seek a 12-step anti-top-posting support group, and
>when all else fails:
>Never sweat the petty things and
>Never pet the sweaty things!

As a long-time lurker I've found that elements of this newsgroup have
an extremely mean-spirited streak to them. The more you stick around
I'm sure you'll see what I mean.   I frequent other newsgroups, mostly
lurking for info and this particular newsgroup beats them all for
meaness and a slathering anality for their rules. They'll claim that
without these "rules" the group would descend into chaos.  Oh well.
They're also particularly anal about sticking to the topic at hand,
namely Perl, except for threads like this for which  they're more than
willing abandon their rules.  It's quite a hoot to watch them in their
red-faced, forehead vein-popping frenzies, doncha think?

Bob Dilworth
Toledo,  Ohio




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

Date: Mon, 12 Mar 2001 22:04:44 GMT
From: "Richard" <rworth5@home.com>
Subject: HTTP_WEFERER ????
Message-Id: <0Kbr6.3625$rB2.294785@news1.rdc1.mb.home.com>

Can anyone please tell me what HTTP_WEFERER is suppose to represent.

I try to use HTTP_REFERER and my results are displayed with HTTP_WEFERER.

Richard




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

Date: 12 Mar 2001 22:11:41 GMT
From: revjack <revjack@revjack.net>
Subject: Re: HTTP_WEFERER ????
Message-Id: <98jhit$8mk$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Richard <rworth5@home.com> wrote:
: Can anyone please tell me what HTTP_WEFERER is suppose to represent.

: I try to use HTTP_REFERER and my results are displayed with HTTP_WEFERER.

Is this a Fudd server?

-- 
___________________
revjack@revjack.net


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

Date: Mon, 12 Mar 2001 22:25:14 GMT
From: "S51" <sdfg@asd.g>
Subject: Re: HTTP_WEFERER ????
Message-Id: <e1cr6.78947$UZ4.19814863@news4.rdc1.on.home.com>

"Richard" <rworth5@home.com> wrote in message
news:0Kbr6.3625$rB2.294785@news1.rdc1.mb.home.com...
> Can anyone please tell me what HTTP_WEFERER is suppose to represent.
>
> I try to use HTTP_REFERER and my results are displayed with HTTP_WEFERER.

Fudd server, hehe, that's funny.

Seriously HTTP_REFERER is an environment variable accessable in perl by
using $ENV{HTTP_REFERER}. $ENV{HTTP_WEFERER} probably doesn't exist (unless
you create it). Since you gave zero info relating to how you use
HTTP_REFERER no one can help you.

Although it sounds to me like it's a spelling error. Search your script for
WEFERER to find the error, and change it to REFERER, and it will probably do
what you want.


LKembel




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

Date: Mon, 12 Mar 2001 22:31:32 GMT
From: "Richard" <rworth5@home.com>
Subject: Re: HTTP_WEFERER ????
Message-Id: <87cr6.3631$rB2.297441@news1.rdc1.mb.home.com>

OK, here is the simple little script I used to test it:

#!/usr/bin/perl

print "Content-type: text/html";

print  "<TT>\n";
foreach $key (sort keys(%ENV)) {
 print "$key = $ENV{$key}<p>";
}

And where the HTTP_REFERER is suppose to be I get HTTP_WEFERER.



"S51" <sdfg@asd.g> wrote in message
news:e1cr6.78947$UZ4.19814863@news4.rdc1.on.home.com...
> "Richard" <rworth5@home.com> wrote in message
> news:0Kbr6.3625$rB2.294785@news1.rdc1.mb.home.com...
> > Can anyone please tell me what HTTP_WEFERER is suppose to represent.
> >
> > I try to use HTTP_REFERER and my results are displayed with
HTTP_WEFERER.
>
> Fudd server, hehe, that's funny.
>
> Seriously HTTP_REFERER is an environment variable accessable in perl by
> using $ENV{HTTP_REFERER}. $ENV{HTTP_WEFERER} probably doesn't exist
(unless
> you create it). Since you gave zero info relating to how you use
> HTTP_REFERER no one can help you.
>
> Although it sounds to me like it's a spelling error. Search your script
for
> WEFERER to find the error, and change it to REFERER, and it will probably
do
> what you want.
>
>
> LKembel
>
>




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

Date: Mon, 12 Mar 2001 22:06:23 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Local and Global vairables(2)
Message-Id: <98jh6s$lar$1@news7.svr.pol.co.uk>

Hello

I am trying to extract a local variable within a given while loop. And use
this variable
within my second while loop.

example

while(<file1>)
{
$vairable 1
{

while (<file2>)

{
prinf(handle "$variable 1\n");
}


$vairable 1, whithin "while(<file1>)" is a variable being continuously
updated with data.

Thanking You
Kev





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

Date: Mon, 12 Mar 2001 22:31:17 GMT
From: "S51" <sdfg@asd.g>
Subject: Re: Local and Global vairables(2)
Message-Id: <V6cr6.78965$UZ4.19820723@news4.rdc1.on.home.com>

"Milliwave" <milliwave@rfengineering.freeserve.co.uk> wrote in message
news:98jh6s$lar$1@news7.svr.pol.co.uk...
> Hello
>
> I am trying to extract a local variable within a given while loop. And use
> this variable
> within my second while loop.
>
> example

my @vars;

 while(<file1>)
{
    push(@vars, $variable1);
}

my $i = 0;
while (<file2>)
{
    $i++;
    prinf(handle $vars[i]."\n");
}

I added each variable from file1 to an array, and each line in file2 will
use the next variable from the array. Maybe not what you want, but I don't
know much more about what you're trying to do. Check the length of the array
(scalar @vars) before you get the next value just to be safe.


LKembel




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

Date: Mon, 12 Mar 2001 20:14:43 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: local and global variables
Message-Id: <98jalg$11q$1@news6.svr.pol.co.uk>

Hello,

I have a perl program which is based around two seperate while loops. I
would like to
know why I am unable to excute the printf statement with the $c variable? At
present
when I execute the perl script, the last value of $c is printed. ($C = 20 30
40 50).The rest of the numerals like: 20 30 40 are ignored only the final
value is printed 50, in the "file". $d
is cycled through it's values without a problem. How can I solve the
problem? I thought
of writing $C into a array, would this be the best solution?

while(<file1>)
{
 $c
}
close handle1;

while(<file2>)
{
$d
prinft(file "$d $c"\n);
}
close handle 2;






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

Date: Mon, 12 Mar 2001 21:13:37 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: local and global variables
Message-Id: <slrn9aqevv.md2.tjla@thislove.dyndns.org>

I was shocked! How could Milliwave <milliwave@rfengineering.freeserve.co.uk>
say such a terrible thing:
>I have a perl program which is based around two seperate while loops. I
>would like to know why I am unable to excute the printf statement with
>the $c variable? At present when I execute the perl script, the last
>value of $c is printed. ($C = 20 30 40 50).The rest of the numerals
>like: 20 30 40 are ignored only the final value is printed 50, in the
>"file". $d is cycled through it's values without a problem. How can I
>solve the problem? I thought of writing $C into a array, would this be
>the best solution?
>
>while(<file1>)
>{
> $c
>}
>close handle1;
>
>while(<file2>)
>{
>$d
>prinft(file "$d $c"\n);
>}
>close handle 2;

I have no idea what you are talking about or what your code is trying to
do. Next time please post code that compiles and runs (unless your
question is "why doesn't this code compile?" This generally means
cutting and pasting from your existing code, not transcribing it.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
IDLENESS

n. A model farm where the devil experiments with seeds of new sins
and promotes the growth of staple vices.


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

Date: Mon, 12 Mar 2001 22:42:20 +0100
From: "Peter van den Hamer" <vdhamer@msn.com>
Subject: Re: Macbeth and Perl threads
Message-Id: <98jfpo$i2e$1@news.IAEhv.nl>

"Dan Sugalski" <dan@tuatha.sidhe.org> wrote in message news:%v8r6.28690

> Generally speaking:
>
> *) The underlying implementation won't have nearly so many race
conditions,
>    whoopses, and critical sections

That's inside Perl itself.

> *) Far less data will be shared by default

That's on the outside, I guess.

> *) Shared data access will probably be a touch more expensive, but since
>    there will be less of it, that won't be bad

That's on the outside, I guess.

> *) It'll probably look rather like what we have now to the average perl
>    programmer

That's definitely on the outside.

> *) It'll be easier for 3GL extensions to be thread-safe without much
>    trouble

That's inside Perl and CPAN modules.

From the above, am I right in concluding...
* you are going for interpreter threading
* meaning that variable names are roughly "thread-global"
* meaning that users normally needn't worry much about concurrency problems
* but requiring mail-boxes or IPC or whatever when you do want to exchange
data

> That's typical only on Windows--it's the default build that ActiveState
> uses. Necessary for the emulated fork(). It's not the default most other
> places because it puts some extra overhead into perl that you generally
> don't have any need for in normal perl usage.

Ah. That probably explains an extra source of confusion.

> > * there are a slew of alternative RFC's on threading for Perl 6
>
> There aren't that many. :-) Still, most of them won't go anywhere, since
> the proposals, while seemingly simple, would make things both slow and
> horribly complex under the hood.


But is there a user's view spec which can give me an idea what
it will look like? One of the RFCs, or does it mean that you guys
need to design the programming interface once more basic
language proposals are ironed out or get Larry's blessing?

Are threads a footnote in the big scheme of things or
one of the say top-5 Perl 6 innovations? I simply don't know...

The kind of answers I was curious about are
"will Perl 6 threads have a 'new Thread' interface?"
"how can a thread communicate back to the main thread if they don't share
data?"
"can multiple threads print to the same destination (log file in my
application ;-)?"

> And here's the promised signature:
>
>
> Dan
>
> --------------------------------------"it's like this"-------------------
> Dan Sugalski                          even samurai
> dan@sidhe.org                         have teddy bears and even
>                                       teddy bears get drunk

Not sure I can auction this on E-bay ;-)

Thanks for the info! If you answer the above questions,
I'll try not to bother you for a while ;-)

By the way my p-thread application is working pretty
much as intended. Only disappointment was that
Net::Ping turned out to be non-reentrant (the second
call reports timeout). Am thus currently using a lock
to create a critical section.

Peter van den Hamer
vdhamer@msn.com
http://www.iae.nl/users/vdhamer




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

Date: Mon, 12 Mar 2001 22:49:43 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Macbeth and Perl threads
Message-Id: <bocr6.28830$Ok4.2858083@news1.rdc1.ct.home.com>

Peter van den Hamer <vdhamer@msn.com> wrote:
> "Dan Sugalski" <dan@tuatha.sidhe.org> wrote in message news:%v8r6.28690

>> Generally speaking:

>> *) Far less data will be shared by default

> That's on the outside, I guess.

In that you'll need to explicitly share variables, yes.

>> *) Shared data access will probably be a touch more expensive, but since
>>    there will be less of it, that won't be bad

> That's on the outside, I guess.

Shared data's always on the outside, since your code needs to lock
shared stuff or face the potential of corrupt data. Perl can't,
unfortunately, do that for you. (It's a variant on the halting
problem, and if you can figure out a way to solve it I'd *really*
like to know...)

> From the above, am I right in concluding...
> * you are going for interpreter threading

More or less, yes. Or so is the current plan, at least.

Whether it's truly interpreter threading or not is still up in
the air--someone may come up with a Clever Idea and we could
do it more cheaply. That would be rather nice, but I'm not
sure it'll happen. Maybe.

> * meaning that variable names are roughly "thread-global"

That's the current plan, though plans are always subject to
change, especially for code that's not yet written.

> * meaning that users normally needn't worry much about concurrency problems

For non-shared data, no. If you're running multiple threads then there's
going to be some set of concurrency issues--you have to coordinate somehow.

> * but requiring mail-boxes or IPC or whatever when you do want to exchange
> data

Huh? No. Shared data is shared data. You access it like any other variable.
Perl will really use the underlying threading libraries. We'll probably
use the same threading primitves we've got now--queues and semaphores
and locks.

>> > * there are a slew of alternative RFC's on threading for Perl 6
>>
>> There aren't that many. :-) Still, most of them won't go anywhere, since
>> the proposals, while seemingly simple, would make things both slow and
>> horribly complex under the hood.


> But is there a user's view spec which can give me an idea what
> it will look like? One of the RFCs, or does it mean that you guys
> need to design the programming interface once more basic
> language proposals are ironed out or get Larry's blessing?

> Are threads a footnote in the big scheme of things or
> one of the say top-5 Perl 6 innovations? I simply don't know...

They'll be designed in from the beginning. They have to be,
otherwise we'll have the same mess we have now. As I rather like
threads, and am coordinating the internals design for perl 6,
it seems likely they'll be included. :)

> The kind of answers I was curious about are
> "will Perl 6 threads have a 'new Thread' interface?"

Dunno.

> "how can a thread communicate back to the main thread if they don't share
> data?"

They won't. If you don't share, you can't communicate.

> "can multiple threads print to the same destination (log file in my
> application ;-)?"

Yep.

					Dan


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

Date: Mon, 12 Mar 2001 22:12:55 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Objects in Perl
Message-Id: <taqif73qbuhs12@corp.supernews.com>

Jonathan Rew <jon_rew@learn-it.demon.co.uk> wrote:
> "Chris Stith" <mischief@velma.motion.net> wrote
>> Don't assume the object orientation is more efficient. It can be more
>> promgrammer efficient, but isn't always. It can be more running time

[snip]

>> The methodology and theory under which you choose to program should be
>> mostly decided by with what ideaology you are most comfortable. Second
>> to that, code reuse and maintenance time should be the improtant factors.

The methodology is important mainly in making the programmer more
efficient. OO, functional, procedural, logic, event triggered, and
other kinds of programming ideas can mostly be interchanged on some
level (although not always easily). It's how they deal with the
programmer that makes the biggest difference, and not how they deal
with the machine.

> Perhaps, I should explain where I'm coming from and what I'm hoping to do:
>     I learnt Perl from 'Learning Perl on Win32 Systems by Randall L.
> Schwartz, et al - O'Reilly, which largely uses the procedural/function based
> approach (in the CGI programming section it introduces references and OO
> programming);

I learned some Perl from that book myself. It is mostly functional/procedural.
It is also a very good book, and there's nothing wrong with functional or
procedural programming. It works. Some people prefer other methods. Some
people make much better use of object oriented programming than of functional.
This isn't about other people, though. This is about you programming. If you
wish to learn OO, then do so. There's no need to claim helplessness because
you only know one of the five or so major programming ideaologies. It would
help to know more than that, but it's not an absolute necessity.

>     I have a Website for which I have written some Perl programs to do
> various things (mainly, to search through a number of fairly large text
> files to find the user's input);
>     I am using Cascading Style Sheets on the rest of the site and want to be
> able to use them on the searching programs;
>     the examples given in CGI.pm, which offers some support for CSS, use
> references and I don't know anything about them;

That's why documentation exists. perldoc perlref is your friend in this
case. References do not preclude functional programming, either. Look at
a piece of C code without pointers or with pointers. It's functional (or
at least procedural -- C functions can return void) but it uses the addresses
of data elements for more powerful expression. References aren't the same
thing, but they serve similar purposes as C pointers.

>     as far as I am aware, I cannot use partly object oriented and partly
> procedural programming in the same program so if I want to incorporate css
> in my Perl programs, I am going to have to learn how to write OO programs in
> Perl

Then you haven't tried it. perl can do anything in any Perl program that
perl can do in any other. One of my favorite things about Perl is that
a functional person and an OO person can work together effectively. It's
nice to be able to write a straightforward functional main program that
calls subroutines which make use of neat OO stuff internally. Both methods
have their strengths and weaknesses, and Perl lets you choose which
strengths to use and which weaknesses to avoid within the same program.

Chris

-- 
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.



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

Date: Mon, 12 Mar 2001 22:30:07 -0000
From: Mark <mark_shutt@hotmail.com>
Subject: Re: Perl And CGI
Message-Id: <taqjff6jg6bsb2@corp.supernews.com>


Anonymous wrote:
> 
> 
> Hello Friends
> 
> Can any one help me how can i run perl And work with CGI on
> Windows 2000 (NT5) ?
    
     Have you tried goign to www.activeperl.com and installing the latest 
version of ActivePerl? I had IIS installed first and the installation 
added the .pl extension so the server would recognize perl scripts.
 
> Or Should i need a file and where can i get it ?


--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 12 Mar 2001 20:19:07 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Reading and writing files
Message-Id: <98jato$gdp$1@news7.svr.pol.co.uk>

Hello,

I have two separate files. "file1" having two columns of information while
"file 2" has another
4 columns of information. How can I combine all columns into a third file,
without disrupting
the tabular form?

col1   col 2  col3   col4   col 5   col6
1        45       4        44      33       33
2        56       5        40      32       11
3        45       4        34      23       23
4        23       3        43      11       66


Cheers
Kev





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

Date: Mon, 12 Mar 2001 14:06:54 -0600
From: Galen Menzel <galen.menzel@mail.utexas.edu>
Subject: Re: Removing spaces from a string.
Message-Id: <3AAD2C5E.3E1FA07E@mail.utexas.edu>

Tad McClellan wrote:
> 
> Galen Menzel <galen.menzel@mail.utexas.edu> wrote:
> >"R.J. Brown" wrote:
	(snip)
> 
>   That answers the question asked, but I think Galen asked the wrong
> question, based on the snipped part of the OP. ^^^^^^^^^^^

Do you mean R.J. Brown asked the wrong question?  Or I answered the wrong
question?

> Take care in phrasing your question, else you are likely to get
> an answer that you cannot use.

That's right!  I gives 'em what they asks fer!

galen


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

Date: 12 Mar 2001 17:17:25 -0400
From: * Tong * <sun_tong_001@yahoo.com>
Subject: Re: Tk based alarm clock
Message-Id: <sa8snkioffe.fsf@sun_tong_001.personal.yahoo.com>

"Donal K. Fellows" <fellowsd@cs.man.ac.uk> writes:

> Victor Wagner wrote:
> > By the way, it would require perl or Tcl interpreter to stay in memory
> > during all your login session, and this seems to much for just an alarm
> > clock.
> 
> It depends on whether you already have an interpreter already present.
> The overhead for a separate interpreter within an already-running
> process is pretty small...

Thanks, Donal. You've answered a question that I wanted to ask. :-)
Can you just explain a little bit on the term "already-running
process" please? 

Does it means within same shell, or same user or same X system...?

thanks

-- 
Tong (remove underscore(s) to reply)
  http://members.xoom.com/suntong001/
  - All free contribution & collection & music from the heavens


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

Date: Mon, 12 Mar 2001 22:42:45 GMT
From: "Bruce Koptionak" <xbwfo@home.com>
Subject: whats up
Message-Id: <Fhcr6.24891$o7.854447@news1.rdc1.sdca.home.com>






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

Date: Mon, 12 Mar 2001 22:15:06 +0100
From: Matthias Papesch <mpapesch@gmx.de>
Subject: XS: Accessing 'enum' constants
Message-Id: <98je77$ebl$05$1@news.t-online.com>

Hi,

I'm trying to create a PERL interface for a c-library and encountering a 
few problems.

Is there a way to access values of 'enums' from the .h file? I've been 
searching on the web but couldn't really find anything helpful.


TIA,
Matthias


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

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 V10 Issue 473
**************************************


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