[13288] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 698 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 1 20:07:22 1999

Date: Wed, 1 Sep 1999 17:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 1 Sep 1999     Volume: 9 Number: 698

Today's topics:
    Re: -F/foobar/ on #! line <aqumsieh@matrox.com>
    Re: 2 Questions <aqumsieh@matrox.com>
    Re: A good tutorial PERL <durbin@cig.mot.com>
        CGI nd Personal web sever problem <andy@webfx3.freeserve.co.uk>
    Re: CGI nd Personal web sever problem (Bill Moseley)
        Compiling a perl program to C <c@d.e>
    Re: Counting duplicate list elements in Perl <uri@sysarch.com>
    Re: Counting duplicate list elements in Perl (Matthew David Zimmerman)
    Re: Counting duplicate list elements in Perl <uri@sysarch.com>
    Re: Date / time problem (resolution) <news@news.news>
        Embedding Session ID In URL <turner@redballpro.com>
    Re: Embedding Session ID In URL (Bill Moseley)
    Re: Need "Universal" exporter.pm File <aqumsieh@matrox.com>
        Perl vs. Samba <craig@ariel.hq.group.com>
    Re: Perl5 sendmail (John Casey)
    Re: Perl5 sendmail (Kenneth Graves)
    Re: PerlIS.dll won't work for me <ehpoole@ingress.com>
        Please help a newbe jp_48504@my-deja.com
    Re: regex bug: (?:\d{3})+ loses count (Ilya Zakharevich)
        Script for downloading and saving web pages (Sethuraman Baranidharan)
    Re: shebang question for Win32 Perl/Apache <see.email.address@bottom.in.sig>
    Re: shebang question for Win32 Perl/Apache (Larry Rosler)
    Re: Simulating Carriage Returns (Matthew Bafford)
    Re: Sockets and Threads <aqumsieh@matrox.com>
    Re: Sockets and Threads <rra@stanford.edu>
    Re: split defect? <madebeer@igc.apc.org>
    Re: Tracking progress of a Net::FTP download (Bill Moseley)
    Re: Why doesn't my undef an array? <aqumsieh@matrox.com>
    Re: Why doesn't my undef an array? <rra@stanford.edu>
    Re: writing string with some '%' to a file <uri@sysarch.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 1 Sep 1999 15:54:48 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: -F/foobar/ on #! line
Message-Id: <x3y671uwgon.fsf@tigre.matrox.com>


Colin R. DeVilbiss <crdevilb@mtu.edu> writes:

> the error returned is:
> syntax error at foo.pl line 3, near BEGIN
> 
> commenting the BEGIN {} block just moves the compile error to ``chomp''.

I don't get this error on my version of Perl:

% perl -v

This is perl, version 5.004_04 built for sun4-solaris
 
Copyright 1987-1997, Larry Wall


What is your version of Perl?

--Ala



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

Date: Wed, 1 Sep 1999 16:22:03 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: 2 Questions
Message-Id: <x3y4shewffa.fsf@tigre.matrox.com>


<ICEMOUNTAIN@prodigy.net> writes:

> I am making a script to search a gallery of pictures. I want only five
> images to be displayed on each page to shorten loading time. How
> would I do that. 

Although I don't see this as a Perl-related question, I vaguely
remember reading about it in one of the columns in
Web-Techniques. More specifically it was Randal Schwartz's
column. Look it up. You might find good code if you look hard enough
in www.stonehenge.com/merlyn/WebTechniques

>       And I want one line to have all capitals in "sub
> find_model". I looked in the perl FAQ's and it said to put $line =
> uc($line); I put that and it didn't work. Thanks for any help in
> advanced.

It should work. What do you mean by "didn't work" ? Show us the code
where uc() didn't work and we'll point out the problem.

> you can see the script at http://www.3gc.net/gallerysearch.txt

Oh. Ok. Let's see. I see the following two lines in your script:

	$line = uc($line); 

Of course this will not work. You do not set $line to anything. $line
is just a variable like any other. You must actually read something
into that variable, then uc($line) will return the string originally
stored in $line in all upper case. Get that? Although Perl is magical,
and usually DWYM (Does What You Mean), the ESP::PSE module is not
quite developped. Ask David Cassell for more info.

Looking at your script, I don't really see which line you want to
uppercase, so I will let you figure this one out.

	print "</td></tr><tr><td align=center><a
	href=/gallery/$model/$year$num.html>19$year 
	$model</a></td></tr>\n"; 

[PS. I wrapped up that long line, just to avoid having more than 72
chars/line]

Ever heard of Y2K? Especially that it is just around the corner? Fix
you code now or in less than 4 months you will be forced to do it
again (if earth survives Y2K ;-)

HTH.
--Ala



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

Date: Wed, 01 Sep 1999 17:08:01 -0500
From: "Chris Durbin [C]" <durbin@cig.mot.com>
Subject: Re: A good tutorial PERL
Message-Id: <37CDA3C1.B09BEF56@cig.mot.com>

MELERO wrote:
> 
> HI
> 
> I ned a good tutorial for PERL , I have found some tutorial but it's very
> bad.
> 
> Can You help me?
> 
>                thanks
Not to pump the egos of a few regular contributors to this group, but
the only book I ever needed to learn and use perl is _Programming Perl_,
by Larry Wall, Tom Christianson, and Randal L. Schwartz. It's complete
and thorough, and actually has a readable style, as well as a sense of
humor... I've used Perl for everything from simple automation script to
bit-flippin' scientific programming, and never had to look farther than
that book. Kudos, y'all...
-- 
Chris Durbin                    Motorola, Cellular Infrastructure Group
-----------------------------------------------------------------------
Phone: (847)435-9558                    Pager: 1-800-759-8888, #1268222
Fax:   (847)632-4552                    Email:       durbin@cig.mot.com


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

Date: Wed, 1 Sep 1999 13:20:35 -0000
From: "Andy" <andy@webfx3.freeserve.co.uk>
Subject: CGI nd Personal web sever problem
Message-Id: <7qk739$lnt$3@news5.svr.pol.co.uk>

Hi all
can anyone help me. I am trying to get microsoft personal web server to run
cgi scrips, t the moment it just tries to download them. I no i need to
modify my reg file as i have done it before and it worked ok. The problem is
i cannot remember how to do it . Any ideas

                Andy@webfx3.freeserve.co.uk




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

Date: Wed, 1 Sep 1999 15:45:22 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: CGI nd Personal web sever problem
Message-Id: <MPG.12374c5bb7e96ba19896ed@nntp1.ba.best.com>

Andy (andy@webfx3.freeserve.co.uk) seems to ask the same question...
> Hi all
> can anyone help me. I am trying to get microsoft personal web server to run
> cgi scrips, t the moment it just tries to download them. I no i need to
> modify my reg file as i have done it before and it worked ok. The problem is
> i cannot remember how to do it . Any ideas

Sure.  Get Apache.

Or, try Deja news as this is a FAQ.  Oh, it's also IN a FAQ.
Try 
http://www.activestate.com/ActivePerl/docs/perl-win32/perlwin32faq6.html
and see if that leads you any place.

Have fun,

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 1 Sep 1999 17:46:38 -0500
From: "a" <c@d.e>
Subject: Compiling a perl program to C
Message-Id: <01bef4c2$efeef400$8a2116ac@FH2750.compuware.com>

I read in the perl faq at 
http://www.perl.com/CPAN/doc/FAQs/FAQ/PerlFAQ.html
that a Perl program can be compiled into C. I need to know more information
about this. 
Is it possible in the new version of Perl which is 5.005 ?
Where do you find more information about this ?



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

Date: 01 Sep 1999 17:32:25 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Counting duplicate list elements in Perl
Message-Id: <x7wvuatj12.fsf@home.sysarch.com>


a little perl golf here

#!/usr/local/bin/perl -ln

$c{$_}++ ;

END {
	print "$_,$c{$_}" for sort keys %c ;
}

or as a one liner:

perl -lne '$c{$_}++; END{print "$_,$c{$_}" for sort keys %c}'

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 1 Sep 1999 22:11:57 GMT
From: mdz4c@node5.unix.Virginia.EDU (Matthew David Zimmerman)
Subject: Re: Counting duplicate list elements in Perl
Message-Id: <7qk8bd$et8$1@murdoch.acc.Virginia.EDU>

Uri Guttman  <uri@sysarch.com> wrote:
>
>a little perl golf here
>
[snip]
>
>or as a one liner:
>
>perl -lne '$c{$_}++;END{print "$_,$c{$_}" for sort keys %c}'

 perl -lne '$c{$_}++}{print "$_,$c{$_}" for sort keys %c'

Hey, it's only four strokes, but I'll take what I can get. :)

--Matt
-- 
Matthew Zimmerman ------------  http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program --------- University of Virginia
| "You got to be very careful if you don't know where you're going, |
| because you might not get there."                   -- Yogi Berra |


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

Date: 01 Sep 1999 19:21:46 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Counting duplicate list elements in Perl
Message-Id: <x7pv02tdyt.fsf@home.sysarch.com>

>>>>> "MDZ" == Matthew David Zimmerman <mdz4c@node5.unix.Virginia.EDU> writes:

  MDZ> Uri Guttman  <uri@sysarch.com> wrote:
  >> 
  >> a little perl golf here
  >> 
  MDZ> [snip]
  >> 
  >> or as a one liner:
  >> 
  >> perl -lne '$c{$_}++;END{print "$_,$c{$_}" for sort keys %c}'

  MDZ>  perl -lne '$c{$_}++}{print "$_,$c{$_}" for sort keys %c'

  MDZ> Hey, it's only four strokes, but I'll take what I can get. :)

using the trick of }{ to close the -n loop block is not allowed anymore
in the official rules of the professional perl golf association.

use it again and you will be banned from all perl golf tournaments for a
year.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Thu, 02 Sep 1999 00:02:59 +0100
From: news <news@news.news>
Subject: Re: Date / time problem (resolution)
Message-Id: <37CDB0A3.C09F6B87@news.news>



Larry Rosler wrote:

> In article <37CC22A9.DF7F800C@news.news> on Tue, 31 Aug 1999 19:44:57
> +0100, news <news@news.news> says...
> > Dear all,
> > I posted this a few days ago:
> >
> > # This prints seconds from epoch ok
> > $date = time;
> > # This returns nothing
> > $date = localtime;
> > # This too
> > $date =gmtime;
>
> What nonsense.  You were told earlier that you have a problem with your
> perl installaion.  But you have chosen to work around it, rather than
> fix it.  So why should we care (except that you are spewing
> misinformation which might mislead the unwary.
>

I checked the version and it was 5. Everything else works ok, so I tried
this and this works. How is this misinformation if it works? How am I
supposed to know that this is a workaround and not the proper method if I am
new to perl?

> #!/usr/local/bin/perl -w
> use strict;
>
> my $date;
>
> # This prints seconds from epoch ok
> $date = time;
> print "|$date|\n";
>
> # This returns nothing
> $date = localtime;
> print "|$date|\n";
>
> # This too
> $date =gmtime;
> print "|$date|\n";
>
> print "\nperl version $]\n";
> __END__
>
> |936130983|
> |Tue Aug 31 13:23:03 1999|
> |Tue Aug 31 20:23:03 1999|
>
> perl version 5.00503
>
> > I managed to solve the problem by doing this:
> >
> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
>
> No, you found a way to solve a different problem.

Again, how was I supposed to know. What is wrong with this method? Wouldn't
it be more useful to explain that for the benefit of others like me who do
not know any better?

>

>
>
> Maybe you should stick to 'alt.perl' for your answers (removed from this
> response).

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





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

Date: Wed, 01 Sep 1999 21:08:37 GMT
From: Douglass <turner@redballpro.com>
To: turner@redballpro.com
Subject: Embedding Session ID In URL
Message-Id: <7qk4ka$6vp$1@nnrp1.deja.com>

Hello Perlers,

The time has come for me to learn how to implement session
state management on a web server using the technique of appending
a unique number to a URL.

For example, visit www.amazon.co.uk and a URL of form:
www.amazon.co.uk/foo/bar/home/home.html/026-4724746-7391807

is displayed in the browser URL window. Note the numbers trailing
"home.html"

Visit subsequent pages at the site and note that all hrefs have
the same trailing numbers. This is the unique session id for my
visit to Amazon. Session state data (shopping cart, etc.) is
stored for me on the server and mapped to this trailing number.

Cool. That I understand.

I now need someone to walk me through the code that handles the
mapping from URL to actual location on the server.

Example code samples would be greatly appreciated as would pointers
to web info on this subject.

Thanks for your time.

Cheers,
Douglass Turner
email: turner@redballpro.com
web:   http://www.redballpro.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 1 Sep 1999 15:38:48 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Embedding Session ID In URL
Message-Id: <MPG.12374ad283131d6f9896ec@nntp1.ba.best.com>

Douglass (turner@redballpro.com) seems to say...
> The time has come for me to learn how to implement session
> state management on a web server using the technique of appending
> a unique number to a URL.

Check out the CGI groups and FAQs.  This was (or is always) discussed on 
the CGI newsgroup.

> For example, visit www.amazon.co.uk and a URL of form:
> www.amazon.co.uk/foo/bar/home/home.html/026-4724746-7391807


> I now need someone to walk me through the code that handles the
> mapping from URL to actual location on the server.

That's a server issue.  It's called the additional path info and CGI.pm 
will give that to you.  One of foo, bar, home, or home.html would most 
likely be the CGI script (home.html, most likely).


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Wed, 1 Sep 1999 17:28:43 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Need "Universal" exporter.pm File
Message-Id: <x3y3dwywcc4.fsf@tigre.matrox.com>


ebohlman@netcom.com (Eric Bohlman) writes:

> John R. Maiocchi (jrmaiocchi@home.com) wrote:
> : Looking for exporter.pm file. For a friend and I don't know what
> : version. Needs to have security that will enable IP banning?
> 
> Huh?  exporter.pm is part of the standard Perl distribution;

I am tempted to add that the correct name for that module is:

	Explorer.pm

and not

	explorer.pm

Perl is case-sensitive.

--Ala



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

Date: Wed, 1 Sep 1999 17:14:23 -0400
From: "Craig Barkhouse" <craig@ariel.hq.group.com>
Subject: Perl vs. Samba
Message-Id: <rsr5miaej7141@corp.supernews.com>

I've got ActivePerl for Win32, build 519.  I cannot seem to open any files
on a shared drive.  The server is an OpenServer 5 machine running Samba.
I'm using the following Perl syntax:

open(FILEHANDLE, "filename") or die("Could not open file");

It doesn't matter if I open the file for input (as above), or output
(prepending a ">" to the filename).  The code fragment works on any local
drive, or on a mounted NT drive.  I have read and write permissions on the
Samba drive.  I have also tried using sysopen() with various mode flags, all
to no avail.

Has anyone else encountered this problem?  It definitely seems like a bug in
Perl, Samba, or both.  I need to come up with a solution or workaround ASAP.





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

Date: Wed, 01 Sep 1999 21:12:33 GMT
From: jcasey@workingventures.ca (John Casey)
Subject: Re: Perl5 sendmail
Message-Id: <37cd928b.608430136@wv-proxy>

>: I am kinda new to PERL. I am trying to e-mail a form...sounds simple
>: enough, but all the documentation I find refers to UNIX
>: "\usr\lib\sendmail". I have PERL 5.004 installed, but can't find
>: anything similar to sendmail in bin or lib.
>
>You're using NT, aren't you?

I use OMNICRON HTTPd as my web server and have configured it for PERL
5.004 just because I can use it on any machine 95/98/NT. I only have
98 at home. I have NT at work and have IIS3.0 loaded on it. I will
eventually be sending this site to another server which could be UNIX,
NT or what ever other server my client decides to go with. Isn't there
a comparable perl module for PERL5 that compares to SENDMAIL, or am I
over simplifying it.


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

Date: Wed, 01 Sep 1999 21:48:44 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: Perl5 sendmail
Message-Id: <slrn7sr7kb.15b.kag@kag.citysource.com>

In article <37cd928b.608430136@wv-proxy>, John Casey wrote:
>I use OMNICRON HTTPd as my web server and have configured it for PERL
>5.004 just because I can use it on any machine 95/98/NT. I only have
>98 at home. I have NT at work and have IIS3.0 loaded on it. I will
>eventually be sending this site to another server which could be UNIX,
>NT or what ever other server my client decides to go with. Isn't there
>a comparable perl module for PERL5 that compares to SENDMAIL, or am I
>over simplifying it.

Net::SMTP or Mail::Mailer, depending on taste.

Sendmail is an external program, not part of Perl.  It used to be
fairly standard on Unix machines, but can't be assumed to be
present.  /usr/lib/sendmail and /usr/sbin/sendmail are the two
most common directories to find it in when it is present.

--kag


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

Date: Wed, 01 Sep 1999 19:20:05 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: PerlIS.dll won't work for me
Message-Id: <37CDB4A5.2EC9BB0B@ingress.com>

Steve@rossbyweather.com wrote:
> 
> I have read through newsgroups and multiple FAQ's with no solution.
> While trying to speed things up using PerlIS.DLL instead of Perl.exe on
> IIS 4.0 I ran into a problem.  I downloaded the newest build of Perl
> from ActiveState and my old CGI programs work fine, but when I change
> the mappings on IIS 4.0 from .cgi perl.exe %s %s to .cgi perlis.dll the
> scripts don't work properly.  I added the HTTP/1.0 200 OK line in there
> and that didn't work.  I added the proper script map in the registry
> and nothing works.  I created the simple helloworld.cgi file and ran
> that, and now I get an error saying the helloworld script produced no
> output.

The PerlIS.dll for Perl 5.005, unlike earlier perl verisons, does not have
the "HTTP/1.0 200 OK\n" bug that it's predecessors did.

There are some scripts which simply will not run properly under PerlIS.dll
becuase it does not provide an interface that is 100% equivalent to a CGI
environment.  However, a simple "Hello World" script should work just
fine. Are you remembering to print the HTTP Header "Content-type" first?

#!/usr/bin perl
print "Content-type: text/plain\n\n";
print "Hello World!";
exit (0);

Now if the above does not work, there is definitely something wrong with
the way your server is configured. Did you remember to specify the full
path to PerlIS.dll? (e.g.: c:\perl5\bin\PerlIS.dll )

-- 
Ethan H. Poole           ****   BUSINESS   ****
ehpoole@ingress.com      ==Interact2Day, Inc.==
(personal)               http://www.interact2day.com/


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

Date: Wed, 01 Sep 1999 21:53:12 GMT
From: jp_48504@my-deja.com
Subject: Please help a newbe
Message-Id: <7qk784$8tc$1@nnrp1.deja.com>

First,
 I want to that those of you who have provided me with help a few days
ago.  The information was very useful.  I am probably to new at Perl to
do this program, but I am persistant. I need my program to write to a
file by creating it for a specific user after they have filled out a
form.  I need to be able to append to the end of the file and print out
the last 20 entries made by that user. Can anyone recommend anything or
a good source to help me find the info I need?

Thanks
JP


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 1 Sep 1999 21:50:23 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regex bug: (?:\d{3})+ loses count
Message-Id: <7qk72v$3ml$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to M.J.T. Guy
<mjtg@cus.cam.ac.uk>],
who wrote in article <7qjld7$9fs$1@pegasus.csx.cam.ac.uk>:
> I should perhaps have been clearer by what I meant by "serious bugs",
> production quality" etc.
> 
> 5.005, 5.005_01 and 5.005_02 all had new bugs which the developers were
> aware of, which were not present in previous production releases.
> So upgrading to these versions could have been a retrograde step.
> 
> AFA I recall, 5.005_03 had no such known bug at the time of its release
> as latest.tar.gz .    And offhand, I don't know of any such bug
> reported since.

"At the time of its release"?  Who cares?  And I reported the bug that
 .ph cease to work almost immediately after the release.  And Dan
(DoIRC?) corrected this bug very soon.  So your "offhand" looks very
off indeed.  ;-)

> OTOH the production releases so far *do* have such bugs introduced
> since 5.005_03.    Your recent run-in with join() provides a convenient
> example.

This is why knowing *which* developers releases are better than so
called "production" releases is a key factor.

Ilya


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

Date: 1 Sep 1999 18:05:56 -0500
From: barani@deft.cc.purdue.edu (Sethuraman Baranidharan)
Subject: Script for downloading and saving web pages
Message-Id: <7qkbgk$1l7m@deft.cc.purdue.edu>

Newbie Alert! :-

I need a simple perl script that downloads web pages and saves it in 
files (including images). Earlier I obtained two scripts webURL and 
webget  both of which were downloading only text.  

-Barani
barani@deft.cc.purdue.edu



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

Date: Wed, 01 Sep 1999 15:10:46 -0700
From: Daniel Kirkdorffer <see.email.address@bottom.in.sig>
To: Larry Rosler <lr@hpl.hp.com>
Subject: Re: shebang question for Win32 Perl/Apache
Message-Id: <37CDA466.ADF1033B@bottom.in.sig>

Larry Rosler wrote:
> 
> 
> Try omitting the 'c:'.  If Apache is installed on drive C: and/or the
> web cgi-bin directory is on drive C:, there is no reason to assume the
> current drive would be anything but drive C:.

Got it.  My problem was all the examples I saw were on C: and of course
I've installed Apache on E:.  #!\usr\bin\perl works fine now that
I've made a usr\bin\ directory on E: with perl.exe in it.

Thanks,

Dan


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

Date: Wed, 1 Sep 1999 16:57:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: shebang question for Win32 Perl/Apache
Message-Id: <MPG.12375d56aaaf44ff989f09@nntp.hpl.hp.com>

In article <37CDA466.ADF1033B@bottom.in.sig> on Wed, 01 Sep 1999 
15:10:46 -0700, Daniel Kirkdorffer <see.email.address@bottom.in.sig> 
says...
> Got it.  My problem was all the examples I saw were on C: and of course
> I've installed Apache on E:.  #!\usr\bin\perl works fine now that
> I've made a usr\bin\ directory on E: with perl.exe in it.

I assume you mean #!/usr/bin/perl, because your Unix systems won't be 
happy with backslashes.

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


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

Date: Wed, 01 Sep 1999 22:40:08 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Simulating Carriage Returns
Message-Id: <slrn7sra16.88s.*@dragons.duesouth.net>

[Also mailed to lr@hpl.hp.com with a bear]

And so it happened, on Wed, 1 Sep 1999 13:46:06 -0700, Larry Rosler)
typed random characters into perl, and ended up with the following
posted to comp.lang.perl.misc: 
: In article <7c671uig30.fsf@ets02.jpl.nasa.gov> on 01 Sep 1999 12:31:31 -
: 0700, Bryan D Howard <bryan@ets02.jpl.nasa.gov> says...
: ... 
: > % perl -e '@f=(localtime)[3..5]; $f[1]++; $f[2] += 1900;
: >           printf "%04d-%02d-%02d\n", reverse @f;'
:                      ^^
: That '04' is to ensure printing four digits should $f[2] be less than
: -900, for example, -901.  :-)

Huh?  I'm afraid I don't follow what you're saying.

The 0 ensures that the number will be padded with 0s if it is less than 4
digits wide, thus 4 becomes 0004, 444 becomes 0444, and 4444 becomes
4444.

In this case %4d, or even %d would be sufficient for a little while.
Even after the brief period had passed, 10000 would be printed, so no
data would be lost.

: > 1999-09-01
: 
:   0999-09-01

That's not what I get:

~> perl -e '@f=(localtime)[3..5]; $f[1]++; $f[2] += 1900;
>           printf "%04d-%02d-%02d\n", reverse @f;      '
1999-09-01
~>

Or did I just totally misunderstand what you meant?

: (Just Another Larry) Rosler

--Matthew


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

Date: Wed, 1 Sep 1999 17:38:36 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Sockets and Threads
Message-Id: <x3y1zciwbvn.fsf@tigre.matrox.com>


Lee.Lindley@bigfoot.com writes:

> In article <x3yaer7x6je.fsf@tigre.matrox.com>,
>   Ala Qumsieh <aqumsieh@matrox.com> wrote:

[snip]

> > One way would be to send the children the references to those
> > variables, and the children can look them up directly from memory. Of
> > course this has a potential concurrency problem where more than one
> > child (and possibly the parent) will attempt to read/write to the
> > variable. In that case you need to be using semaphores which slightly
> > complicates your design.
> [snip]
> Huh?  Do you mean shared memory?  You can use IPC::Shareable and create
> a tied hash (or array or scalar) to the shared memory (if the
> OS supports it), but you cannot directly access regular memory in
> another process (at least not in any OS with which I have any
> experience).

No. Shared memory is another option which I pointed out. What I meant
there was that each child can directly access the variables, if they
have references to those variables. Something like:

% perl -wl
my $x = [1,2,3];
my $pid = fork;
die unless defined $pid;
if ($pid) {
        print "Parent @$x";
} else {
        print "Child @$x";
}
__END__
Child 1 2 3
Parent 1 2 3

But as I said, this has concurrency problems written all over it and
semaphores would help alleviate those problems.

--Ala



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

Date: 01 Sep 1999 16:56:58 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Sockets and Threads
Message-Id: <ylk8qa4245.fsf@windlord.stanford.edu>

Ala Qumsieh <aqumsieh@matrox.com> writes:

> No. Shared memory is another option which I pointed out. What I meant
> there was that each child can directly access the variables, if they
> have references to those variables. Something like:

> % perl -wl
> my $x = [1,2,3];
> my $pid = fork;
> die unless defined $pid;
> if ($pid) {
>         print "Parent @$x";
> } else {
>         print "Child @$x";
> }

That's not accessing the same variables.

The child process of a fork does not have the same address space as its
parent.  It just has a copy of everything at the time of the fork.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 01 Sep 1999 12:19:54 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: split defect?
Message-Id: <APC&1'0'50775d9d'4f6@igc.apc.org>

Mark wrote:

>We have tracked it down to a line that is doing
>a split. It doesn't always happen, but when it does, perl appears to
>never return from the split.  Perl then runs till we kill it and while
>it's running it eats the cpu.

I searched google 
   http://www.google.com/search?q=perl+split+5.004_04

This semed like a good lead:
   http://www.ics.uci.edu/pub/websoft/libwww-perl/archive/1997h2/0211.html

It says: 

 This is a known problem with the 5.004_04 _trial_ release.  Wait for the
 real thing.  [snip] The reason this bug shows up is that perl now
 returns a list with a single element for split(/regex/, "", 2) and it
 used to return an empty list. 

That may be your problem.  It would also probably help if you posted the
offending code. 

HTH
-Michael



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

Date: Wed, 1 Sep 1999 15:31:07 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Tracking progress of a Net::FTP download
Message-Id: <MPG.1237490addc73f8c9896eb@nntp1.ba.best.com>

cb (ecliptica.ww@nospam.virgin.net) seems to say...
> What the author of the lwp cookbook seems to be doing with the LWP::UserAgent
> $ua->request() method is passing a subroutine as the second argument to the
> method where in other circs a local filename is passed.
> 
> The Net::FTP $ftp->get() method can also take a local filename as the second,
> so what I may try is constructing a subroutine to do the same sort of thing as
> is being done in the lwp cookbook with $ua->request() but passing it into
> $ftp->get(). I can't (perhaps in naivety) see any reason why that shouldn't
> work.

Well, maybe because Net::FTP wasn't programmed to work that way?  You 
have to read the documentation to see what it does and doesn't do.

Good luck,

-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Wed, 1 Sep 1999 17:56:16 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Why doesn't my undef an array?
Message-Id: <x3yzoz6uwhs.fsf@tigre.matrox.com>


Ian Smith <iansmith@pepper.ncinter.net> writes:

> Ugh.  The defined function does ugly things with arrays indeed.

Not ugly. Useful :)

> In the modified cod belowe, it generates no error since Perl is 
> generating a brand new thingy for each call.  I would have 
> assumed that my produced a 100% fresh and unopened varable
> each time, but it re-uses some internal things apparently.

Huh? What do you mean there? my() creates a new fresh variable
indeed. Would you care to elaborate?

> #!/usr/local/bin/perl5 -w
> use strict;
> sub test {
>   my $yn = shift;
>   my @array;
>   @array = ( 'A','B','C','D' ) if $yn;
>   print "$yn : $array[2]\n" if defined @array;
>   return \@array;
> }
> my $x=test(0); my $y=test(1); my $z=test(0);

If you add the following:

	print "$x, $y, $z\n";

You would get the following:

1:C
ARRAY(0xb7540), ARRAY(0xb7450), ARRAY(0xbf1c4)

which shows that my() is creating new variables, each one with a
different memory location.

HTH,
--Ala



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

Date: 01 Sep 1999 16:58:24 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why doesn't my undef an array?
Message-Id: <ylhfle421r.fsf@windlord.stanford.edu>

Ala Qumsieh <aqumsieh@matrox.com> writes:
> Ian Smith <iansmith@pepper.ncinter.net> writes:

>> Ugh.  The defined function does ugly things with arrays indeed.

> Not ugly. Useful :)

defined on aggregates is not useful.  It's sufficiently unuseful that it's
likely to be deprecated in future versions of Perl.  It doesn't tell you
any useful information; it gives you information about irrelevant and
unpredicatable internal state of the Perl interpretor.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 01 Sep 1999 17:38:22 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: writing string with some '%' to a file
Message-Id: <x7u2petir5.fsf@home.sysarch.com>

>>>>> "JS" == Jason Speers <jspeers@open.uoguelph.ca> writes:

  JS> When I write a string containing any number of % characters in it to a
  JS> file, I get unexpected results in the file.  i.e. %%%% becomes %%  or
  JS> 234%567 becomes 2340.0000000567  ... and sometimes this will not occur??

  JS> Is there something about the percent sign within a string that I do not
  JS> know about?  Or is there something about writing a percent sign to a
  JS> file that I do now know about?  Or perhaps I just need to brush up on my
  JS> perl skills??!?

you need to brush up on your posting skills. how can we figure out what
is wrong with out any example code? my PSI::ESP module is guessing you
are using s?printf and haven't read the documentation. % is the well
known printf format specification char and it needs to be handled
carefully to print it.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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