[15749] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3162 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 25 14:05:47 2000

Date: Thu, 25 May 2000 11:05:20 -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: <959277920-v9-i3162@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 25 May 2000     Volume: 9 Number: 3162

Today's topics:
        Advantages of Perl over Cold Fusion? (Cory Phillips)
    Re: Array Question <lr@hpl.hp.com>
    Re: array within array revisited j555@my-deja.com
    Re: Can't Knit Two Files Together <lr@hpl.hp.com>
    Re: Can't Knit Two Files Together <lr@hpl.hp.com>
    Re: Can't Knit Two Files Together <lr@hpl.hp.com>
    Re: CGI browser detection <flavell@mail.cern.ch>
    Re: CGI browser detection nobull@mail.com
    Re: cgi name-value pairs , special characters <bill.kemp@wire2.com>
    Re: cgi name-value pairs , special characters <flavell@mail.cern.ch>
    Re: Compile Perl <liberalacasa@libero.it>
    Re: Directories created with the "nobody" username (Rafael Garcia-Suarez)
        Expressions amerar@my-deja.com
    Re: Expressions (Bart Lateur)
    Re: Expressions <red_orc@my-deja.com>
    Re: Finding IP addresses+ (Bart Lateur)
    Re: Finding IP addresses+ <andrew.mcguire@walgreens.com>
    Re: Finding IP addresses+ <lr@hpl.hp.com>
        Gloval variable <pagirre@ada.ucin.com>
    Re: Gloval variable (Rafael Garcia-Suarez)
        RE: Gloval variable <pagirre@ada.ucin.com>
    Re: How to read a float type data? <lr@hpl.hp.com>
        how to send fax? <oo@o.o>
    Re: how to send fax? <care227@attglobal.net>
    Re: how to stop strict from whining... <rootbeer@redcat.com>
        how to upload file not using browse button <w_jianminNOw_SPAM@hotmail.com.invalid>
    Re: how to upload file not using browse button <tony_curtis32@yahoo.com>
    Re: how to upload file not using browse button <w_jianminNOw_SPAM@hotmail.com.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 25 May 2000 15:38:13 GMT
From: cory-p@usa.net (Cory Phillips)
Subject: Advantages of Perl over Cold Fusion?
Message-Id: <392d387f.2190722@news.jsc.nasa.gov>

I have to write a justification to my employer to allow me to write a
web database application using Perl.

Can some of you help me come up with reasons why Perl would provide an
advantage besides the obvious cost?  The company is pretty set on
standardizing on Cold Fusion.

One advantage I've noticed is writing reusable code.  It's easier to
write Perl in a modular fashion using sub routines.  Cold Fusion
supports subroutines, but it's kind of clunky getting return values.
Also, subroutines can only exist in the same directory as the calling
routine or global directory designated by Cold Fusion (which is
controlled by the company's IT group and would be a pain to get them
to install global routines as needed).

This all on Windows NT.

Cory Phillips



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

Date: Thu, 25 May 2000 09:35:50 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Array Question
Message-Id: <MPG.1396f63cdb612b598aad6@nntp.hpl.hp.com>

In article <392d3d04.15249464@news.wanadoo.es> on Thu, 25 May 2000 
13:47:06 GMT, Lou Hevly <lou@visca.com> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> 
> >Any string can be used as a hash key.  In the hash-index context or on 
> >the left side of a =>, a string (bareword) that looks like an identifier 
> >will be auto-quoted.
> 
> I think this might need to be emmended to "an *ASCII* string that
> looks like an identifier". Even using locale, I've found that Perl
> won't auto-quote non-ASCII characters in hash keys:

I think it has nothing to do with auto-quoting of hash keys.  It has to 
do only with the definition of an 'identifier'.  Here's what perldata 
says:

  Usually this name is a single identifier, that is, a string beginning
  with a letter or underscore, and containing letters, underscores, and
  digits.

In that definition, it should be made explicit that the only 'letters' 
are the 52 alphabetical ASCII characters, regardless of locale.

I don't have any locale support, so I can't test this assertion.  But my 
assumption is that letters in identifiers must be ASCII (though if true, 
that might be considered a grievous limitation).

Perhaps you can tell us how this variation of your posted code behaves:

#!/usr/bin/perl -w
use strict;
use POSIX;
use locale;
POSIX::setlocale(POSIX::LC_ALL, "catalan");

my $València;


-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 May 2000 17:53:51 GMT
From: j555@my-deja.com
Subject: Re: array within array revisited
Message-Id: <8gjpb8$jbp$1@nnrp1.deja.com>

Hi folks,
Thanks for the replies. I haven't had time to sift through all of them.
Perhaps I should have stated my question more usefully as this:

How do I extract an array out of a reference to an array?
I went to the Perl docs but I still find it confusing. Unfortunately
I'm in a hurry and don't have time to read all the details.
I've had to implement a kludge in the meantime.
But the new question is, if I have this:

@foo[100] = (1,2,3,4);
or better yet...
$faa{"blah"} = (1,2,3,4);

How do I store the subarray back into another array so that I can
say

print @fee[3];

and have the number 4 printed?

Thanks!


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


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

Date: Thu, 25 May 2000 10:23:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Can't Knit Two Files Together
Message-Id: <MPG.1397014c5ee1164298aadb@nntp.hpl.hp.com>

In article <392C5F6E.5FCCBCBA@stomp.stomp.tokyo> on Wed, 24 May 2000 
16:02:06 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
> Larry Rosler wrote:
> 
> > Caveats for the unwary:
>  
> > Do not consider tests for failure to open files
> > to be optional.
> 
> Programmers may write any style of error
> checking which suits them. There is no
> rule nor reason why programmers must
> do it your way. You are not Perl God.
>  
> > Do not slurp entire files into arrays when line-at-a-time 
> > processing will suffice.
> 
> Really. Some tech articles disagree with this.
> Why not Mr. Rosler? You have offered no explanation.
> No comparisons.

Other posters have dealt with these two points quite adequately.  I 
think 'the unwary' have been enlightened.

> > Do not chomp the endings off lines if you are only 
> > going to put them back on immediately.
> 
> This destroys the output print. Bad mistake on your part.

This destroys your output print, not mine!  Bad mistake on your part.

Godzilla!:

  chomp (@Array_English);

  ...

    print "In English: $Array_English[$counter]\n";
    print OUT_FILE "$Array_English[$counter]\n";

Karate Kid I -- "Wax on, wax off!".
Godzilla!    -- "Newline off, newline on!"

Me, without chomp():

  while (<SAMFILE>) {
       my @sam = split /\|/, $_, 5;
       $sam[1] = $lang_var;
       chomp($sam[3] = <ENGFILE>); # This reads one line only.
       print OUT join '|' => @sam;
  }

The newline stays in the last element of @sam, and gets printed out from 
there.

You should learn how to read with comprehension!

> You should test code before making a critique, especially
> your own code Mr. Rosler. You would be surprised how much
> of your code you post, does not work correctly. I test it.
> You appear not to test at all or are oblivious to errors
> in your code.
> 
> Code I post _always_ does what I indicate it will do.
> I make it a point to test my code, exhaustively, before
> posting lest I post bad code and brag on it, then find
> I posted bad code, to my shame and embarrassment. Seems
> this recently happened with another "expert" here, who
> critiques others for not testing their code and, makes
> up lame excuses for his posting untested bad code.

I make no excuses for posting untested code.  When I fail to test (and 
omit to say so explicitly), I often regret it (one example from 
yesterday, caught by Abigail).  Perhaps needless to say, the code posted 
above was tested.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 May 2000 10:34:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Can't Knit Two Files Together
Message-Id: <MPG.139703f9240e296d98aadc@nntp.hpl.hp.com>

In article <8giivh$lvt$1@wanadoo.fr> on Thu, 25 May 2000 08:59:27 +0300, 
Elisa Roselli <e.roselli@volusoft.com> says...
> 
> Larry Rosler a écrit dans le message ...
> >Wow!  That word must be more common in French than in English.  First
> >time for me, and I thought I had a large vocabulary.  :-)
> 
> I think I misspelled it. : -[

It was spelled correctly the first time, wrong the second time.

 ...

> >chomp(my $lang_var = <STDIN>); # What's with the studlyCaps?
> 
> I don't like the underscore, as it's a non-significant extra character to
> type. Using a cap to separate the distinct words in a variable name is a
> habit I picked up in the Java community on a course last year. A matter of
> taste, I guess.

Anecdotally, it may be harder for non-native English speakers to deal 
with studlyCaps.  Some lazy programmers run words together without case 
distinction or underscore, which is easiest and by far the worst.

> >while (<SAMFILE>) {
> >     my @sam = split /\|/, $_, 5;
> >     $sam[1] = $lang_var;
> >     chomp($sam[3] = <ENGFILE>); # This reads one line only.
> >     print OUT join '|' => @sam;
> >}
> >
> >Bonne chance!
> 
> Oh grrrr! You make it look so easy! I've tried your solution and, in
> addition to shortening my program by half, it works.

Please tell that to Godzilla!  She accused me of not testing it.  :-)

>                                                      This has put me in a
> bad mood rather than a good, but don't worry, it has to do with my
> relationship to myself, not to you.
> 
> Thanks much for getting me out of the pea soup.

Oh, but may I have some of the pea soup for myself?  Let me tell you 
about the time that I had this wonderful potage des pois in the 
neighborhood bistro...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 May 2000 10:37:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Can't Knit Two Files Together
Message-Id: <MPG.139704b215198dcb98aadd@nntp.hpl.hp.com>

In article <392ef62a.5524905@news.skynet.be> on Thu, 25 May 2000 
09:58:38 GMT, Bart Lateur <bart.lateur@skynet.be> says...

 ...

> 	# prepare to format output:
> 	($\, $,) = ("\n", '|');
> 	select OUT;
> 
> And here we go!
> 
> 	while(<SAMFILE>) {
> 	    chomp;
> 	    my @data = split /\|/;
> 	    $data[1] = 'fr';
> 	    $data[3] = $translat{$data[3]} || do {
> 		warn "No translation for '$data[3]'";
> 	        $data[3];
> 	    }
> 	    print @data;
> 	}

Relative to my discussion with Godzilla!, note the unnecessary chomp(), 
repaired by the 'Lateur Idiom' on $\.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 May 2000 17:54:58 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI browser detection
Message-Id: <Pine.GHP.4.21.0005251740330.10338-100000@hpplus01.cern.ch>

On 25 May 2000, Andreas Kutschera wrote:

> >E.g. If I get a request from IE5 I'd like to return HTML
> >If I get a request from a WAP browser, I'd like to return WML.

> This is not a perl question, it's a CGI question.

No argument with that.

> As the CGI-Programmer's FAQ (http://www.webthing.com/tutorials/cgifaq.html)

Could you perhaps be referring to:

http://www.webthing.com/tutorials/cgifaq.3.html#6

> tells you, just use the Environment variable HTTP_USER_AGENT

I'd have to call that a misrepresentation: it actually tells you, as
its first priority:

 Why do you want to do this?

 Well-written HTML will display correctly in any browser, so the
 correct answer to this question is to design a template for your
 output in good HTML, and make sure your output is correct.

and lists various other deleterious consequences of attempting this
inferior solution.

OK, this might need further discussion in relation to the current
context, so I'll say more in a more appropriate place. I'm going to
take the liberty of setting f'ups to the CGI group.



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

Date: 25 May 2000 17:51:37 +0100
From: nobull@mail.com
Subject: Re: CGI browser detection
Message-Id: <u9r9aqpo86.fsf@wcl-l.bham.ac.uk>

tiddlerdeja@my-deja.com writes:

> I'd like to use Perl for a CGI script which would detect the type of
> browser a request has been made from and then return an apporpriate
> response.

Why?  What if you encounter a browser you've never heard of? Wouldn't
it be more logical to look at the type of response the request _said_
was preferred rather than trying to guess?

> If I get a request from a WAP browser, I'd like to return WML.

So is this WAP browser's request not stating that WML is preferred
over HTML?  I'd call that a broken WAP browser.

So a much better question (and one with more Perl content) is:

Q: Is there a Perl module to do HTTP content negotiation?

A: Yes, it's on CPAN.

Of course there's no need to use a CGI script for this at all if you
are returning static content - a modern HTTP server should do content
negotiation for you.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 25 May 2000 17:15:24 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: cgi name-value pairs , special characters
Message-Id: <959271419.18053.0.nnrp-07.c3ad6973@news.demon.co.uk>


Alan J. Flavell wrote in message ...
>On 25 May 2000, Eric Bohlman wrote:
>
>> : <a href="dd.pl?n=21&c=AIDS/HIV&s=c">.
>>
>> That's an invalid URL.  You need to escape the slash.  Use URI::Escape.
>
>It's also an invalid HREF attribute value.  You need to HTML-ify the
>ampersands.


hmm.
I've used stuff like this to make a link pass values as if it was a GET
form.
It seems to work fine, and looking at sites like www.heavens-above.com ,
they use similar things.

MSIE lets you get away with it so it must be right ...  (that's some sort of
joke by the way)




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

Date: Thu, 25 May 2000 18:56:14 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: cgi name-value pairs , special characters
Message-Id: <Pine.GHP.4.21.0005251844430.10338-100000@hpplus01.cern.ch>

On Thu, 25 May 2000, W Kemp wrote:

> It seems to work fine, 

Oh, please.  Do you _still_ not understand the difference between
"valid" and mere "seems to work"?

> and looking at sites like www.heavens-above.com ,
> they use similar things.

This misuse is widespread on the WWW.  It relies on the error fixup
that's recommended at "Notes on invalid documents":
http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.1

I've also encountered quite a number of cases where it failed (as
indeed it should) because of unintended clashes with HTML entity
names.  In one classic case, it was impossible to use the "send
comments to webmaster to report difficulties with this site" form.

The error fixup suggested in the HTML specification is:

 If [the user agent] encounters an undeclared entity, the entity
 should be treated as character data.

and this is indeed the usual action.  So far, so good.  But the spec
ALSO says:

 users must not rely on specific error recovery behavior.
       ^^^^^^^^

so as an author, the HTML specification forbids you to take advantage
of this.  And it's pointless and wrong anyway.  Just because it's
widespread doesn't mean it's right.  Shoplifting is also widespread,
I'm told.

Please check your facts before contradicting people who are doing
their best to help others from violating the interworking standards.

As you'd expect, I have a web page on this topic
http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html



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

Date: Thu, 25 May 2000 15:41:37 GMT
From: "Ezio BOnsi" <liberalacasa@libero.it>
Subject: Re: Compile Perl
Message-Id: <RQbX4.46203$EY1.517766@news.infostrada.it>


Davide Locci <dlocci@tiscali.it> wrote in message
8gila6$13g$1@lacerta.tiscalinet.it...
> Hi,
>
> I would like to know if it is possible to create EXE file from Perl. If it
> is possible where i ca fine the builder?
>
> thanks Davide
>
> --
>
> -------------
> Davide Locci
> Tiscali SpA
> VOLTrade System Administrator
>
>

http://www.activestate.com/Products/Perl_Dev_Kit/index.html
ActiveState PerlApp!

Ciao!
Ezio BOnsi




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

Date: Thu, 25 May 2000 16:09:33 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Directories created with the "nobody" username
Message-Id: <slrn8iqk86.dbe.garcia_suarez@rafael.kazibao.net>

Norm wrote in comp.lang.perl.misc:
>I have a script that creates directories for a web base application as
>needed.
>
>The problem is that those newly created directories get the username and
>group name "nobody".
>
>When I try to access information contained in those "nobody" directories
>from a web browser it cannot be accessed or in some occasions I get a server
>error.

It seems that your script that creates directories runs from a crontab
or whatever, and with user id 'nobody' ; and that your CGI scripts
run with another user id that cannot read or write those directories.
(am I getting it right? if not, please post a more accurate description
of your problem.)

Make the script that creates directory run under the same user id that
the web server, and ensure that its umask is 022 (this should be the
default). This should solve your problem.

If your web server is apache, you can find under which user id it runs
in the httpd.conf configuration file.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 25 May 2000 16:13:08 GMT
From: amerar@my-deja.com
Subject: Expressions
Message-Id: <8gjje2$end$1@nnrp1.deja.com>




Hello,

I have a regular expression in this case:

$data =~ /($yearCP\d{6})/i

However, $year is a variable, which is followed in this case by the
letters CP.......but I have about 30 of these letter combinations.

How do I tell it that $year is not $yearCP?    It is not seperating the
two strings........

Please CC a copy to:  amerar@ci.chi.il.us

Thanks,

Arthur
amerar@ci.chi.il.us


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


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

Date: Thu, 25 May 2000 16:30:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Expressions
Message-Id: <39365509.19811172@news.skynet.be>

amerar@my-deja.com wrote:

>$data =~ /($yearCP\d{6})/i
>
>However, $year is a variable, which is followed in this case by the
>letters CP.......but I have about 30 of these letter combinations.
>
>How do I tell it that $year is not $yearCP?    It is not seperating the
>two strings........

	/(${year}CP\d{6})/i

-- 
	Bart.


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

Date: Thu, 25 May 2000 16:52:27 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Expressions
Message-Id: <8gjlo4$gh7$1@nnrp1.deja.com>

In article <8gjje2$end$1@nnrp1.deja.com>,
  amerar@my-deja.com wrote:
>
>
> Hello,
>
> I have a regular expression in this case:
>
> $data =~ /($yearCP\d{6})/i
>
> However, $year is a variable, which is followed in this case by the
> letters CP.......but I have about 30 of these letter combinations.
>
> How do I tell it that $year is not $yearCP?    It is not seperating
the
> two strings........
>

probably not what you would like, but you could do

$year .= 'CP';
$data =~ /($year\d{6})/i
$year = substr($year, 0, length($year)-2);


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


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

Date: Thu, 25 May 2000 16:06:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Finding IP addresses+
Message-Id: <3934493b.16789858@news.skynet.be>

Andrew N. McGuire  wrote:

>Huh?  3427256387 in hex is 0xcc47c843!!!
>This will do the job:
>
>#!/usr/bin/perl -w
>use strict;
>
>my $dec_addr = 3427256387;
>my $addr = pack('i10', $dec_addr);
>my @octets = unpack('C4', $addr);
>print +join('.', reverse(@octets)), "\n";

Ooh that looks complicated. What's that 'i10'? And "reverse"!?!
How about a simple 'N'? 

  my $dec_addr = 3427256387;
  print join '.', unpack 'C4', pack 'N', $dec_addr;
-->
  204.71.200.67

As for the original suggestion:

  my $dec_addr = 3427256387;
  print join '.', map hex, sprintf('%08X', $dec_addr) =~ /../g;
-->
  204.71.200.67

-- 
	Bart.


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

Date: Thu, 25 May 2000 11:18:32 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: Finding IP addresses+
Message-Id: <Pine.GSO.4.21.0005251113240.7198-100000@sputnik.corp.walgreens.com>

On 25 May 2000, Dave Vandervies wrote:

+ In article <Pine.LNX.4.21.0005242203450.22671-100000@hawk.ce.mediaone.net>,
+ Andrew N. McGuire  <anmcguire@ce.mediaone.net> wrote:
+ >On 24 May 2000, Dave Vandervies wrote:
+ >
+ >+ In article <8ghjgl$k4l$1@spinner.corpeast.baynetworks.com>,
+ >+ Brandon Metcalf <bmetcalf@baynetworks.com> wrote:
+ >+ > > I can generally find something interesting at this URL, although some
+ >+ > > browsers don't work properly with it.
+ >+ > > 
+ >+ > >     http://3427256387/
+ >+ >
+ >+ >I tried searching a few places but didn't come up with anything.  How
+ >+ >do these purely numerical addresses translate to the octet addresses?
+ >+ 
+ >+ Write it in hex, and then just put dots between the octets.  Converting
+ >+ the individual octets from hex back to decimal might make it easier to
+ >+ recognize.
+ >
+ >Huh?  3427256387 in hex is 0xcc47c843!!!
+ 
+ Write in hex:
+ cc47c843
+ 
+ Put dots between the octets:
+ cc.47.c8.43
+ 
+ Convert the individual octets back to decimal to aid recognition:
+ 204.71.200.67
+ 
+ >This will do the job:
+ >
+ <perl script snipped>
+ >
+ >Outputs:
+ >
+ >204.71.200.67
+ 
+ Looks the same to me.

Ah, OK, I see what you mean, sorry your wording lost me,
as there are no real 'octets' in an hex number.  But yes
I suppose you could use binary/hex etc.  I initially used
binary, becuase I can 'think' better in binary than I can
hex.  I know that is backwards, but its true.

Regards,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| andrew.mcguire@walgreens.com                           |
`-------------------------------------------------------*/



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

Date: Thu, 25 May 2000 09:52:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Finding IP addresses+
Message-Id: <MPG.1396fa26554e8a5098aad7@nntp.hpl.hp.com>

In article <8ghclc$81n$2@news.panix.com> on 24 May 2000 20:05:00 GMT, 
Abigail <abigail@arena-i.com> says...
> On Wed, 24 May 2000 11:58:00 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> ++ In article <Pine.GSO.4.10.10005240846240.23375-
> ++ 100000@user2.teleport.com> on Wed, 24 May 2000 09:08:09 -0700, Tom 
> ++ Phoenix <rootbeer@redcat.com> says...
> ++ 
> ++>perl -MSocket -lwe 'print +(gethostbyaddr inet_aton(3427256387), AF_INET)[0]'
> ++ 
> ++ Mini-crusade, probably doomed ab initio:
> ++ 
> ++ When the one-liner Perl command doesn't include shell metacharacters, 
> ++ why not use double-quotes instead of single-quotes, for portability to 
> ++ DOS shells, as I did in my example above?  It makes it easier to copy-
> ++ and-paste, instead of having to edit the quotes.
> 
> That would require to know what the all the different shell
> metacharacters are, from all different shells, and in which
> circumstances they are meta or not. In the one-liner above, () and []
> are, under the appropriate conditions, shell meta characters.

Are these the appropriate conditions?  I am referring only to what 
characters are 'meta' within double-quotes.  According to sh-posix(1),

  Inside double quote marks (""), parameter and command substitution
  occurs and \ quotes the characters \, `, ", and $.

That is a limited set of metacharacters indeed!  The only significant 
one is '$', and note that there are no Perl scalars in the expression I 
was referring to.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 May 2000 17:57:55 +0200
From: "Pablo Agirre" <pagirre@ada.ucin.com>
Subject: Gloval variable
Message-Id: <8gjivu$rg$1@reader1.fr.uu.net>

    I use a  perl script that reads from a file a number of text lines with
the typical "open ....   @var = <FILE>  .... close" routine.

    As it is a fixed file text and the script is run by every client, I
would like to share the @var by al clients.

    So read the file once at startup and modify perl script from clients to
use the already allocated @var.

    How can I access the @var from the client perl program ?
    If two clients access to the variable to make a search line by line each
one will run the loop from the first line to the end (eg: while ($line =
<FILE>) { ... =>  while ($line = @var) {  ) ?
    Do I have to make a .pm an load it at startup ?    How ?

    Solutions ?  I don't know too much about Perol, so please a couple of
lines of example will help.

    Thanks !!!!!!!!!





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

Date: Thu, 25 May 2000 16:19:28 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: Gloval variable
Message-Id: <slrn8iqkqp.dbe.garcia_suarez@rafael.kazibao.net>

Pablo Agirre wrote in comp.lang.perl.misc:
>    I use a  perl script that reads from a file a number of text lines with
>the typical "open ....   @var = <FILE>  .... close" routine.

Typical but erroneous. If your file is big, your script may experience
memory problems!

>    As it is a fixed file text and the script is run by every client, I
>would like to share the @var by al clients.

You can't share a variable between processes.

>    So read the file once at startup and modify perl script from clients to
>use the already allocated @var.

If you're speaking about a CGI script, you may want to take an in-depth
look at mod_perl. But that's a sophisticated solution.

Alternatively, you can also translate your file to perl code, like this:
  my @lines = (
  "first line of data\n",
  "second line of data\n",
  #etc...
  );
then, put this statement in a file data.lib, and
  require '/path/to/data.lib';
in your perl script.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 25 May 2000 18:40:36 +0200
From: "Pablo Agirre" <pagirre@ada.ucin.com>
Subject: RE: Gloval variable
Message-Id: <8gjlfv$2rc$1@reader1.fr.uu.net>

    I Think mod_perl is the solution to share global variables, but I don't
know how to create the .pm file and make Apache load it at startup.   And
finally how to access to that variable from client processes.


"Rafael Garcia-Suarez" <garcia_suarez@hotmail.com> escribió en el mensaje
news:slrn8iqkqp.dbe.garcia_suarez@rafael.kazibao.net...
> Pablo Agirre wrote in comp.lang.perl.misc:
> >    I use a  perl script that reads from a file a number of text lines
with
> >the typical "open ....   @var = <FILE>  .... close" routine.
>
> Typical but erroneous. If your file is big, your script may experience
> memory problems!
>
> >    As it is a fixed file text and the script is run by every client, I
> >would like to share the @var by al clients.
>
> You can't share a variable between processes.
>
> >    So read the file once at startup and modify perl script from clients
to
> >use the already allocated @var.
>
> If you're speaking about a CGI script, you may want to take an in-depth
> look at mod_perl. But that's a sophisticated solution.
>
> Alternatively, you can also translate your file to perl code, like this:
>   my @lines = (
>   "first line of data\n",
>   "second line of data\n",
>   #etc...
>   );
> then, put this statement in a file data.lib, and
>   require '/path/to/data.lib';
> in your perl script.
>
> --
> Rafael Garcia-Suarez




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

Date: Thu, 25 May 2000 09:56:01 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to read a float type data?
Message-Id: <MPG.1396fafd7e19e87b98aad8@nntp.hpl.hp.com>

In article <392cf346.4784187@news.skynet.be> on Thu, 25 May 2000 
09:58:25 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> Jian Lin wrote:
> 
> >How can I read a float type data from a text file using Perl script.
> >For example, a text file contains three data: 129  3.44 7.5
> >I want to read the third data(7.5)
> >Is it possible to convert the ASCII code(7.5) into a float type variable ?
> 
> It's not only possible, it's even trivial. Perl will convert the string
> into a number, all you have to do is USE the string as a number.
> 
> Example:
> 
> 	print "12" + "34";
> 
> This prints 46, not 1234.

OK with '+' and other arithmetic operators.  Don't assume that it works 
the same way with bit-manipulation operators '&' '|' or '^', though.

:-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 26 May 2000 00:41:26 +0800
From: oo <oo@o.o>
Subject: how to send fax?
Message-Id: <392D57B6.D35FF14E@o.o>

i remember it is likely to sendmail
tel_num@???.???

????  :>



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

Date: Thu, 25 May 2000 13:46:42 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: how to send fax?
Message-Id: <392D6702.8B4BCF75@attglobal.net>

oo wrote:
> 
> i remember it is likely to sendmail
> tel_num@???.???
> 
> ????  :>

Thats up to the fax system/server you are sending to.  That 
software would describe how you send to it in order for the
fax to be processed.  In any evern, this is not a Perl question.


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

Date: Thu, 25 May 2000 10:25:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: how to stop strict from whining...
Message-Id: <Pine.GSO.4.10.10005251022090.14618-100000@user2.teleport.com>

On Thu, 25 May 2000, peter wrote:

> hmmm,  it turns out to be an ibm module.  do you know who to contact at ibm?

If the module doesn't include a contact address for the author (or
maintainer), then it's a bad module. Bad module! Bad! :-)

> maybe i can convince my admin to change the one i have as it is r--r--r--

Or you can install your own (modified) copy in some other directory, then
use the lib.pm pragma to tell perl to use that directory in preference to
the original. See 'perldoc lib' for more information on how it works.

Cheers!

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



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

Date: Thu, 25 May 2000 11:43:25 -0700
From: WWW <w_jianminNOw_SPAM@hotmail.com.invalid>
Subject: how to upload file not using browse button
Message-Id: <01c06628.15ee4e04@usw-ex0107-049.remarq.com>

I am on a project in which I use a client control to generate a file
on the client computer. I want to upload this file to the server,
but I don't want the client use the browse button to choose
which file to upload. I know in NT server IIS can buy SA-fileup
control do that. But I am using APACHE server. Can somebody
help me?

Thanks in advance.

WWW


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 25 May 2000 12:22:23 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: how to upload file not using browse button
Message-Id: <87aeher1dc.fsf@limey.hpcc.uh.edu>

>> On Thu, 25 May 2000 11:43:25 -0700,
>> WWW <w_jianminNOw_SPAM@hotmail.com.invalid> said:

> I am on a project in which I use a client control to
> generate a file on the client computer. I want to upload
> this file to the server, but I don't want the client use
> the browse button to choose which file to upload. I know
> in NT server IIS can buy SA-fileup control do that. But
> I am using APACHE server. Can somebody help me?

Why are you asking this in a perl newsgroup?

<mutter mutter...>


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

Date: Thu, 25 May 2000 12:21:43 -0700
From: WWW <w_jianminNOw_SPAM@hotmail.com.invalid>
Subject: Re: how to upload file not using browse button
Message-Id: <059e78c8.1feaf02c@usw-ex0107-049.remarq.com>

I should using Perl to achieve this kind of file upload.
I found many discussion about file upload using
browse button, but I don't find one not using it.
is it impossible for writing perl module
to achieve this?

Maybe I did not express clearly before. If
not post in perl discussion group, where do
you think I should post on?


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

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


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