[16044] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3456 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 22 18:10:44 2000

Date: Thu, 22 Jun 2000 15:10:31 -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: <961711830-v9-i3456@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 22 Jun 2000     Volume: 9 Number: 3456

Today's topics:
        foreach loop and sendmail .. <csorensen@uptimeresources.net>
    Re: foreach loop and sendmail .. <care227@attglobal.net>
    Re: foreach loop and sendmail .. <csorensen@uptimeresources.net>
    Re: foreach loop and sendmail .. <care227@attglobal.net>
    Re: foreach loop and sendmail .. <csorensen@uptimeresources.net>
    Re: foreach loop and sendmail .. <care227@attglobal.net>
    Re: foreach loop and sendmail .. bschaettle@olmmed.org
    Re: Get all POS in regexp (Greg Bacon)
    Re: help on perl format function <rootbeer@redcat.com>
    Re: How do I pass var from command line? (Greg Bacon)
    Re: Its Late... Im really Tired... <rootbeer@redcat.com>
    Re: Looking for mortgage calculations <rootbeer@redcat.com>
        NonAlpha Substitution <webmaster@[spamblock]web-slingers.com>
    Re: NonAlpha Substitution <care227@attglobal.net>
    Re: NonAlpha Substitution <rootbeer@redcat.com>
    Re: NonAlpha Substitution <care227@attglobal.net>
    Re: NOT a Newbie Form - Perl - mail?! <Jon@KCSOnline.co.uk>
    Re: NOT a Newbie Form - Perl - mail?! <care227@attglobal.net>
    Re: Number or string item in an array? <rootbeer@redcat.com>
        padding a string with leading zeros <ez4glNOezSPAM@hotmail.com.invalid>
    Re: padding a string with leading zeros <tony_curtis32@yahoo.com>
    Re: padding a string with leading zeros <stephenk@cc.gatech.edu>
    Re: Passing filehandles to subroutines (Greg Bacon)
    Re: perl / win32 and threads <harasty@my-deja.com>
    Re: perl / win32 and threads <harasty@my-deja.com>
    Re: perl / win32 and threads <rootbeer@redcat.com>
    Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does no <rootbeer@redcat.com>
    Re: perl for automated scp <rootbeer@redcat.com>
    Re: Perl Network Programming (Greg Bacon)
    Re: Perl Network Programming <care227@attglobal.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 22 Jun 2000 14:24:42 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: foreach loop and sendmail ..
Message-Id: <395259DD.FDD64BEA@uptimeresources.net>

Hello all - I'm trying to write a very simple script that will read in a
list of email addresses and a the body of a message, iterate thru the
list of addresses and send each one a copy of the message.

Would you review my code and tell me what you think? I'm not sure of my
syntax on the foreach loop ..


#!/usr/bin/perl

# use sendmail
$sendmail = "/usr/lib/sendmail -t -n";

# let's declare some variables for sendmail
$reply_to = "csorensen@uptimeresources.net";
$subject = "South African tourism survey";

# open list of email addresses
open ADDRESS, "< address.txt" or die "can't open file: $!";

# read list into array
@mail_to = ADDRESS;

# read in email message
open BODY, "< message.txt" or die "can't open file: $!";

# assign the message to a variable
$content = BODY;

# iterate thru thu the email list and send each address a message

foreach (@mail_to) {

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print $reply_to;
print $subject;
print $mail_to;
print "Content-type: text/plain\n\n";
print $content;
close(SENDMAIL); 
 
  }


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

Date: Thu, 22 Jun 2000 14:39:42 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: foreach loop and sendmail ..
Message-Id: <39525D6E.61EAE7DC@attglobal.net>

Chris Sorensen wrote:
> 
> Hello all - I'm trying to write a very simple script that will read in a
> list of email addresses and a the body of a message, iterate thru the
> list of addresses and send each one a copy of the message.
> 
> Would you review my code and tell me what you think? I'm not sure of my
> syntax on the foreach loop ..
> 
> #!/usr/bin/perl

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

When opening a pipe to sendmail, you have to be extra carefull,
since there are so many ways to exploit the command line.  using
Taint mode is always a good thing for CGI anyway, so lets add it 
here.  -w adds our warnings.  use strict; is also good practice.


> $sendmail = "/usr/lib/sendmail -t -n";
> 

(...)
> 
> foreach (@mail_to) {
> 
> open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
> print $reply_to;
> print $subject;
> print $mail_to;
> print "Content-type: text/plain\n\n";
> print $content;
> close(SENDMAIL);
> 
>   }

That foreach() causes alot of I/O, why not open that FIFO to 
sendmail outside of the loop instead of opening and closing it 
possbily dozens of times? And why not use a nifty module like
Mail::Mailer to make it even easier?  (not sure if it is 
safer)

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";

foreach(@mail_to) 
{
	print $reply_to;
	print $subject;
	print $mail_to;
	print "Content-type: text/plain\n\n";
	print $content;
}

close(SENDMAIL);


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

Date: 22 Jun 2000 14:48:28 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: foreach loop and sendmail ..
Message-Id: <39525F6F.831B7C4A@uptimeresources.net>



good point .. made this change

> 
> open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
> 
> foreach(@mail_to)
> {
>         print $reply_to;
>         print $subject;
>         print $mail_to;
>         print "Content-type: text/plain\n\n";
>         print $content;
> }
> 
> close(SENDMAIL);


here's what -w shows when I run this puppy 

Name "main::ADDRESS" used only once: possible typo at mailme.pl line 13.
Name "main::BODY" used only once: possible typo at mailme.pl line 19.
Use of uninitialized value at mailme.pl line 32.
csorensen@uptimeresources.netSouth African tourism surveyContent-type:
text/plain

No recipient addresses found in header
BODY


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

Date: Thu, 22 Jun 2000 14:57:11 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: foreach loop and sendmail ..
Message-Id: <39526187.C2B9263B@attglobal.net>

Chris Sorensen wrote:
> 
> good point .. made this change
> 
> >
> > open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
> >
> > foreach(@mail_to)
> > {
> >         print $reply_to;
> >         print $subject;
> >         print $mail_to;
> >         print "Content-type: text/plain\n\n";
> >         print $content;
> > }
> >
> > close(SENDMAIL);

Ugh.  I fear I've overlooked the obvious.  You aren't printing
to the filehandle.  

         print SENDMAIL "$reply_to\n";
         print SENDMAIL "$subject\n";
         print SENDMAIL "$mail_to\n";
         print SENDMAIL "Content-type: text/plain\n\n";
         print SENDMAIL $content;

And then you have to give sendmail its . all alone to signal EOF.

Look at:  
http://search.cpan.org/doc/GBARR/MailTools-1.1401/Mail/Mailer.pm

And see if its not a bit cleaner.  I really prefer Mail::Mailer 
when sending mail.  Much nicer.


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

Date: 22 Jun 2000 16:13:45 EDT
From: Chris Sorensen <csorensen@uptimeresources.net>
Subject: Re: foreach loop and sendmail ..
Message-Id: <3952736C.B8841DE6@uptimeresources.net>

here's the script .. it works fine .. but it would work alot faster if I
knew the command to send email from sendmail without closing sendmail

if I run the script with the open and close sendmail statements outside
the loop .. it writes each email message into one message and mails it
 .. 




#!/usr/bin/perl

# use sendmail
$sendmail = "/usr/lib/sendmail -t";

# let's declare some variables for sendmail
$reply_to = 'csorensen@uptimeresources.net';
$subject = "South African tourism survey";

# open list of email addresses
open ADDRESS, "address.txt" or die "can't open file: $!";

# read list into array
@mail_to = <ADDRESS>;

# read in email message
open BODY, "message.txt" or die "can't open file: $!";

# assign the message to a variable
$content = <BODY>;

# iterate thru thu the email list and send each address a message

foreach (@mail_to) {

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";

	print SENDMAIL "To: $_ \n";
	print SENDMAIL "From: csorensen\@uptimeresources.net \n";
	print SENDMAIL "Subject: South African tourism survey \n";  
	print SENDMAIL "Content-type: text/plain \n\n";  
	print SENDMAIL $content;

close(SENDMAIL);
}


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

Date: Thu, 22 Jun 2000 16:23:35 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: foreach loop and sendmail ..
Message-Id: <395275C7.BB1FB846@attglobal.net>

Chris Sorensen wrote:
> 
> here's the script .. it works fine .. but it would work alot faster if I
> knew the command to send email from sendmail without closing sendmail
> 
> if I run the script with the open and close sendmail statements outside
> the loop .. it writes each email message into one message and mails it
> ..

I don't know Sendmail syntax either. Thats why I always use 
Mail::Mailer or Mail::Send.  Both are available via CPAN,
both can interface with Sendmail for you.  Check them out
and see if they make the script execute faster...


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

Date: Thu, 22 Jun 2000 21:43:19 GMT
From: bschaettle@olmmed.org
Subject: Re: foreach loop and sendmail ..
Message-Id: <8iu19h$p4r$1@nnrp1.deja.com>

In article <39526187.C2B9263B@attglobal.net>,
  Drew Simonis <care227@attglobal.net> wrote:
> Chris Sorensen wrote:
> >
> > good point .. made this change
   . . . .
>          print SENDMAIL $content;
>
> And then you have to give sendmail its . all alone to signal EOF.
>

 .....what do you mean by that last comment -- "give sendmail its . all
alone to signal EOF" ??


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


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

Date: Thu, 22 Jun 2000 21:30:09 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Get all POS in regexp
Message-Id: <sl51b179e7f118@corp.supernews.com>

In article <8iti4l$2le2@imsp212.netvigator.com>,
    multiplexor <abuse@localhost> wrote:

: And I do the substitution like:
: 
: $data =~ s/$search/=$search=/g;
: 
: Then I want to get the result like this:
: @position = (2, 4, 6)
: 
: which is all the positions of $search in $data. This is similar to the
: "index" function but I would like to use regexp and pos to do the task.

You may want to use a hammer to drive a screw, but a screwdriver is
still a better choice for the job.

Greg
-- 
Petty laws breed great crimes.
    -- Ouida


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

Date: Thu, 22 Jun 2000 12:30:54 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: help on perl format function
Message-Id: <Pine.GSO.4.10.10006221228240.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000, Drew Simonis wrote:

> Could the text that FORMAT outputs be a pointer to a file containing
> an image?  Such as an <img> tag for HTML display?

In theory, yes. But formats are a lousy way to make HTML. You'd probably
have to wrap it all in a <pre> tag. There's not much point in it. Cheers!

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



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

Date: Thu, 22 Jun 2000 20:25:19 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: How do I pass var from command line?
Message-Id: <sl4thfrpe7f26@corp.supernews.com>

In article <8itd32$8ia$1@nnrp1.deja.com>,
     <fperkins@my-deja.com> wrote:

: My script is expecting to receive $file.
: 
: From an unix command line, I do:
: 
: /usr/local/bin/perl /script/script.cgi?$file=test.dat
: 
: However, in unix,  it tells me that it cant find the script, which
: makes sense cause it uses ?* as part of the file name.
: 
: I know the above notation is to pass a variable from a web browser, how
: can I do it from a command line?

If you use the CGI module, running your program from the command line
will result in the CGI module prompting you for the parameters.

Greg
-- 
Since I was running Windows, I did the normal thing you do when you
encounter problems: I rebooted.
    -- Simson Garfinkel


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

Date: Thu, 22 Jun 2000 13:16:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Its Late... Im really Tired...
Message-Id: <Pine.GSO.4.10.10006221313550.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000 drew@i4free.co.nz wrote:

> Subject: Its Late... Im really Tired...

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I know hwo to do this but I can't think...
> 
> How do u parse a form input from a textarea form... so that teh returns
> do no taffect it when u write it to a file..

Please don't use 'k3wl' spellings on Usenet. It sounds as if you want to
convert newlines to spaces, or something similar. You can do that with a
substitution (s///), or perhaps a transliteration (tr///).

> eg
> $msg =~ s/\%([0-9A-F]{2})/\x$1/g;

That looks as if you should be using the CGI module instead. Cheers!

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



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

Date: Thu, 22 Jun 2000 13:29:35 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Looking for mortgage calculations
Message-Id: <Pine.GSO.4.10.10006221328380.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000 nater@vlender.com wrote:

>   I am looking for the formulas for mortgage calculators, specifically
> rent vs own (buy) calculation.  I have browsed the web, but have only
> been able to find the actual calculators running behind cgi scripts
> that I cannot Seem to find any help on the source.
> 
>   If anyone has these formulas that would be willing to share them, I
> would greatly appreciate it.

They're not secret formulas; any good librarian should be able to help you
to locate them! :-)

But I think you want this:

    http://search.cpan.org/search?dist=Math-Financial

Cheers!

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



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

Date: Thu, 22 Jun 2000 16:16:05 -0400
From: "Rick Stricker" <webmaster@[spamblock]web-slingers.com>
Subject: NonAlpha Substitution
Message-Id: <395273d2.0@speedtrap.i2k.com>

I have an HTML form which accepts data and dumps it
to a text file.  I've found that if someone presses Enter
as part of their input, it ends the record and creates
another.

I want to take the contents of <TEXTAREA> and remove
any occurrences of Enter/NewLine.

I know I want to use the Search Expression:
     $MYvar =~ s/A/a/g;
but I need to be able to specify Enter as the value to be
replaced.  I presume I'm looking for the ASCII value of
Enter (013?) but I'm not sure of the syntax for identifying
it as an ASCII value.

I've been through the web looking, but to no avail...




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

Date: Thu, 22 Jun 2000 16:29:09 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: NonAlpha Substitution
Message-Id: <39527715.79F08D8E@attglobal.net>

Rick Stricker wrote:
> 
> I have an HTML form which accepts data and dumps it
> to a text file.  I've found that if someone presses Enter
> as part of their input, it ends the record and creates
> another.
> 
> I want to take the contents of <TEXTAREA> and remove
> any occurrences of Enter/NewLine.
> 
> I know I want to use the Search Expression:
>      $MYvar =~ s/A/a/g;
> but I need to be able to specify Enter as the value to be
> replaced.  I presume I'm looking for the ASCII value of
> Enter (013?) but I'm not sure of the syntax for identifying
> it as an ASCII value.

/n is a newline, which is often what you'll get. You may want to 
search for a carriage return as well, which is /r


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

Date: Thu, 22 Jun 2000 14:05:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: NonAlpha Substitution
Message-Id: <Pine.GSO.4.10.10006221405120.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000, Drew Simonis wrote:

> /n is a newline, which is often what you'll get. You may want to 
> search for a carriage return as well, which is /r

Of course, you meant to use backslashes instead of forward slashes. But we
knew what you meant.

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



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

Date: Thu, 22 Jun 2000 17:11:48 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: NonAlpha Substitution
Message-Id: <39528114.1D53137A@attglobal.net>

Tom Phoenix wrote:
> 
> On Thu, 22 Jun 2000, Drew Simonis wrote:
> 
> > /n is a newline, which is often what you'll get. You may want to
> > search for a carriage return as well, which is /r
> 
> Of course, you meant to use backslashes instead of forward slashes. But we
> knew what you meant.
> 

Ugh.  Would you believe I'm dyslexic?


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

Date: Thu, 22 Jun 2000 21:08:48 +0100
From: "Jon Langley" <Jon@KCSOnline.co.uk>
Subject: Re: NOT a Newbie Form - Perl - mail?!
Message-Id: <8itrj9$he2$1@newsg4.svr.pol.co.uk>


> Rob Wrote
>
> If the server allows you can send the mail via SMTP. You sure mail or
> sendmail isn't on the machine?
> --

I log in via my isp, I have another company which looks after my web pages
(currently www.DevonNow.com) but the script doesnt work (I now have about 5
different versions of both the script and the contactus page.)

When I ring up the Web Server, they say that they dont have sendmail and
they always suggest blat to everyone.

Jon





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

Date: Thu, 22 Jun 2000 16:07:07 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: NOT a Newbie Form - Perl - mail?!
Message-Id: <395271EB.D86AECC5@attglobal.net>

Jon Langley wrote:
> 
> 
> When I ring up the Web Server, they say that they dont have sendmail and
> they always suggest blat to everyone.
> 
Thats not uncommon.  Sendmail is a beast to configure and is well 
known for security problems.  Were I you, I'd follow the ways of the 
module and use Mail::Mailer as suggested by FactoryJS


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

Date: Thu, 22 Jun 2000 12:11:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Number or string item in an array?
Message-Id: <Pine.GSO.4.10.10006221209490.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000, Bart Lateur wrote:

> >Why do you think you need to know this?
> 
> Er... because bitwise operators make the distinction?

No; in that case, you should make your operands explicitly numeric or
explicitly stringy to ensure that you get the operation you desire. In any
case, checking with a regular expression (or similarly) won't in general
tell you what a bitwise operator would have done. Cheers!

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



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

Date: Thu, 22 Jun 2000 12:09:42 -0700
From: ez4gl <ez4glNOezSPAM@hotmail.com.invalid>
Subject: padding a string with leading zeros
Message-Id: <278f3540.692c6456@usw-ex0101-005.remarq.com>

In trying to pad IP address octets with leading zeros for a
report I tried something like:

$octet = ((3 - length($octet)) x '0') . $octet;

But this did not change the value of octet whatsoever....my
thinking is that this may have something to do with zero being
evaluated as akin to false?!  So I tried the same but
substituted chr(48) for '0', with no effect....$octet remained
unchanged.

So I fell back on a C-style for loop:

for ($padZero = 3; $padZero > length($octet); $padZero--) {
  $octet = '0' . $octet;
}

And this works, but I'm just wondering if anybody might like to
share a more elegant solution....by the way, I utilized the docs
and faqs on cpan.org in attempting to solve this problem, and
also searched this newsgroup before posting....sorry if I missed
something already out there, and thanks in advance.

George

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: 22 Jun 2000 14:16:21 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: padding a string with leading zeros
Message-Id: <87snu5v856.fsf@limey.hpcc.uh.edu>

>> On Thu, 22 Jun 2000 12:09:42 -0700,
>> ez4gl <ez4glNOezSPAM@hotmail.com.invalid> said:

> In trying to pad IP address octets with leading zeros
> for a report I tried something like:

> $octet = ((3 - length($octet)) x '0') . $octet;

> But this did not change the value of octet
> whatsoever....my thinking is that this may have
> something to do with zero being evaluated as akin to
> false?!  So I tried the same but substituted chr(48) for

Nope.

> '0', with no effect....$octet remained unchanged.
> So I fell back on a C-style for loop:
> for ($padZero = 3; $padZero > length($octet);
> $padZero--) { $octet = '0' . $octet; }

sprintf '%03d', $octect

perldoc -f sprintf

-- 
"Trying is the first step towards failure"
                                           Homer Simpson


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

Date: Thu, 22 Jun 2000 17:53:16 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: padding a string with leading zeros
Message-Id: <39528ACC.287F1DA7@cc.gatech.edu>

ez4gl wrote:

> In trying to pad IP address octets with leading zeros for a
> report I tried something like:
>
> $octet = ((3 - length($octet)) x '0') . $octet;
>
> But this did not change the value of octet whatsoever....my
> thinking is that this may have something to do with zero being
> evaluated as akin to false?!  So I tried the same but
> substituted chr(48) for '0', with no effect....$octet remained
> unchanged.
>

I can think of 2 solutions (this assumes 3-digit octets):

1)
$octet = ('0' x (3 - length($octet))) . $octet;

2)
@values = '000'..'999';
$octet = $values[$octet];

--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: Thu, 22 Jun 2000 20:48:02 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Passing filehandles to subroutines
Message-Id: <sl4us25qe7f106@corp.supernews.com>

In article <slrn8l4cm8.n4n.tcsh@faure.cs.colostate.edu>,
    Mike <tcsh@holly.colostate.edu> wrote:

: tadmc@metronet.com (Tad McClellan):
:
: > On 21 Jun 2000 12:24:46 -0700, Mike <tcsh@holly.colostate.edu> wrote:
: > 
: >    perldoc -q filehandle
: 
: That's as helpful as typing filehandle in at perlfaq.com was.

Tad provided the relevant questions in the FAQ listing (that you
conveniently snipped).  It becomes dramatically easier when you lear
to help yourself.  That's why we ask people to read the FAQ first,
*BEFORE* posting.  As you've so nicely demonstrated, when people don't
read the FAQ, someone will point them to the FAQ only to be thanked
with some snippy remark.

: waters (9:30am) ~ >perldoc -q filehandle
: Unknown option: q

You need to upgrade.  It's often easier to just grep the pods.  Do
you know how to find the pods in your Perl installation?

Greg
-- 
They send you off to college to try to gain a little knowledge
But all you wanna do is learn how to score.
    -- Jimmy Buffett


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

Date: Thu, 22 Jun 2000 20:43:58 GMT
From: Dan Harasty <harasty@my-deja.com>
Subject: Re: perl / win32 and threads
Message-Id: <8ittq9$mb9$1@nnrp1.deja.com>

In article <8iqove$8k8$1@exnews.swisscom.com>,
  "philippe simonet" <philippe.simonet@swisscom.com> wrote:

> Are threads implemented with the activestate version of perl 5.6?

I have the exact same symptoms:

> perl -v gives :
> This is perl, v5.6.0 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)

My very simple script also dies with "No threads in this perl at..."

Any input, anybody?  I'm running WinNT 4.0 Workstation SP 5, on a new
Dell with lots of memory, disk, and CPU speed...

TIA -- DJH


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


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

Date: Thu, 22 Jun 2000 21:16:22 GMT
From: Dan Harasty <harasty@my-deja.com>
Subject: Re: perl / win32 and threads
Message-Id: <8itvml$nq0$1@nnrp1.deja.com>

In article <8iqove$8k8$1@exnews.swisscom.com>,
  "philippe simonet" <philippe.simonet@swisscom.com> wrote:
> Are threads implemented with the activestate version of perl 5.6?

OK -- some digging around at "bugs.activestate.com/ActivePerl" reveals
this (full text below): there is a "new" threading model, which
activestate does not *yet* support.

This is a real let-down considering the documentation with 5.6.0 for
threads clearly says "Supported Plaforms: Windows".

- Dan Harasty

========================================================

From: Jan Dubois <jand@ActiveState.com>
To: okabe@isl.ntt.co.jp
Cc: bugs@activestate.com, ActivePerl-Bugs@activestate.com
Subject: Re: I can't use threads (PR#35)
Date: Wed, 16 Feb 2000 15:54:07 -0800

On Wed, 16 Feb 2000 07:28:18 -0800, okabe@isl.ntt.co.jp wrote:

>perl -v says "This is perl, v5.5.650 built for
MSWin32-x86-multi-thread",

This means that ActivePerl will support the "new" threading model (one
interpreter per thread), but not the old model (multiple threads per
interpreter).

>but I can't use thread.Like below.
>C:\>perl -MThread -e "$t=new Thread \&sub1; sub sub1{print qq/Inthe
>thread\n/;}"
>No threads in this perl at -e line 1.

This doesn't work yet with the new threading model.

Ditto.

-Jan


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


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

Date: Thu, 22 Jun 2000 14:42:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl / win32 and threads
Message-Id: <Pine.GSO.4.10.10006221441560.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000, Dan Harasty wrote:

> This is a real let-down considering the documentation with 5.6.0 for
> threads clearly says "Supported Plaforms: Windows".

Supported, yes. Compiled-in by default, no. Still experimental, you bet.

:-)

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



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

Date: Thu, 22 Jun 2000 12:26:16 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does not
Message-Id: <Pine.GSO.4.10.10006221213530.4312-100000@user2.teleport.com>

On 22 Jun 2000, Anno Siegel wrote:

> Building a LoH via map is a common thing.  In fact it is hard to see
> what good a block { 1, $_ } should do in this place. Its value is the
> last statement executed, i.e. $_.  So the map, in this interpretation,
> does nothing but copy @_, which can be had cheaper.

Actually, that turns out not to be the case. The expression is evaluated
in a list context.

> But that's not for the compiler to decide.  It should take the hint
> from the presence or absence of a comma after the closing }.

That's a nice idea, but it seems to be impractical to implement. The
closing brace may not show up for many (many!) lines of code, for either
meaning. 

> Neither 5.003 nor 6.0 fulfill these expectations.

I think you meant 5.6.0 there, not 6.0. And do you really mean 5.003, and
not (say) 5.005_03? 5.003 is somewhat old.

> 5.003 tends to prefer the block interpretation: map { 1, $_} @_;
> copies @_, as it should, 

Does it really? It shouldn't, IMHO. Cheers!

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



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

Date: Thu, 22 Jun 2000 12:08:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl for automated scp
Message-Id: <Pine.GSO.4.10.10006221206250.4312-100000@user2.teleport.com>

On Thu, 22 Jun 2000, Rafael Garcia-Suarez wrote:

> SUID doesn't work on scripts on decent OSes.

Actually, this is no longer the case.

On bad old OSes, set-id scripts were - and still are - a security hole.
These should be replaced.

On some good new OSes, set-id scripts are just as good as set-id binaries.
Solaris and SunOS work like this.

On other good new OSes, Perl can emulate set-id scripting. Linux works
like this.

Cheers!

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



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

Date: Thu, 22 Jun 2000 19:08:19 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Perl Network Programming
Message-Id: <sl4p1360e7f154@corp.supernews.com>

In article <8it9a4$59r$1@nnrp1.deja.com>,
     <nfin8axs@hotmail.com> wrote:

: I am fairly new to Perl, but one of the things that I am interested
: in is the ability to hand craft your own TCP packets. I am by convention
: C coder (within the Linux platform) and I want to be able to extend some
: of the functionality of my Perl code to have this capacity.

If Perl doesn't provide what you want, you can write extensions in C.
See the perlxs and perlxstut manpages.

: As a separate issue, I was wondering about "type-casting: Is there any
: way I can force a numerical value upon a variable?
:  E.G.
: $input = <STDIN>; #user inputs: 12345?
: chop ($input);

Please consult the FAQ for the answer to this question.

: I have been doing the equivalent to $input=$input+1 but i
: know there has to be a better way to perform this function. Ultimately,
: this value will be used for comparison to over 700,000 cells in a hash
: table, so I need the value to be numeric (because numeric comparisons
: are faster than string.)

Remember that Perl uses separate operators for string and numeric
comparison.

Greg
-- 
Sometimes nothing can be a pretty cool hand.
    -- Cool Hand Luke


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

Date: Thu, 22 Jun 2000 15:10:42 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Perl Network Programming
Message-Id: <395264B2.24D9B290@attglobal.net>

Greg Bacon wrote:
> 
> : $input = <STDIN>; #user inputs: 12345?
> : chop ($input);

Isn't it better to use chomp() instead of chop()?


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3456
**************************************


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