[19095] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1290 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 12 03:05:44 2001

Date: Thu, 12 Jul 2001 00:05:12 -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: <994921511-v10-i1290@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 12 Jul 2001     Volume: 10 Number: 1290

Today's topics:
    Re: "Make" executable? <lwalker@ecn.purdue.edu>
        about fcntl <lijinzhi@263.net>
    Re: Advanced Sorting <uri@sysarch.com>
    Re: Advanced Sorting <wyzelli@yahoo.com>
    Re: Advanced Sorting (Logan Shaw)
    Re: Advanced Sorting <uri@sysarch.com>
    Re: Advanced Sorting <wyzelli@yahoo.com>
    Re: argument in regular expression <leclerc.fabrice@wanadoo.fr>
    Re: argument in regular expression <krahnj@acm.org>
    Re: Beginner to Perl <ellem@webcombo.net>
        detecting new pop3 email.... <lwalker@ecn.purdue.edu>
        FAQ: What are the Perl newsgroups on Usenet?  Where do  <faq@denver.pm.org>
        Getting Started. <Stewy@Chartermi.net>
    Re: Getting Started. (E.Chang)
    Re: I'm starting to think our 5.6 install is braindead <pne-news-20010712@newton.digitalspace.net>
        Javascript? Frames? eek! Can't I have CGI? <cro@freeallangels.com>
        mod_perl question <prarie dawn   @hotmail.com>
    Re: Net::Telnet logging on problem..... <ayamanita.nospam@bigfoot.com>
    Re: Perl/Sendmail not sending mail? <scott@mirrorstores.com>
    Re: Socket programming problem <time4tea@monmouth.com>
    Re: Socket programming problem (Villy Kruse)
        Thanks that fixed it <hammy@charter.net>
    Re: trimming blank <pne-news-20010712@newton.digitalspace.net>
    Re: URL String Problem (Blstone77)
        using perl to interact with httpS page (Mike)
    Re: Very good regex question? <wyzelli@yahoo.com>
    Re: Very good regex question? <pne-news-20010712@newton.digitalspace.net>
    Re: Very good regex question? (Philip Lees)
    Re: Why doesn't this program work? (Gary E. Ansok)
    Re: why is Vars an undefined subroutine? (TuNNe|ing)
    Re: why is Vars an undefined subroutine? (E.Chang)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 11 Jul 2001 23:52:10 -0500
From: Laron Andrion Walker <lwalker@ecn.purdue.edu>
To: Garry <garry_short@hotmail.com>
Subject: Re: "Make" executable?
Message-Id: <Pine.GSO.4.33.0107112351450.328-100000@min.ecn.purdue.edu>


Can't you use the PPM command to install modules?
On 11 Jul 2001, Garry wrote:

> Hiya.
>
> Could anyone tell me where I can download a perl-compatible "make"
> executable from? I'm running ActiveState Perl 5.6.0, build 618, and a
> search of the system doesn't find a "make" command (or nmake, or
> omake, or any executable with make in it)!
>
> I've tried posting a message to ActiveState, but that was several days
> ago and they've yet to respond.
>
> I've also tried "clearmake", the make command that comes with
> ClearCase, but it always throws up an error right at the end of the
> makefile script. The last three lines are :
>
> $(PM_TO_BLIB)
> <<
> 	@$(TOUCH) $@
>
> and it complains about the middle line (I'm trying to install modules,
> btw).
>
> So ... perl-compatible "make" exe, anyone?
>
> Cheers,
>
> Garry
>



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

Date: Thu, 12 Jul 2001 14:26:26 -0500
From: "sarah" <lijinzhi@263.net>
Subject: about fcntl
Message-Id: <9ijfr6$g8q$1@crchh14.us.nortel.com>

Hi,

The following is a very simple example of mine:

if (open(FILEH,"test.pl")) {
    $flag_1=fcntl(FILEH, F_GETFL, 0);
    $ret_1=fcntl(FILEH, F_SETFL, O_RDWR);
    $flag_2=fcntl(FILEH, F_GETFL, 0);

    $ret_2=fcntl(FILEH, F_SETLK, F_RDLCK);
    $ret_3=fcntl(FILEH, F_SETLK, F_WRLCK);
}

The value of all variables printed are:
    $flag_1:   "0 but true"
    $flag_2:   "0 but true" ( I think it should be O_RDWR, ie.3)
    $ret_1:   "0 but true"
    $ret_2 & $ret_3: undefined (I think both should be "0 but true")

Why the results are not what I wish?
Thanks for help







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

Date: Thu, 12 Jul 2001 02:50:09 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Advanced Sorting
Message-Id: <x7hewiyi71.fsf@home.sysarch.com>

>>>>> "W" == Wyzelli  <wyzelli@yahoo.com> writes:

  W> my @Trees = qw(dogwood malpe river_birch maple dogwood);

  W> my %treehash=();

= () is redundant.

  W> @treehash{@Trees} = ();
  W> my @NewTrees = sort keys %treehash;

who needs temp variables?

my @NewTrees = sort keys %{ map { $_ -> 1 } @Trees } ;

:)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 12 Jul 2001 12:38:29 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Advanced Sorting
Message-Id: <jr837.19$x84.1227@vic.nntp.telstra.net>

"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7hewiyi71.fsf@home.sysarch.com...
> >>>>> "W" == Wyzelli  <wyzelli@yahoo.com> writes:
>
>   W> my @Trees = qw(dogwood malpe river_birch maple dogwood);
>
>   W> my %treehash=();
>
> = () is redundant.
>
>   W> @treehash{@Trees} = ();
>   W> my @NewTrees = sort keys %treehash;
>
> who needs temp variables?
>
> my @NewTrees = sort keys %{ map { $_ -> 1 } @Trees } ;
>

That is what I was trying to work out how to do.. use map to autovivify an
anonymous hash and the pass the keys through sort.  But the documentation is
woefully inadequate when it comes to that sort of thing, and I don't have
access to any of my books here.

Anyway, how I did it is the FAQ answer, so you better tell the FAQ server to
update itself.. hehe.

But, I still love these little snippets, as I reckon I learn more by these
than most of my reading.  Thanks again!

Wyzelli
--
@x='074117115116032097110111116104101114032080101114108032104097099107101114
'=~/(...)/g;
print chr for @x;




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

Date: 11 Jul 2001 22:23:44 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Advanced Sorting
Message-Id: <9ij580$3e5$1@charity.cs.utexas.edu>

In article <jr837.19$x84.1227@vic.nntp.telstra.net>,
Wyzelli <wyzelli@yahoo.com> wrote:
>"Uri Guttman" <uri@sysarch.com> wrote in message
>news:x7hewiyi71.fsf@home.sysarch.com...
>> >>>>> "W" == Wyzelli  <wyzelli@yahoo.com> writes:
>>
>>   W> my @Trees = qw(dogwood malpe river_birch maple dogwood);
>>   W> my %treehash=();
>>   W> @treehash{@Trees} = ();
>>   W> my @NewTrees = sort keys %treehash;

>> who needs temp variables?
>>
>> my @NewTrees = sort keys %{ map { $_ -> 1 } @Trees } ;

>That is what I was trying to work out how to do.. use map to autovivify an
>anonymous hash and the pass the keys through sort.  But the documentation is
>woefully inadequate when it comes to that sort of thing

First of all, it should be "=>" instead of "->", although I'd bet
that's just a typo.

Second of all, I'm not sure you're actually autovivifying an anonymous
hash.  IIRC, autovivifying is when you do something that indirectly
implies the existence of an anonymous hash (or other anonymous thing)
and Perl creates it for you.

Finally, I don't think the documentation is all that inadequate in this
area.  First of all, "perldoc -f map" gives you this example:

	%hash = map { getkey($_) => $_ } @array;

It's certainly clear from somewhere in the documentation that braces,
in a place where a scalar value is expected, build an anonymous hash
out of the list the braces contain and return a reference to it.

And then, it's also clear that % can be used with a hash reference.

So really, the documentation tells you how to write this:

	my $x = { map { $_ => 1 } @Trees };
	my @NewTrees = sort keys %$x;

and all you've got to do is compose those two lines together into
the above.

  - Logan
-- 
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_


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

Date: Thu, 12 Jul 2001 03:36:59 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Advanced Sorting
Message-Id: <x7elrmyg0z.fsf@home.sysarch.com>

>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:

  >> "Uri Guttman" <uri@sysarch.com> wrote in message

  >>> my @NewTrees = sort keys %{ map { $_ -> 1 } @Trees } ;

  LS> First of all, it should be "=>" instead of "->", although I'd bet
  LS> that's just a typo.

yep. been a long day and a much longer week.

  LS> Second of all, I'm not sure you're actually autovivifying an anonymous
  LS> hash.  IIRC, autovivifying is when you do something that indirectly
  LS> implies the existence of an anonymous hash (or other anonymous thing)
  LS> and Perl creates it for you.

just creating an anon hash is not autovivifying. that happens when you
dereference a undefined scalar and it gets stuffed with a reference. see
my article on autoviv at:

	http://tlc.perlarchive.com/articles/perl/ug0002.shtml

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Thu, 12 Jul 2001 14:59:51 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Advanced Sorting
Message-Id: <Ova37.24$x84.1434@vic.nntp.telstra.net>

"Logan Shaw" <logan@cs.utexas.edu> wrote in message
news:9ij580$3e5$1@charity.cs.utexas.edu...
> In article <jr837.19$x84.1227@vic.nntp.telstra.net>,
> Finally, I don't think the documentation is all that inadequate in this
> area.  First of all, "perldoc -f map" gives you this example:
>
> %hash = map { getkey($_) => $_ } @array;

Well, perhaps you could explain to me what 'getkey' is? I get 'undefined
subroutine' for it (which I expect).  I consider documentation that contains
incomplete examples to be poor.  How is the reader supposed to know what
getkey() returns?

> It's certainly clear from somewhere in the documentation that braces,
> in a place where a scalar value is expected, build an anonymous hash
> out of the list the braces contain and return a reference to it.

Yes, from 'somewhere in the documentation'.  It is true that that is implied
knowlege about braces and what they can do.

> And then, it's also clear that % can be used with a hash reference.

Agreed.

> So really, the documentation tells you how to write this:
>
> my $x = { map { $_ => 1 } @Trees };

Assumed typo - %x

> my @NewTrees = sort keys %$x;
>
> and all you've got to do is compose those two lines together into
> the above.

I don't quite see how it becomes obvious that a block with map in it can
become a hash by the addition of %

I see that it does it, but IMHO it is a fair extrapolation from one to the
other, which is why Uri's (and others) little Perls of wisdom are so
appreciated.  They allow the connection to be made.  In fact, your pointing
it out, has also helped to see why it is doing what it is doing, and the
syntax.

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
$d='$_$a$s$b$w';$e='$_$a$s$b';sub d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
sub
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";




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

Date: Thu, 12 Jul 2001 01:22:35 +0200
From: Fabrice Leclerc <leclerc.fabrice@wanadoo.fr>
Subject: Re: argument in regular expression
Message-Id: <leclerc.fabrice-A165C9.01223512072001@news.wanadoo.fr>


>> perl -ne '$/ = "\n\n"; print if (/position:$i-/);' input >> output
>> 
>> what is the correct syntax to have the variable i replaced in the
>> searched pattern by its value ?
>
>Are you trying to find a string with the text "position:" followed by a
>number in the range 1-3000 followed by "-"?
>
>perl -ne '$/ = "\n\n"; print if /position:(\d+)-/ and $1 >= 1 and $1 <=
>3000;' input >> output
>

yes, that's it. thanks. 
I was initially calling the perl command in a shell script in which $i 
was included in a loop (while $i <= 3000). I found I could do it this 
way:
while ( $i <= 3000 )
perl -ne '$/ = "\n\n"; print if /position:'$i'-/;' input >> output
end
obviously, it's much more elegant to do it your way.


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

Date: Thu, 12 Jul 2001 00:30:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: argument in regular expression
Message-Id: <3B4CEFA2.2EAAE1D7@acm.org>

Fabrice Leclerc wrote:
> 
> >> perl -ne '$/ = "\n\n"; print if (/position:$i-/);' input >> output
> >>
> >> what is the correct syntax to have the variable i replaced in the
> >> searched pattern by its value ?
> >
> >Are you trying to find a string with the text "position:" followed by a
> >number in the range 1-3000 followed by "-"?
> >
> >perl -ne '$/ = "\n\n"; print if /position:(\d+)-/ and $1 >= 1 and $1 <=
> >3000;' input >> output
> >
> 
> yes, that's it. thanks.
> I was initially calling the perl command in a shell script in which $i
> was included in a loop (while $i <= 3000). I found I could do it this
> way:
> while ( $i <= 3000 )
> perl -ne '$/ = "\n\n"; print if /position:'$i'-/;' input >> output
> end
> obviously, it's much more elegant to do it your way.

Actually you should change that so that $/ isn't set each time in the
loop (_may_ be faster)

perl -ne'BEGIN {$/="\n\n"} print if /position:(\d+)-/ and $1 >= 1 and $1
<= 3000;' input >> output



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 11 Jul 2001 18:53:54 -0400
From: LM <ellem@webcombo.net>
Subject: Re: Beginner to Perl
Message-Id: <i6mpkt04qekp1s4dcfsbrpe1b1ukm4lmqp@4ax.com>

On Wed, 11 Jul 2001 10:30:20 +0930, "Wyzelli" <wyzelli@yahoo.com>
wrote wonderful things about sparkplugs:

>"dr0id" <dr0id-@webtv.net> wrote in message
>news:20153-3B4B8309-33@storefull-228.iap.bryant.webtv.net...
>> Hello everyone.  

SNIP
>
>http://www.manning.com/Johnson/index.html
>
>Can't praise this one highly enough, especially for the beginner.

This ONE is the winner

>
>Wyzelli



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

Date: Thu, 12 Jul 2001 00:16:40 -0500
From: Laron Andrion Walker <lwalker@ecn.purdue.edu>
Subject: detecting new pop3 email....
Message-Id: <Pine.GSO.4.33.0107120014400.6709-100000@min.ecn.purdue.edu>

anyone know of a way todmodule, but it dosen't seem to want to work for
me.

thanks,

Laron



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

Date: Thu, 12 Jul 2001 00:17:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: What are the Perl newsgroups on Usenet?  Where do I post questions?
Message-Id: <10637.33$T3.182618112@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  What are the Perl newsgroups on Usenet?  Where do I post questions?

    The now defunct comp.lang.perl newsgroup has been superseded by the
    following groups:

        comp.lang.perl.announce             Moderated announcement group
        comp.lang.perl.misc                 Very busy group about Perl in general
        comp.lang.perl.moderated            Moderated discussion group
        comp.lang.perl.modules              Use and development of Perl modules
        comp.lang.perl.tk                   Using Tk (and X) from Perl

        comp.infosystems.www.authoring.cgi  Writing CGI scripts for the Web.

    There is also Usenet gateway to the mailing list used by the crack Perl
    development team (perl5-porters) at
    news://news.perl.com/perl.porters-gw/ .

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           02.09
-- 
    This space intentionally left blank


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

Date: Wed, 11 Jul 2001 19:05:26 -0500
From: "Adam Stewart" <Stewy@Chartermi.net>
Subject: Getting Started.
Message-Id: <tkpn35p6jv9n31@corp.supernews.com>

Ok. I know a few things about perl, but I don't really understand what I am
doing. I have the latest version of perl on my Windows 98 os, now that you
know that where is a good website, or what is a good book to help me move
along with this?

Yeah there are probly a ton of posts here asking the same thing, so why not
just look for them?!?! Well because I am to darn lazy and I got get going,
but maybe that's just the excuse to not look so bad ;)






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

Date: Thu, 12 Jul 2001 01:09:41 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Getting Started.
Message-Id: <Xns90DBD7DEC2D8Fechangnetstormnet@207.106.92.86>

"Adam Stewart" <Stewy@Chartermi.net> wrote in
<tkpn35p6jv9n31@corp.supernews.com>: 

> Ok. I know a few things about perl, but I don't really understand
> what I am doing. I have the latest version of perl on my Windows 98
> os, now that you know that where is a good website, or what is a
> good book to help me move along with this?
> 
> Yeah there are probly a ton of posts here asking the same thing, so
> why not just look for them?!?! 

Yes there are. Without even searching, a look at the threads on this 
group at groups.google.com has "Beginner to Perl" as the second on in 
the list with exactly the same question.  You can look there.

> Well because I am to darn lazy and I
> got get going, but maybe that's just the excuse to not look so bad
> ;) 

If being darn lazy is an excuse to not look so bad, I shudder to think 
of what you define as looking bad.

-- 
EBC


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

Date: Thu, 12 Jul 2001 07:03:09 +0200
From: Philip Newton <pne-news-20010712@newton.digitalspace.net>
Subject: Re: I'm starting to think our 5.6 install is braindead
Message-Id: <tqaqktopno2f6ktf97b2s49uh7r18qd3lj@4ax.com>

On Wed, 11 Jul 2001 20:34:56 GMT, tuxy <ns@cfl.rr.com> wrote:

> The debugger doesn't show me the blocks as it steps.

Try using the 'w' command occasionally to show you a 'w'indow of lines
around the current line.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Thu, 12 Jul 2001 02:27:15 +0100
From: "Cro" <cro@freeallangels.com>
Subject: Javascript? Frames? eek! Can't I have CGI?
Message-Id: <9iiu9f$oia$8@plutonium.btinternet.com>

Hi,
    I throw myself at my knees and beg for your help!
    I have a good working search facility. It works great except it needs to
use frames and javascript, neither of which I want it to due to browser
incompatibility problems. It is called in my web page using this line of
html:

<script language="JavaScript" type="text/javascript"
src="search.js"></script>

The actual 'search box' is defined as follows:

<form action="javascript:void(0)" method="get" onsubmit="search(this);
return false;">
</form>

The 'search.js' file contains the following:

var item = new Array();

// Search Data

// "Path","","Item Name","Many,Key,Words","Descriptive Comments"

c=0; item[c]=new
Array("/fruits/apple.shtml","","Apple","pips,core,peel","");
c++; item[c]=new
Array("/fruits/banana.shtml","","Banana","skin,yellow,","");

// Many more items like this.........

// End Data

page="<html><head><title>Search Results</title></head><body
bgcolor='#00CCFF'><script language='JavaScript'>self.resizeTo(200,
200);</script><font size='1' face='Arial,Helvetica,sans-serif'><table
border=0 cellspacing=0 width=100%>";


function search(frm) {
win = window.open("","","scrollbars");
win.document.write(page);
frm.srchval.value = frm.srchval.value.toLowerCase();
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] != "")
fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write("</table><br>Search returned "+total+"
result(s)<br><br><p align='center'><a href='javascript:window.close()'>Close
Search Window</a></p></body></html>");
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = "<tr><td><a href='"+link+"' target='main'>"+item[which][2]+"</a>";
line += item[which][4] + "<br></td></tr>";
wind.document.write(line);
return 1;

// END SCRIPT

The script stores the information that is to be searched in the array and
then writes the results to a small pop up window. The links in this window
are loaded into the original (parent) browser (this is why frames are needed
as the links are loaded into 'Main')

What I would like help with is converting this script to CGI and instead of
writing the results to a pop up page, redirect the user to a search results
page with the results written in.

I know this is a lot to ask but I am really stuck on this one.

He who solves may be rewarded! (as if the enormous feeling of well being
wasn't enough!)

Regards,
Paul






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

Date: Thu, 12 Jul 2001 04:31:21 GMT
From: "Prarie Dawn" <prarie dawn   @hotmail.com>
Subject: mod_perl question
Message-Id: <994912281.855403@atlas.corp.au.home.com>

Hi,

I'm slightly confused about what is required to install mod_perl.

I notice that NT users often resort to a pre-built Apache binary with
mod_perl...

Why is this?  Does mod_perl need to be "compiled" into the binary?

My host gives me access to Apache configuration files.  I was hoping I could
just compile mod_perl and supply Apache with a shared object (.so file).

I've tried this, but with little luck so far.... I'm worried that mod_perl
might require integration with the Apache binary in some way.

thanks for any clues




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

Date: Thu, 12 Jul 2001 02:57:25 GMT
From: Akira Yamanita <ayamanita.nospam@bigfoot.com>
Subject: Re: Net::Telnet logging on problem.....
Message-Id: <3B4D1209.2C07DDF1@bigfoot.com>

Manuel Hölß wrote:
> 
> > print @test;
> 
> I see. I thought the print-command has to be followed by a scalar.
> But the problem was that the Array was concatenated with "\n" and here
> it appeared in scalar context.

No argument there.

> > I think that what you propose would double-space the lines.
> 
> If the array-elements already have their newline-charakters

True, but the way it's being read in, there would only be
one element if the newlines weren't there.


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

Date: Thu, 12 Jul 2001 03:29:36 GMT
From: "JMS" <scott@mirrorstores.com>
Subject: Re: Perl/Sendmail not sending mail?
Message-Id: <AQ837.155745$v5.11900365@news1.rdc1.ct.home.com>

$me = 'el\@foo.com';

should be..

$me = "el\@foo.com";

Scott



"el" <el@wilmington.net> wrote in message
news:58929d2c.0107110117.793c7e02@posting.google.com...
> Hi all -
> I've been banging my head against a wall for two days trying to figure
> out what is wrong with my script.  I've even stripped it down to the
> bare minimum and started building it up again, but am still having
> problems.
>
> I'm not getting any errors (note the error sub calls), and everything
> "appears" to run ok, but I'm not recieving any email when I test the
> script.  Can someone please help me figure out what I'm doing wrong?
>
> __________
> sub notify {
>   $mailprog = '/usr/lib/sendmail';
>   $me = 'el\@foo.com';
>   open(EMAIL, "|$mailprog $email") || &error("Sendmail error: $!");
>   print EMAIL "To: $email\n";
>   print EMAIL "Reply-to: $me\n";
>   print EMAIL "From: Your Community <$me>\n";
>   print EMAIL "Subject: LogIn Reminder\n\n";
>   print EMAIL <<"EMSG";
> Please keep this information in a secure place:
> Login Identity: $usrid
> Password: $passwd
>
> Thank you for helping us build our community.
> EMSG
>   close(EMAIL) || &error("Sendmail error: $!");
> }
> ___________
>
> According to telnet, I can use /usr/lib/sendmail or
> /usr/sbin/sendmail.  I have tested open(EMAIL ... using "-t," "-oi,"
> "-t -oi," and "$email".  I tested it using "return close(EMAIL);"
> since I am calling  sendmail from a subroutine.  And I tested it using
> an "or die" statement instead of calling my error sub.  My permissions
> are set at 0755 (I even tested the script using 0777) in a directory
> with 0777 permissions.
>
> As I said, everything looks like it works: no error's returned, etc.,
> it just doesn't actually send the e-mail.  Can anyone "see" what I am
> doing wrong?
> TIA, el




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

Date: Thu, 12 Jul 2001 00:28:12 -0400
From: "James Richardson" <time4tea@monmouth.com>
Subject: Re: Socket programming problem
Message-Id: <9ij954$p1c$1@slb1.atl.mindspring.net>


"Dustin Lee" <leed@ucdavis.edu> wrote in message
news:9iigk6$b7b$1@woodrow.ucdavis.edu...

[pretty yuk code]

Flicking quickly through your code, your appear to think that a write of n
bytes will always succeed in one go, which is absolutely not the case.

In pseudo [aka i hope i didnt forget anything] code it should look something
like

my $request = "blah"

while ( length ( $request ) ) {
        my $sent = $socket->syswrite ( $request, 8192 );
        if ( $!{EAGAIN} ) {
            $sent ||= 0;
        }
        elsif ( ! defined ( $sent ) ) {
            return disconnect_client ( $socket  );
        }

        if ( $sent ) {
            $request = substr ( $request , $sent );
        }
}

That is, loop around sending bits n bobs until you sent the whole request.

Receiving is the same.

Its more difficult if you have multiple connections.

HTH

James




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

Date: 12 Jul 2001 06:52:07 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Socket programming problem
Message-Id: <slrn9kqi8n.qk1.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 12 Jul 2001 00:28:12 -0400,
    James Richardson <time4tea@monmouth.com> wrote:


>
>my $request = "blah"
>
>while ( length ( $request ) ) {
>        my $sent = $socket->syswrite ( $request, 8192 );
>        if ( $!{EAGAIN} ) {
>            $sent ||= 0;
>        }

I beleive it is wrong to make a dicission based on $! (aka errno)
unless you first have determined that syswrite did return an error.
That is: if $sent is a positive value returned from syswrite then
there was no error regardless of the value of $!.  This is true
for the underlying unix C library, and I beleive this extends to
the usage of $! in perl as well.

>        elsif ( ! defined ( $sent ) ) {
>            return disconnect_client ( $socket  );
>        }
>
>        if ( $sent ) {
>            $request = substr ( $request , $sent );
>        }
>}
>



Villy


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

Date: Wed, 11 Jul 2001 18:13:00 -0500
From: "Eric Schultz" <hammy@charter.net>
Subject: Thanks that fixed it
Message-Id: <tkpnfbmcp7jnce@corp.supernews.com>

Thanks that fixed it, the help is greatly appreciated

Eric Schultz


"Gary E. Ansok" <ansok@alumni.caltech.edu> wrote in message
news:9iijg5$2of@gap.cco.caltech.edu...
> In article <tkpgakh9ca2e4f@corp.supernews.com>,
> Eric Schultz <hammy@charter.net> wrote:
> >I'm having a problem with a program I made and I can't figure out what's
> >wrong with it. A form sends login email and password to this file and
this
> >file checks the user flat-file database against it. (Below is the source
> >code, with notes) I'm having a problem in this area:
> >
> >if ($realcustpass eq $form_pass){
> >&newlogincookie;
> >print "Location:$form_redir\n\n";
> >exit;
> >}
> >
> >For some reason when $realcustpass does equal $form_pass that conditional
> >won't run. Its as if the two aren't equal but they are, I've checked a
> >number of times.
>
> Have you checked to make sure that there aren't any extra characters
> (like a newline, or trailing spaces) that might make the two strings
> different but not show up in a simple print?
>
> Something like
>     print "Real = >>$realcustpass<< ", length($realcustpass), "\n";
> and similarly for $form_pass.
>
> You don't show us where $realcustpass comes from, but if you're reading
> it from a file it's quite possible it still has a \n on it -- chomp()
> is probably the best way to get rid of it, if that's the problem.
>
> Gary Ansok




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

Date: Thu, 12 Jul 2001 07:03:08 +0200
From: Philip Newton <pne-news-20010712@newton.digitalspace.net>
Subject: Re: trimming blank
Message-Id: <5faqktcmpvstqatb4if78n03nbecudjpeq@4ax.com>

On Wed, 11 Jul 2001 17:51:46 -0400, Benjamin Goldberg
<goldbb2@earthlink.net> wrote:

> my $string = "             Hello World          ";
> $string =~ s/\A\s*(.*?)\s*\z/$1/s;
> Or:
> $string =~ s/\A\s*|\s*\z//gs;
> 
> It may be faster (I would benchmark if I were you) to do this:

It probably is, judging from my recollection of benchmarks others wrote
in the past.

> $string =~ s/\A\s*//; $string =~ s/\s*\z//;

Why use \s*? That wastes time replacing zero blank spaces at the
beginning and end of strings such as 'hello world'.

> There's no harm in using ^ instead of \A (except in the /g case), but if
> you use $ instead of \z, then you will end up leaving on a trailing \n,
> if there is one.

The \n should be matched by the \s+ since "\n" =~ /\s/. Did you try it
out? So ^ and $ will do just fine here.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 12 Jul 2001 02:06:42 GMT
From: blstone77@aol.com (Blstone77)
Subject: Re: URL String Problem
Message-Id: <20010711220642.03652.00003776@ng-cf1.aol.com>

Thanks all, very helpful


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

Date: 11 Jul 2001 16:12:30 -0700
From: michael_of_neb@yahoo.com (Mike)
Subject: using perl to interact with httpS page
Message-Id: <5a10590e.0107111512.2314d3ab@posting.google.com>

Hi.

I want to be able to open a httpS page, (secured http) look at it,
fill in a form on it if it has one, and then submit it, and get the
response back to the submission.

For reasons that I would rather not declare, I would like to do this
from Windows (active state) and perhaps later from Unix.

This Windows part is important.

It would appear that I have to do quite a bit of stuff to the Perl
version I have on the machine(s).

Is there somebody who has a Windows 98 installation and a perl routine
that already does this out there ?

I would REALLY like to talk to you.

I would like to make it worth your while.

Mike


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

Date: Thu, 12 Jul 2001 11:24:58 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Very good regex question?
Message-Id: <lm737.17$x84.866@vic.nntp.telstra.net>

"Philip Newton" <pne-news-20010711@newton.digitalspace.net> wrote in message
news:rn3oktsh7nhmj5uvmkofi4u7p66tfbk11q@4ax.com...
> On Wed, 11 Jul 2001 17:27:48 +0930, "Wyzelli" <wyzelli@yahoo.com> wrote:
>
> > "Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message
> > news:9ih00t$195g$1@agate.berkeley.edu...
> > > Strictly speaking, this is wrong.  A lot of strings have "two ends of
> > > string" in the sense that $ can match in two places.  [Not applicable
> > > to \'$\, of course.]
> >
> > That could lead to semantics, but I know what you are saying, although I
> > doubt it would apply here, (embedded line endings in a multiline string
for
> > example) but those type of assumtions are the ones which tend to bite
us...
>
> I don't think multiline strings are what he meant; rather, that /$/ can
> match either at the end of string (like /\z/) or at a newline just
> before the end (like /(?=\n\z)/). So /o[^f]$/ could match "foo\n" either
> as at "oo"-before-\n or at "o\n"-before-end-of-string.
>

I see what you are saying there, but what ends the string if the \n doesn't?

Or is that one of those atomic matches like \b?

Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";





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

Date: Thu, 12 Jul 2001 07:03:09 +0200
From: Philip Newton <pne-news-20010712@newton.digitalspace.net>
Subject: Re: Very good regex question?
Message-Id: <vuaqktos1cbvvdlirlac5liust6oev4ou8@4ax.com>

On Thu, 12 Jul 2001 11:24:58 +0930, "Wyzelli" <wyzelli@yahoo.com> wrote:

> "Philip Newton" <pne-news-20010711@newton.digitalspace.net> wrote in message
> news:rn3oktsh7nhmj5uvmkofi4u7p66tfbk11q@4ax.com...
> > I don't think multiline strings are what he meant; rather, that /$/ can
> > match either at the end of string (like /\z/) or at a newline just
> > before the end (like /(?=\n\z)/). So /o[^f]$/ could match "foo\n" either
> > as at "oo"-before-\n or at "o\n"-before-end-of-string.
> 
> I see what you are saying there, but what ends the string if the \n doesn't?

Er, the end of the string. Perl doesn't need anything to end a string
since it stores the length in its scalars. So 'foo' is three characters
long and doesn't need a "\n" or "\0" to end it.

> Or is that one of those atomic matches like \b?

Atomic? (That, to me, means "happening all at once".) $ is a zero-width
assertion that matches either a) the end of the string, or b) just
before a "\n" at the end of a string.

So if you read in a line from a file and it still has the "\n" on it
(say "This is a line\n"), then that line will match /a line$/, even
though 'a line' is not at the end of the string. That pattern will not,
however, match "This is a line\n\n" or "This is a line\n " since then
the \n after 'line' is not at the end of the string itself.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Thu, 12 Jul 2001 06:16:15 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Very good regex question?
Message-Id: <3b4d3f0d.62346098@news.grnet.gr>

On Wed, 11 Jul 2001 16:52:55 +0930, "Wyzelli" <wyzelli@yahoo.com>
wrote:

>s/'((\w')?[\w]+)('s)?'/$1/;

This and your other one liner both convert 'doesn't' to doesnt'. Also,
I'm assuming that the OP only wanted to trim a trailing 's, not '\w.

The following works for all the OP's examples, without having the
'doesn't' problem:

my @strings = qw( foobar foobar's 'foobar's' O'Reilly O'Reilly's
'O'Reilly' 'O'Reilly's' doesn't 'doesn't' );

foreach ( @strings ){
	s/^'*(.+?)'*s*'*$/$1/;
	print "$_\n";
}

No doubt somebody here can make it much neater, though.

Phil
-- 
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: 11 Jul 2001 22:20:53 GMT
From: ansok@alumni.caltech.edu (Gary E. Ansok)
Subject: Re: Why doesn't this program work?
Message-Id: <9iijg5$2of@gap.cco.caltech.edu>

In article <tkpgakh9ca2e4f@corp.supernews.com>,
Eric Schultz <hammy@charter.net> wrote:
>I'm having a problem with a program I made and I can't figure out what's
>wrong with it. A form sends login email and password to this file and this
>file checks the user flat-file database against it. (Below is the source
>code, with notes) I'm having a problem in this area:
>
>if ($realcustpass eq $form_pass){
>&newlogincookie;
>print "Location:$form_redir\n\n";
>exit;
>}
>
>For some reason when $realcustpass does equal $form_pass that conditional
>won't run. Its as if the two aren't equal but they are, I've checked a
>number of times. 

Have you checked to make sure that there aren't any extra characters
(like a newline, or trailing spaces) that might make the two strings
different but not show up in a simple print?

Something like
    print "Real = >>$realcustpass<< ", length($realcustpass), "\n";
and similarly for $form_pass.

You don't show us where $realcustpass comes from, but if you're reading
it from a file it's quite possible it still has a \n on it -- chomp()
is probably the best way to get rid of it, if that's the problem.

Gary Ansok


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

Date: Wed, 11 Jul 2001 22:55:17 GMT
From: troll@gimptroll.com (TuNNe|ing)
Subject: Re: why is Vars an undefined subroutine?
Message-Id: <3b4cf6bf.7380804@news>

On Wed, 11 Jul 2001 21:40:02 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

[snip]
>Mine is 2.752. Question is: when did Vars() get added?
[/snip]
Do you have Vars() with that version?
I have version 2.46.

Is there not a revision history kept as a part of documentation? I
couldn't find when Vars() was add either.

TuNNe|ing


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

Date: Thu, 12 Jul 2001 01:13:06 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: why is Vars an undefined subroutine?
Message-Id: <Xns90DBD87284A14echangnetstormnet@207.106.92.86>

troll@gimptroll.com (TuNNe|ing) wrote in <3b4cf6bf.7380804@news>:

>On Wed, 11 Jul 2001 21:40:02 GMT, Bart Lateur <bart.lateur@skynet.be>
>wrote:

[snip]

>Is there not a revision history kept as a part of documentation? I
>couldn't find when Vars() was add either.

From the documentation at http://stein.cshl.org/WWW/software/CGI/

  Version 2.50
     1.Added a new Vars() method to retrieve all parameters as a tied 
hash. 


-- 
EBC


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.announce, send your article to
clpa@perl.com.

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

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


------------------------------
End of Perl-Users Digest V10 Issue 1290
***************************************


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