[11080] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4679 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 18 14:05:04 1999

Date: Mon, 18 Jan 99 11:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 18 Jan 1999     Volume: 8 Number: 4679

Today's topics:
    Re: == and = , again (Christian M. Aranda)
    Re: == and = , again (Abigail)
        [Q]multiple selection option on cgi script. <factory@factory.co.kr>
    Re: A plea for less goofy signature files! (Abigail)
    Re: append to beginning of file (Abigail)
    Re: Array slices with a maximum length (Sean McAfee)
    Re: Array slices with a maximum length <uri@home.sysarch.com>
    Re: Array slices with a maximum length (Abigail)
        Calculate next [mon..sun]day marcel_anthonijsz@my-dejanews.com
    Re: calling a script (Tad McClellan)
    Re: calling a script (Abigail)
        CGI PROBLEMS? www.cgi-resources.com <spam@dikkelul.com>
    Re: Comments on my new site, please! (Abigail)
        Counting child processes? (Perl signal trapping apparen <orava@termiitti.akumiitti.fi>
    Re: determine, if file is directory (Randal L. Schwartz)
    Re: determine, if file is directory (Abigail)
    Re: Downloading, Perl, Navigator, and file names (Abigail)
        Endian converter: Does anyone know of one? krish_v@my-dejanews.com
    Re: File Upload. (Abigail)
        Find DOS backslashes <bond@ei.kodak.com>
    Re: glob error (Matthew Bafford)
    Re: Help with a TLD search program (Abigail)
    Re: HELP: Netscape 4.5 doesn't like text/html header fr (Abigail)
    Re: Is perl the right choise for the following job? <jc@uwm-dev.gte.com>
    Re: looking for serial to socket program (Bbirthisel)
    Re: MacPerl: deleting a file (Rich Morin)
    Re: Memory management using reference (Larry Rosler)
    Re: Memory management using reference (Tad McClellan)
    Re: Number found where operator expected (Newbie) (M.J.T. Guy)
        Odering an Array cbleask@olemiss.edu
    Re: Out of Memory (Christian M. Aranda)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 18 Jan 1999 17:52:37 GMT
From: christian.arandaNOSPAM@NOSPAMiiginc.com (Christian M. Aranda)
Subject: Re: == and = , again
Message-Id: <77vrte$eko$2@news-2.news.gte.net>

On 17 Jan 1999 21:53:39 GMT, meowing@banet.net (Fluffy) wrote:

>Jim and Paula <gemhound@gemhound.com> wrote:
>> Or something else.  Anything but = and == which just seem to get
>> mistyped all the time.
>
>If you really, really want that, you could use the -P switch to drop in
>some macros.
>
>#define assign(a,b) b = a
>#define define(a,b) a = b
>#define becomes =
>#define equals ==


I know that I could use benchmark, but just in general how much slower
would it be defining them?




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

Date: 18 Jan 1999 17:05:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: == and = , again
Message-Id: <77vpkd$e8l$1@client2.news.psi.net>

Jim and Paula (gemhound@gemhound.com) wrote on MCMLXV September MCMXCIII
in <URL:news:36a23df0.18800938@news.primeline.com>:
@@ Whilst learning Perl I am making the usual dumb substitutions of  =
@@ for == and vice versa.   Getting infinite loops when I substitute a
@@ loopvar instead of testing it.  What annoys me is that I've done this
@@ in other languages and still do, and I know other folks, even
@@ experienced ones, do it all the time.  It seem such an obtuse usage
@@ that I'm surprised Perl, which is so practical, doesn't have synonyms.
@@ I know they hate to expand reserved words, but it would be nice to
@@ have  "equals" for  = ,  and "becomes"  for  == 

= and == are well known. Not just in Perl, but also in C. There's no
chance this will ever change. In stead of trying to modify existing
operators, why not use the -w switch?

@@ Or since the comparison and assignment operators are different, they
@@ shouldn't use the identical symbol, only repeated.  Hey, could you
@@ append a letter?  How about  =s as a synonym?

So, . and .. should disappear as well? || and && too? -- and ++? //? **?

@@ Or something else.  Anything but = and == which just seem to get
@@ mistyped all the time.

-w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w -w



Abigail


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

Date: Tue, 19 Jan 1999 15:17:38 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: [Q]multiple selection option on cgi script.
Message-Id: <77vus5$m2m$1@news.kornet.nm.kr>

[Q]multiple selection option on cgi script.

* Under unix server.
* This cgi is for free homepage building script for my site visitors who
want to build their homepage in my site.
* I am modifing ezhomepg.pl found at manny juan's script page.
"inet-images.com/manny/"



Question A>
1. I put following selectoption in 000.pl
print "Want to save my html file under directory name <select multiple
name="category"><option> D_1 <option> D_2 <option> D_3</select>\n";

2. When 000.pl file run by pre.html, I see this selct option on 000.pl at
the browser,(done by myself)


3. [Question point]= The selected option value should be printed at
output.html.
ex) Want to save my html file under directory name "D_2".........
However it does not. How can I modify the 000.pl ?

#!/usr/local/bin/perl
print "Content-type:text/html\n\n";

??????????

print "</html>";
exit;


Question B> One more, If you know, please answer me this question also.

5. This output.html file made and saved on my server as different file name
according to each visitor wants.
?9) If the visitor's name is "abc", the otput.html file name is "abc.html".
(done)
However, output.html file <(ex)abc.html> is saved in only one directory.

6. [Question point]= Is there a solution that the output.html <(ex)abc.html>
will be saved at the directory <(ex), D_2> which visitor selected ?

Thank you for your help.





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

Date: 18 Jan 1999 17:16:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: A plea for less goofy signature files!
Message-Id: <77vqa9$e8l$2@client2.news.psi.net>

Phlip (new_email@see.web.page) wrote on MCMLXIV September MCMXCIII in
<URL:news:77qo3u$lq7@journal.concentric.net>:
"" Newsgroupies
"" 
"" Perl users, for some reason moreso than for other languages, like to
"" invent strings of nonsense that vaguely resemble source code and put
"" them in their signature files, like this:

It is source code, and usually they do run.

""  (open 0),$_=<0>,s,.*-+ ,,,chop;for(split?@*?){($$_++or$}=$_,y,
""  y \,y,<STDIN>,,eval"sub $_ {print'$}'}"),y,} \,},>STDOUT,,&$_}
"" 
"" That practice is not in the Open Source Software movement's best
"" interests.

Eh? If sigs can hurt them, what's the value of the Open Source Software
movement? Not much I guess...

"" "The Cause" - beating the commercial idiots at their own game, in
"" our spare time, and for free - depends on the QA format of public
"" fora to answer questions which are then warehoused; in DejaNews or
"" in each list server's archives. But signature files like this jam
"" the search engines with smug false hits!


I guess you just jammed the searchengines with a false hit on 
"Open Source Software". And my reply generates another one! Oh boy!
A false hit. The end of the world is near!


Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\\\- -eJust -eanother -ePerl -eHacker -e\\\\-]}-


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

Date: 18 Jan 1999 17:38:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: append to beginning of file
Message-Id: <77vrip$eh7$1@client2.news.psi.net>

Ronnie D. Jewell (jewell@OnlineRAGE.com) wrote on MCMLXVI September
MCMXCIII in <URL:news:36A2A7DF.385CD0EB@OnlineRAGE.com>:
[] I need to open a file and write my new line to the beginning of the file
[] rather than append to the end....

FAQ



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\\\- -eJust -eanother -ePerl -eHacker -e\\\\-]}-


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

Date: Mon, 18 Jan 1999 16:01:12 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Array slices with a maximum length
Message-Id: <cVIo2.2704$Ge3.12274312@news.itd.umich.edu>

In article <36a51f0f.14446648@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Situation: I have a CGI search engine, where the results are stored into
>an array. I only include part of this result at a time, e.g. at most 10
>results. That is pretty common, I think. ;-)

>But, I've bumped into a little Perl probelm. I'm not pleased with my
>solution. Are there better alternatives?

>Example source:
>    @result = ('A' .. 'Z');        # 26 entries
>    $slice = 10;         # 10 at a time
>    $page = 2;        # start at 20
>    @slice = @result[$page*$slice .. ($page+1)*$slice-1];

>The problem is that once you get past the end of the original array, you
>get extra undefined values as fills at the end of the array. Try:
[snip]

>Are there better alternatives, i.e. one where the undefined fill values
>are simply not generated? (Note that @result needn't even be an array:
>it could be a function returning an array, too.)

Something like this will work:

sub min { $_[0] < $_[1] ? $_[0] : $_[1] }
@slice = @result[$page*$slice .. min(($page+1)*$slice-1, $#result)];

Alternately, you could handle the extra undefined values in the part of
your code that prints the search results:

$offset = $page * $slice;
for ($i = 0; $i < $slice; $i++) {
    last unless defined $slice[$offset + $i];
    print "<li>$slice[$offset+$i]\n";  # or whatever
}

I suppose that the first solution I gave is safer, though.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: 18 Jan 1999 12:48:17 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Array slices with a maximum length
Message-Id: <x7g198fp5q.fsf@home.sysarch.com>

>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:

  BL> 	@result = ('A' .. 'Z');		# 26 entries
  BL> 	$slice = 10; 		# 10 at a time
  BL> 	$page = 2;		# start at 20
  BL> 	@slice = @result[$page*$slice .. ($page+1)*$slice-1];

just make the second arg of .. $#result!

or do a min of $#result and ($page+1)*$slice-1

$last = ($page+1)*$slice-1 ;
$last = $#result if $last > $#result ;

@slice = @result[$page*$slice .. $last];

  BL> The problem is that once you get past the end of the original array, you
  BL> get extra undefined values as fills at the end of the array. Try:

  BL> 	print "\[@slice\]\n";

  BL> under -w, and you'll see what I mean.

this seems to be a bug in 5.004_04. under 5.005_02 i get the right
number of warnings.

uri

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


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

Date: 18 Jan 1999 17:44:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Array slices with a maximum length
Message-Id: <77vrt1$eh7$2@client2.news.psi.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MCMLXVI September MCMXCIII
in <URL:news:36a51f0f.14446648@news.skynet.be>:
|| Situation: I have a CGI search engine, where the results are stored into
|| an array. I only include part of this result at a time, e.g. at most 10
|| results. That is pretty common, I think. ;-)
|| 
|| But, I've bumped into a little Perl probelm. I'm not pleased with my
|| solution. Are there better alternatives?
|| 
|| Example source:
|| 
|| 	@result = ('A' .. 'Z');		# 26 entries
|| 	$slice = 10; 		# 10 at a time
|| 	$page = 2;		# start at 20
|| 	@slice = @result[$page*$slice .. ($page+1)*$slice-1];
|| 
|| The problem is that once you get past the end of the original array, you
|| get extra undefined values as fills at the end of the array. Try:
|| 
|| 	print "\[@slice\]\n";
|| 
|| under -w, and you'll see what I mean.
|| 
|| My current solution is an additional grep:
|| 
|| 	@slice = grep { defined } 
|| 		@result[$page*$slice .. ($page+1)*$slice-1];
|| 
|| Are there better alternatives, i.e. one where the undefined fill values
|| are simply not generated? (Note that @result needn't even be an array:
|| it could be a function returning an array, too.)

my $begin =  $page  * $slice;
my $end   =  $begin + $slice;

my @slice =  @result [$begin .. ($end < @result ? $end : @result) - 1];



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: Mon, 18 Jan 1999 17:02:24 GMT
From: marcel_anthonijsz@my-dejanews.com
Subject: Calculate next [mon..sun]day
Message-Id: <77vpeo$un8$1@nnrp1.dejanews.com>

Hi,

I want to calculate the date of next [mon..sun]day, what is the easiest and
most nice way to do this? It should work after the year 0 .. (Hey, my brain
has a Y2K bug!).

Thanks,

Marcel

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


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

Date: Mon, 18 Jan 1999 11:46:13 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: calling a script
Message-Id: <51sv77.qq7.ln@magna.metronet.com>

olivier.blanchard@geis.ge.com wrote:

: I have a problem : I want to call a script (B.pl) from another one (A.pl), I


   @out_from_B = qx/B.pl arg1 arg2/;


:  in A.pl I coded do B.pl so it worked fine unless I want some arguments to be
: passed to B.pl then I did : do B.pl arg1 arg2 ....  and the script B.pl is not
: running, why?


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


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

Date: 18 Jan 1999 17:45:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: calling a script
Message-Id: <77vruu$eh7$3@client2.news.psi.net>

olivier.blanchard@geis.ge.com (olivier.blanchard@geis.ge.com) wrote on
MCMLXVI September MCMXCIII in <URL:news:77vibj$oc8$1@nnrp1.dejanews.com>:
^^ Hello everybody,
^^ 
^^ I have a problem : I want to call a script (B.pl) from another one (A.pl), I
^^ tried this :
^^  in A.pl I coded do B.pl so it worked fine unless I want some arguments to be
^^ passed to B.pl then I did : do B.pl arg1 arg2 ....  and the script B.pl is not
^^ running, why?


You don't understand "do".

You don't want do anyway. Read about system and ``.



Abigail
-- 
perl -wlpe '}$_=$.;{' file  # Count the number of lines.


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

Date: Mon, 18 Jan 1999 17:50:48 +0100
From: "Willem" <spam@dikkelul.com>
Subject: CGI PROBLEMS? www.cgi-resources.com
Message-Id: <77vovn$4vu$1@dinkel.civ.utwente.nl>






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

Date: 18 Jan 1999 17:47:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Comments on my new site, please!
Message-Id: <77vs2q$eh7$4@client2.news.psi.net>

fw13@my-dejanews.com (fw13@my-dejanews.com) wrote on MCMLXV September
MCMXCIII in <URL:news:77tg0j$1sh$1@nnrp1.dejanews.com>:
## I am a novice in website construction. And we appreciate comment on our
## site at http://xxxx.xxxxxx.xxx/xxxxxxx/xxxxx.xxxx


Go away.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Mon, 18 Jan 1999 16:50:33 GMT
From: Petri Wessman <orava@termiitti.akumiitti.fi>
Subject: Counting child processes? (Perl signal trapping apparently broken)
Message-Id: <7xww2ky17y.fsf@termiitti.akumiitti.fi>

Hello all, I'm in need of some good ideas. What I want to do is to
have a forking server count its subprocesses (for load control
reasons). Now, the obvious way to do this would be to trap SIGCHLD and
update a counter in the main process. The problem is that this doesn't
work reliably. Due to the buggy way that Perl signal trapping is
apparently implemented, doing this in a server which forks a lot of
processes (around 3/second) manages to corrupt the Perl memory space
in non-deterministic ways, resulting in nasty bugs. Apparently the
signal catching code is not protected against a signal being caught
while the previous one was still being processed. Or something like
that. I last investigated this problem something like six months ago,
and at the time the info I got from the Net was that Perl signal
trapping "has problems and is not 100% reliable".

Now the whole thing has become acute again, and I'd like some ideas
about the whole problem. Is the signal trapping bug fixed in some
version of Perl, or is there any way of trapping signals and updating
a counter in a 100% safe way?

If not, any ideas on how to implement a safe and efficient child
process counter? Does System V IPC work reliably with Perl?

Any and all help appreciated.

P.S. This is under HPUX, in case it matters.

//Petri


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

Date: 18 Jan 1999 09:17:27 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: determine, if file is directory
Message-Id: <m11zksqz4o.fsf@halfdome.holdit.com>

>>>>> "Patrick" == Patrick Clauberg <pat@uni.de> writes:

Patrick> sub rekurdir {
[typical bad reimplementation of File::Find deleted]

Patrick> so maybe there is a smarter way to do this.

Yes.  Stop reinventing File::Find.  It's in your standard library.
"perldoc File::Find", now before you lose too much more sleep.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 18 Jan 1999 16:52:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: determine, if file is directory
Message-Id: <77vot7$dup$1@client2.news.psi.net>

Patrick Clauberg (pat@uni.de) wrote on MCMLXVI September MCMXCIII in
<URL:news:369dcb0a.316799@129.217.240.1>:
"" On 14 Jan 1999 04:38:51 GMT, abigail@fnx.com (Abigail) wrote:
"" 
"" >?? I would like to check every file in the direcory, and if any file is a
"" >?? directory itself, I start the check function with the new path.
"" 
"" >No you don't - you will never finish.
"" 
"" so maybe there is a smarter way to do this.


Yes. It's called File::Find.




Abigail


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

Date: 18 Jan 1999 17:50:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Downloading, Perl, Navigator, and file names
Message-Id: <77vs99$eh7$5@client2.news.psi.net>

KC Hunt (khunt@earthlink.net.no-spam) wrote on MCMLXV September MCMXCIII
in <URL:news:77td7h$7nb$1@birch.prod.itd.earthlink.net>:
() I'm trying to have the user save a downloaded file through Navigator 4.x.
() That's not the problem though. The problem is that the default filename is
() always the name of the Perl script that is doing the downloading.

That's not a Perl question. Go to the appropriate browser group.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Mon, 18 Jan 1999 18:18:40 GMT
From: krish_v@my-dejanews.com
Subject: Endian converter: Does anyone know of one?
Message-Id: <77vttm$2vk$1@nnrp1.dejanews.com>

Has anyone come across Perl code that can convert
binary files in Big-Endian format to little-Endian format ?

Thank you,
Krish

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


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

Date: 18 Jan 1999 17:52:32 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: File Upload.
Message-Id: <77vsd0$eh7$6@client2.news.psi.net>

Alex Blyumenkrants (alexb@ipwiz.com) wrote on MCMLXIV September MCMXCIII
in <URL:news:77r718$eg8$1@winter.news.rcn.net>:
<> Hi!
<> 
<> I have the following problem:
<> 
<> i need to upload a file from an Html,
<> if i use type="file"
<> what should i do to save this file in my Cgi?


Just stick a marble in your nose and run three times around the house.

Or go to a group that deals with CGI problems. rec.pets.bears.polar
for instance.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Mon, 18 Jan 1999 13:06:24 -0500
From: Thomas Bond <bond@ei.kodak.com>
Subject: Find DOS backslashes
Message-Id: <36A3781F.657FA7F0@ei.kodak.com>

Hello,

    I'm running apache with embedded perl on a unix box.  I can't seem
to split up a dos filename by searching for the '\' (backslash).
Any idea how I can us the function split() with the correct pattern(i.e.
the DOS backslash) to split on.
TIA.


                                                            Tom



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

Date: Mon, 18 Jan 1999 16:16:21 GMT
From: dragons@news.scescape.net (Matthew Bafford)
Subject: Re: glob error
Message-Id: <p7Jo2.114$Kt5.469@news6.ispnews.com>

On Mon, 18 Jan 1999 13:49:15 +0100,
Harald Giese <giese@dkrz.de> pounded in the following:

[snip]

=> On Win32 platforms you must use "\\" instead of "\":

True.  In this case ("c:\perl\*.*") the \ is harmless (since \p isn't? a
valid escape it's just passed through).  It's when you have paths such as:

"c:\temp\new\folder\behind\the\rear"

=> ==> ... <c:\\perl\\*.*>

Gosh, no.  Win32 supports forward slashes in filenames.

So:

c:\\perl\\*.*

and

c:/perl/*.*

Are both the same in effect, and the second one is much easier to read. (And,
IMHO, much harder to mess up on).

=> Regards,

HTH!

=> Harald

--Matthew


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

Date: 18 Jan 1999 18:02:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with a TLD search program
Message-Id: <77vsvp$eh7$8@client2.news.psi.net>

Bill Skitt (skitt@massed.net) wrote on MCMLXV September MCMXCIII in
<URL:news:77rbmh$8s5$1@winter.news.rcn.net>:
{} Hello. I am reasonably new to perl and trying to write a program that
{} searches a database of country codes.

Use a hash. Or a DBM file.

{}                                       The database file is in the form of
{} extension=country (example: com=United States Commercial).

 .com isn't restricted to the US.

{}                                                            Im not quite sure
{} what the logic behind a program like this is like. If anyone can help me
{} brainstorm or throw some snippets of code at me it is greatly appreaciated.

Read the manual about hashes.

{} Since I am new to newsgroups, please email skitt@massed.net rather than
{} posting a response.


If you can post, you can read. If you can't read, you shouldn't have posted.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 18 Jan 1999 17:58:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HELP: Netscape 4.5 doesn't like text/html header from Perl script
Message-Id: <77vsod$eh7$7@client2.news.psi.net>

cndawes@my-dejanews.com (cndawes@my-dejanews.com) wrote on MCMLXV
September MCMXCIII in <URL:news:77t6r8$qgo$1@nnrp1.dejanews.com>:
"" I have written a perl script, which outputs some HTML. It does this very
"" nicely with IE4, however, when I use Netscape 4.5 it is as though it is
"" completely ignoring the "Content-type: text/html\n\n" which I am sending it,
"" as it prints the source to the screen, HTML tags and all.

Write to Netscape and file a bug.

This is not a Perl question. Go away.



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: Mon, 18 Jan 1999 11:05:56 -0500
From: John Chambers <jc@uwm-dev.gte.com>
Subject: Re: Is perl the right choise for the following job?
Message-Id: <36A35BE4.3ED72FCF@uwm-dev.gte.com>

Eric Bohlman wrote:

> Joeri Belis <progressdll@angelfire.com> wrote:
> : Is perl the right choise for the following job?
>
> : I want to connect to a certain site (asp pages)
> : and need the extract some info from that page.
> : reformat it and right it to an ascii file.
>
> : Can perl do that easy?
>
> As others have pointed it out, yes it can.  You'll almost certainly want
> to get familiar with the LWP modules, particularly LWP::Simple, which
> will handle nearly all the dirty work of connecting to the remote site
> and retrieving the page, and the HTML modules, particularly HTML::Parser
> and some of its descendants like HTML::Filter, which will greatly
> simplify the work of extracting information from the page.  Do *not*
> attempt to write regexes for parsing HTML; you will wind up spending far
> more time than you'd spend learning to use HTML::Parser, and you will
> almost certainly wind up with very fragile solutions that will require
> extensive rework if even slight changes are made to the pages.


Hmmm ... The CPAN archives seem to have HTML::Simple, but there
doesn't seem to be any LWP::Simple.  I grabbed the latest LWP and
installed it, and "man LWP::Simple" says "not found".

Where do you get it?

One problem is that the CPAN module list contains the word "simple"
about a zillion times, so it's not worth much as a search keyword.





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

Date: 18 Jan 1999 16:23:34 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: looking for serial to socket program
Message-Id: <19990118112334.01017.00000083@ng-fq1.aol.com>

Hi Shang & Jonathan:

>On Fri, 15 Jan 1999 22:06:02 GMT kos@tdd.hbo.nec.com wrote:
>> I am currently working on an assignment that requires a serial I/O handling
>> program (running on NT 4.0) talking to other programs through a socket. 

>If I understand you correctly you want to be able to create a TCP server
>program that will control a serial port.
>
>Someone I believe has created a Win32::Serial module that should be 
>available from CPAN - this will take care of the serial side of your
>application.  

The actual name is Win32::SerialPort. On CPAN under:
authors/id/B/BB/BBIRTH # plus appropriate links

>The socket connections can be fairly simple - if you look at the perlipc
>manpages there are examples of the kind of server that you would want -
>you can replace the screen output with writing/reading to the serial port.

That will actually become a bit easier when I get Version 0.14 released
(which adds tied Filehandle support) - hopefully later in the month. You
can contact me separately if you need more details or assistance. This
(socket interface support) has been down near the bottom of my TODO
list, but I welcome having someone else do it.

If you plan to make your resulting code publically available, I'll add
a link to it in the documentation.

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Mon, 18 Jan 1999 10:32:33 -0800
From: rdm@cfcl.com (Rich Morin)
Subject: Re: MacPerl: deleting a file
Message-Id: <rdm-1801991032330001@ip42-30.cfcl.com>

In article <36951953.2722@no.spam>, rupert@no.spam.leeds.ac.uk wrote:
> On a different tack, it is a fact that the help system for 
> MacPerl is better than that for any commercial software
> (though clarisworks comes close) and even any other shareware
> or freeeware.

For more information on MacPerl (including the MacPerl email list),
visit the MacPerl Pages (http://www.ptf.com/mcaperl).

-r

-- 
Canta Forda Computer Laboratory       | Prime Time Freeware - quality 
UNIX consulting, training, & writing  | freeware at affordable prices
+1 650-873-7841                       | +1 408-433-9662   -0727 (Fax)
Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com


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

Date: Mon, 18 Jan 1999 08:18:25 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Memory management using reference
Message-Id: <MPG.110cfead561a83bf98999a@nntp.hpl.hp.com>

In article <36a34361.0@newsread3.dircon.co.uk>, cobalt@dircon.co.uk 
says...
> If I have the following:
> 
> $refOne = func1();
> $refTwo = func2();
> 
> func3($refOne,$refTwo);
> 
> where func1 and func2 return reference to hashes, I find that refOne points
> to the same location as refTwo, i.e. the hash created by func2 is put in the
> same memory as the hash created by func1.
> 
> If there I can override this behaviour so that %$refOne is not overwritten
> by %$refTwo  ?

Almost surely, func1() and func2() are using the same global variable to 
contain the hash.  You need either to create a local hash and reurn a 
reference to it:

sub func1 {
    my %hash;
    ...
    return \%hash;
}

or return a reference to an anonymous hash:

sub func1 {
    my $hashref = { };
    ...
    return $hashref;
}

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


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

Date: Mon, 18 Jan 1999 11:42:11 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Memory management using reference
Message-Id: <jprv77.ol7.ln@magna.metronet.com>

Paul Davies (cobalt@dircon.co.uk) wrote:


: where func1 and func2 return reference to hashes, I find that refOne points
: to the same location as refTwo, i.e. the hash created by func2 is put in the
: same memory as the hash created by func1.

: If there I can override this behaviour so that %$refOne is not overwritten
: by %$refTwo  ?


   There is something you are not telling us.

   Please post a _complete_ program the illustrates the problem
   you are having.


-------------------
#!/usr/bin/perl -w
use strict;

my $refOne = func1();
my $refTwo = func2();

func3($refOne,$refTwo);

sub func1 {
   my(%hash) = (one => 1, two => 2, three => 3);

   return \%hash;
}

sub func2 {
   my(%hash) = (four => 4, five => 5, six => 6);

   return \%hash;
}

sub func3 {
   my($first, $second) = @_;

   print "first:\n";
   foreach (sort keys %$first) {print "   $_\n"}
   print "second:\n";
   foreach (sort keys %$second) {print "   $_\n"}
}
-------------------


   No problems there...


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


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

Date: 18 Jan 1999 16:47:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Number found where operator expected (Newbie)
Message-Id: <77voif$qfr$1@pegasus.csx.cam.ac.uk>

 <lisawagner72@my-dejanews.com> wrote:
>I realize I am a complete idiot for not knowing what this error message means
>but can someone please tell me anyway?

A good way of saving face is to check the entry in "perldoc perldiag"
for any error message you don't understand (and even for those you think
you do understand).     You may still not understand the entry, but you
can at least now post "What the hell does this perldiag entry mean?"
and people will think "Good: she's checked the documentation".

And if you "use diagnostics;", Perl will even do the lookup for you
automatically.

In this particular case

>Number found where operator expected at [script name & path] line 122, near
>"$check_referer = "0"

we find

     %s found where operator expected
         (S) The Perl lexer knows whether to expect a term or an
         operator.  If it sees what it knows to be a term when it
         was expecting to see an operator, it gives you this
         warning.  Usually it indicates that an operator or
         delimiter was omitted, such as a semicolon.

which isn't terribly helpful, but the next entry

>  (Might be a runaway multi-line "" string starting on line 68)
>        (Missing operator before 0?)

     Might be a runaway multi-line %s string starting on line %d
         (S) An advisory indicating that the previous error may
         have been caused by a missing delimiter on a string or
         pattern, because it eventually ended earlier on the
         current line.

suggests that you've got a missing quote character at or soon after line 68.


Mike Guy


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

Date: Mon, 18 Jan 1999 17:48:09 GMT
From: cbleask@olemiss.edu
Subject: Odering an Array
Message-Id: <77vs4l$1bf$1@nnrp1.dejanews.com>

Given an array of real numbers, say A whose index from 1 to 100.
How could I write a program to produce a list or print out which gives each
element's order?

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


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

Date: Mon, 18 Jan 1999 17:48:35 GMT
From: christian.arandaNOSPAM@NOSPAMiiginc.com (Christian M. Aranda)
Subject: Re: Out of Memory
Message-Id: <77vrls$eko$1@news-2.news.gte.net>

On 16 Jan 1999 02:46:01 GMT, tommy1452@aol.com (Tommy1452) wrote:

> I'm running perl from my home computer under MS-DOS.  After requesting  about
>12 or so web documents using get  and parsing through them, the program shuts
>down with an Out of Memory message.  I have 2 gigs left on my HD and 32megs of
>RAM, I don't think memory should be a problem.  I'm storing only 3 web pages at
>a time as strings in my program, and writing two words to a file for every get
>request performed.   What can I do to fix this?

you could post your code.


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

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


Administrivia:

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

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

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

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

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

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4679
**************************************

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