[16530] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3942 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 7 21:05:27 2000

Date: Mon, 7 Aug 2000 18:05:14 -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: <965696714-v9-i3942@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 7 Aug 2000     Volume: 9 Number: 3942

Today's topics:
    Re: Box size algorithm? <sluppy@my-deja.com>
        DBI: LAST_INSERT_ID() getting the value of <linux@worsdall.demon.co.uk>
        Different input_record_separator for different files. (Mike Van Pelt)
    Re: find the number of characters in a string (Craig Berry)
    Re: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
    Re: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
    Re: find the number of characters in a string <lr@hpl.hp.com>
    Re: find the number of characters in a string <lr@hpl.hp.com>
    Re: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
    Re: find the number of characters in a string <godzilla@stomp.stomp.tokyo>
    Re: find the number of characters in a string (Craig Berry)
    Re: find the number of characters in a string (Craig Berry)
        HTML Table To Text --How? Dennis@nospam.com
    Re: Impossible RegEx Problem <rickysregistration@hotmail.com>
        Interesection and subtraction of data sets. <blavender@spk.usace.army.mil>
    Re: Is "exit()" really necessary? (Richard J. Rauenzahn)
        Largest files tosh_v@my-deja.com
        Mail::Mailer - multiple recipients? nancy@bigfishmail.com
    Re: Newbie error: arrays are not returned from subs cor <tim@ipac.caltech.edu>
    Re: Perl and Ftp question (David Efflandt)
    Re: perlscript has problems with sendmail (David Efflandt)
    Re: Problem with NT & Excel <jeff@vpservices.com>
    Re: Problem with NT & Excel robert_linne_nelson@my-deja.com
    Re: Reap ? <billy@arnis-bsl.com>
        reg expression query <troyr@vicnet.net.au>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 07 Aug 2000 22:20:40 GMT
From: sluppy <sluppy@my-deja.com>
Subject: Re: Box size algorithm?
Message-Id: <8mncnk$pc5$1@nnrp1.deja.com>

In article <8F8999B07indigodimcom@166.93.207.145>,
  SPAM+indigo@dimensional.com (Tim) wrote:
> Unfortunately, this reduces to the well known "Knapsack Problem",
which
> has no known efficient algorithm that finds the optimal solution.  It
may
> be possible to devise a heuristic algorithm that gives acceptable
results,
> but that is off topic for a Perl newsgroup.  Perhaps a newsgroup on
> algorithms or computer theory would be of more use to you.

Thanks, Tim. With those two words, "Knapsack Problem," you just
significantly changed my life. :) I've found plenty on it already. Let's
see if I can understand it enough to make a workable solution for my
situation.

Thanks again!

--T


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


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

Date: Mon, 7 Aug 2000 23:15:27 +0100
From: Mark Worsdall <linux@worsdall.demon.co.uk>
Subject: DBI: LAST_INSERT_ID() getting the value of
Message-Id: <e+ErIJA$Tzj5EwUp@worsdall.demon.co.uk>

Hi,

How can I return into my own variable the last auto inc id after an
insert?

This doesn't work:-(

$sth = $dbh->prepare("SELECT LAST_INSERT_ID() FROM SearchPhrases");
$sth->execute();
$sth->finish();
$phrases_id = $sth->fetchrow_array();
print "ID: $phrases_id\n";

-- 
He came from Econet - Oh no, I've run out of underpants :(
Home:- jaydee@wizdom.org.uk       http://www.wizdom.org.uk
Shadow:- webmaster@shadow.org.uk  http://www.shadow.org.uk
Work:- netman@hinwick.demon.co.uk http://www.hinwick.demon.co.uk
Web site Monitoring:-             http://www.shadow.org.uk/SiteSight/


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

Date: 7 Aug 2000 23:58:50 GMT
From: mvp@netcom.com (Mike Van Pelt)
Subject: Different input_record_separator for different files.
Message-Id: <8mnifq$rsk$1@nntp9.atl.mindspring.net>

Is there a way to have a different input_record_separator for
different open files?

I'm trying to write a program for which one file needs to
be read with a different input_record_separator than the other.

One file is a socket, the other is normally input from a
program.  (For this testing, input from a plain file.)

------------
use IO::Socket;
use FileHandle;

$smtphost="mailhost";
$smtpport = 25;

# create a tcp connection to the specified host and port
$smtp = IO::Socket::INET->new(Proto     => "tcp",
                              PeerAddr  => $smtphost,
                              PeerPort  => $smtpport)
       or die "can't connect to port $smtpport on $smtphost: $!";

$smtp->autoflush(1);              # so output gets there right away

open(LDAP,"</tmp/ldif");

open(NOMAIL,">people-with-no-email");

LDAP->input_record_separator("");    # paragraph mode on LDAP
$smtp->input_record_separator("\n"); # line mode on $smtp
------------

But record separators for both files get set the same.

In debug mode, right after the set of $smtp's separator:

  DB<1> print "(", LDAP->input_record_separator, ")"
(
)
  DB<2> print "(", $smtp->input_record_separator, ")"
)
)

Comment out the $smtp separator line, and

  DB<1> print "(", LDAP->input_record_separator, ")"
()
  DB<2> print "(", $smtp->input_record_separator, ")"
()

Huh?  Is there only one global input_record_separator for all
open files?  If not, how come the separator for $smtp is changed
when I set the separator for LDAP?  How come setting the
separator for $smtp changes the separator for LDAP back to \n?

Or am I completely misconstruing something? 

-- 
Yes, I am the last man to have walked on the moon,    | Mike Van Pelt
and that's a very dubious and disappointing honor.    | mvp@netcom.com
It's been far too long.     -- Gene Cernan            | KE6BVH


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

Date: Mon, 07 Aug 2000 22:02:56 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: find the number of characters in a string
Message-Id: <soucgg9t63a185@corp.supernews.com>

jliu34740@my-deja.com wrote:
: I have a string defined as follows:
: $_ = "9 of 15 cats are there";
: how do I count the number of letters in the above string?

Locate some sufficently narrow pointing device.  Use it to indicate the
first character of the string above, saying "one" under your breath.  Move
the pointing device one character right, and say "two".  Continuing moving
right and counting upward until you run out of characters.  The last
number you say is the length of the string.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: Mon, 07 Aug 2000 15:05:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: find the number of characters in a string
Message-Id: <398F32C1.E9D646C3@stomp.stomp.tokyo>

Ala Qumsieh wrote:
 
> Jim Mauldin wrote:
> > "Godzilla!" wrote:

( Jim's method  $string =~ tr/A-Za-z//; )

> > > $letters = $string =~ tr/a-zA-Z/a-zA-Z/;

> > is correct;
 
> Your example is still better, IMHO. It does NOT wipe out
> the letters:
 
(snippage)

Ummm... I am not so sure about this not wiping out
the letters. My concept of mechanics of transliteration
is somewhat different than yours. However, this is not
to say my concept is factually correct. Perhaps those
letters are wiped out and immediately replaced? Maybe
a copy, destroy, replace process is what happens. An
investigation of core process would yield what actually
does take place.

Both Mr. Mauldin's and my example are not the 'best' method
to use as exemplified by a side note I made later. This
side note comments on avoiding messing with your data and
comments on a classic Hissy Bug. Nonetheless, both of our
examples provide correct solutions for parameters given.

Seems this is a matter of personal style rather than
a technical issue.

Godzilla!


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

Date: Mon, 07 Aug 2000 15:20:02 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: find the number of characters in a string
Message-Id: <398F3612.A22FE9C2@stomp.stomp.tokyo>

Craig Berry wrote:
 
> jliu34740 wrote:

> : I have a string defined as follows:
> : $_ = "9 of 15 cats are there";
> : how do I count the number of letters in the above string?
 
> Locate some sufficently narrow pointing device.  Use it to
> indicate the first character of the string above, saying
> "one" under your breath.  Move the pointing device one 
> character right, and say "two".  Continuing moving right 
> and counting upward until you run out of characters.  The 
> last number you say is the length of the string.


What method would you personally use to count letters?

Godzilla!

--
Jesus is just alright with me for rocking.
  http://la.znet.com/~callgirl3/jesus.mid


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

Date: Mon, 7 Aug 2000 15:46:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: find the number of characters in a string
Message-Id: <MPG.13f8dc19a7960adf98ac45@nntp.hpl.hp.com>

In article <398F3612.A22FE9C2@stomp.stomp.tokyo> on Mon, 07 Aug 2000 
15:20:02 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
> Craig Berry wrote:
>  
> > jliu34740 wrote:
> 
> > : I have a string defined as follows:
> > : $_ = "9 of 15 cats are there";
> > : how do I count the number of letters in the above string?
>  
> > Locate some sufficently narrow pointing device.  Use it to
> > indicate the first character of the string above, saying
> > "one" under your breath.  Move the pointing device one 
> > character right, and say "two".  Continuing moving right 
> > and counting upward until you run out of characters.  The 
> > last number you say is the length of the string.
> 
> What method would you personally use to count letters?

I put the marker to the left of the first character (if any), and say 
"zero".  From then on, Craig's algorithm works just fine.  But I get the 
boundary case right also.

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


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

Date: Mon, 7 Aug 2000 15:51:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: find the number of characters in a string
Message-Id: <MPG.13f8dd46293461c098ac46@nntp.hpl.hp.com>

In article <398F32C1.E9D646C3@stomp.stomp.tokyo> on Mon, 07 Aug 2000 
15:05:53 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
+ Ala Qumsieh wrote:
+  
+ > Jim Mauldin wrote:
+ > > "Godzilla!" wrote:
+ 
+ ( Jim's method  $string =~ tr/A-Za-z//; )
+ 
+ > > > $letters = $string =~ tr/a-zA-Z/a-zA-Z/;
+ 
+ > > is correct;
+  
+ > Your example is still better, IMHO. It does NOT wipe out
+ > the letters:
+  
+ (snippage)
+ 
+ Ummm... I am not so sure about this not wiping out
+ the letters. My concept of mechanics of transliteration
+ is somewhat different than yours. However, this is not
+ to say my concept is factually correct. Perhaps those
+ letters are wiped out and immediately replaced? Maybe
+ a copy, destroy, replace process is what happens. An
+ investigation of core process would yield what actually
+ does take place.

1.  Operationally, there is no difference in the output, so who cares?

2.  The documentation explicitly states that these two expressions 
generate identical code.

+ Both Mr. Mauldin's and my example are not the 'best' method
+ to use as exemplified by a side note I made later. This
+ side note comments on avoiding messing with your data and
+ comments on a classic Hissy Bug. Nonetheless, both of our
+ examples provide correct solutions for parameters given.

Huh?  What bug are you braying about now?

+ Seems this is a matter of personal style rather than
+ a technical issue.

It is a matter of programming skill and language knowledge.  Entering 
redundant information twice can lead to typographical errors and can 
mislead the reader of the code into thinking there is a difference, or 
why do the extra work?  This is a clear-cut example where Laziness wins 
on every count.

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


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

Date: Mon, 07 Aug 2000 16:11:43 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: find the number of characters in a string
Message-Id: <398F422F.48E0852E@stomp.stomp.tokyo>

Larry Rosler wrote:
 
> Godzilla! enjoys a belly laugh:
> > Craig Berry wrote:
> > > jliu34740 wrote:

> > > : I have a string defined as follows:
> > > : $_ = "9 of 15 cats are there";
> > > : how do I count the number of letters in the above string?

> > > Locate some sufficently narrow pointing device.  Use it to
> > > indicate the first character of the string above, saying
> > > "one" under your breath.  Move the pointing device one
> > > character right, and say "two".  Continuing moving right
> > > and counting upward until you run out of characters.  The
> > > last number you say is the length of the string.

> > What method would you personally use to count letters?
 
> I put the marker to the left of the first character (if any), and say
> "zero".  From then on, Craig's algorithm works just fine.  But I get the
> boundary case right also.


Seems logical. What method would you personally
use to count letters?

Godzilla!

--
Excuse me while I kiss the sky, then I will rock you.
  http://la.znet.com/~callgirl3/purphaze.mid


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

Date: Mon, 07 Aug 2000 16:52:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: find the number of characters in a string
Message-Id: <398F4BD5.E3212C65@stomp.stomp.tokyo>

Larry Rosler wrote:

> Godzilla! chortles:
> + Ala Qumsieh wrote:
> + > Jim Mauldin wrote:
> + > > "Godzilla!" snickers:

(snippage)

> + Both Mr. Mauldin's and my example are not the 'best' method
> + to use as exemplified by a side note I made later. This
> + side note comments on avoiding messing with your data and
> + comments on a classic Hissy Bug. Nonetheless, both of our
> + examples provide correct solutions for parameters given.
 
> Huh?  What bug are you braying about now?

Oh, this is a well documented bug which jumps up
and down within this newsgroup, quite frequently.

RTFM.

HTH. HAND. FINGER. FUBAR. 

Godzilla!

--
My girl can't drive 55 in her Corvette Mako Shark.
Our garage rear wall is in shambles. She will rock you.
  http://la.znet.com/~callgirl5/55.mid


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

Date: Tue, 08 Aug 2000 00:24:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: find the number of characters in a string
Message-Id: <soukpj1j63a82@corp.supernews.com>

Godzilla! (godzilla@stomp.stomp.tokyo) wrote:
: What method would you personally use to count letters?

Given a string in $_:

* To count the number of characters, I would use length.
* To count the number of standard alphabet letters, I would use
  tr/A-Za-z//.
* To count the number of letter characters, respecting the current
  locale, I would use s/([^\W\d_])/$1/g in scalar context.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: Tue, 08 Aug 2000 00:25:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: find the number of characters in a string
Message-Id: <souksc7763a46@corp.supernews.com>

Larry Rosler (lr@hpl.hp.com) wrote:
: I put the marker to the left of the first character (if any), and say 
: "zero".  From then on, Craig's algorithm works just fine.  But I get the 
: boundary case right also.

Ah, but using the verbal equivalent to Perl's value transformation rules,
my silence is an empty string, which evaluates to zero when used
numerically. :) 

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: Mon, 07 Aug 2000 17:31:20 -0500
From: Dennis@nospam.com
Subject: HTML Table To Text --How?
Message-Id: <h1euosohc76coc5njtbmsp7e794e8d2967@4ax.com>

Many Web sites present their data in HTML Table format..you know <table>...
bunch of stuff...</table>.

While both Netscape and Explorer can easily save the HTML table to a text file,
this seems to be an almost impossible feat for a perl script.   Please, please
correct me if I'm wrong.  The Netscape route is ok if you want to display the
results in a web browser but not ok if you just want the information on  100+
different web tables so that you can plug the raw numbers into another program.

Yes I've read the perldocs.  Here are the methods that I tried and the failure
of each.

The HTML file is 68K and the resulting Netscape "save as" text file is 8k.

I tried the below parsing routines without success:  Also these failed under
Perl 5.005 and 5.6
----------------------------------------------------------------------------------
  my $plain_text;
  $plain_text = HTML::FormatText->new->format(parse_html($content));

This gave me "Can't find parse_html routine" .  I searched CPAN but could not
find the routine.

-----------------------------------------------------------------------------
   my $p = HTML::Parser->new;  # should really a be subclass
   $p->parse($content);
   print $p;

This gave me the following error...don't know what it's asking for but no
output:
---------- Perl Execute ----------
HTML::Parser=HASH(0x813b18)
Normal Termination
Output completed (2 sec consumed).

---------------------------------------------------------------------------
This time I tried to read directly a stored htm file.

require HTML:FormatText;   
my $html = parse_htmfile("c:\\ibm.htm);
my $formater =  HTML::FormatText->new(leftmargin =>0, rightmargin => 50;
   print $formater->format($html);

This perl routine never came back it just hung.

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

Any suggestions out there?  I'm sure I'm not the first to want to do a HTML2TXT
in Perl on 100+ web pages.

Dennis Meyers
dennisATmeyersanalytics.com



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

Date: Tue, 08 Aug 2000 00:34:03 GMT
From: "Earthlink News" <rickysregistration@hotmail.com>
Subject: Re: Impossible RegEx Problem
Message-Id: <%zIj5.27134$Z6.736633@newsread1.prod.itd.earthlink.net>


Keith Calvert Ivey <kcivey@cpcug.org> wrote in message
news:3995ad7f.62845329@news.newsguy.com...
> "Earthlink News" <rickysregistration@hotmail.com> wrote:
>
> If you're using a hash anyway, then why not use $hr{$p} instead
> of $$p?  Or if you need two copies of the data for some reason,
> use $hr2{$p} instead of $$p.  There doesn't seem to be any
> reason to have the symbolic references.
>

That's true... $hr{$p}, $$p, and $parameter (assuming $p='parameter') all
reference the same animal.  They should all be totally equivalent.  Is there
some kind of performance hit by using a symbolic reference in this case?  To
my mind, it's the easiest of the lot... $parameter is "hardcoded" in there
so the choice is really between the hash and the symbolic ref.  Since the
symbolic ref. is the easiest to type in (no messy curly brackets for my
fingers to go searching for), that's the one I went with.  This does get
used a LOT so if there's some kind of performance degradation, I'd rather
put in the extra effort of typing in the hash rather than waiting the 8 days
for the code to finish. :)

Adios,


Rick.





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

Date: Tue, 08 Aug 2000 00:15:20 GMT
From: Brian Lavender <blavender@spk.usace.army.mil>
Subject: Interesection and subtraction of data sets.
Message-Id: <8mnjel$ub2$1@nnrp1.deja.com>

I playing around with manipulating sets of data, and I was happy I
figured out how to find the interection between two sets, and how to
subtract one set from the other. I looked through the Perl Cookbook, but
I didn't find anything. Here is what I came up with. Any suggestions?

brian

#!/usr/local/bin/perl

@set_one = qw/one two/;
@set_two = qw/one two three four/;

my %set_two;
grep ($set_two{$_}++, @set_two);

print "Intersection between two sets\n";
my @result = grep($set_two{$_}, @set_one);

print "\@set_one ", join " ", @set_one, "\n";
print "\@set_two ", join " ", @set_two, "\n";
print "Result: ", join " ",@result , "\n";

print "\n";

@set_one = qw/harry larry curly moe barney/;
@set_two = qw/larry moe/;

grep ($set_two{$_}++, @set_two);

print "Subtract set two from set one\n";
@result = grep(!$set_two{$_}, @set_one);

print "\@set_one ", join " ", @set_one, "\n";
print "\@set_two ", join " ", @set_two, "\n";
print "Result: ", join " ",@result , "\n"

--
Brian E. Lavender
US Army Corps of Engineers -- Programmer / Systems Analyst
Sacramento, CA    (916) 557-6623


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


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

Date: 7 Aug 2000 23:19:23 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: Is "exit()" really necessary?
Message-Id: <965690362.554514@hpvablab.cup.hp.com>

tjla@guvfybir.qlaqaf.bet (Gwyn Judd) writes:
>nospam@hairball.cup.hp.com (Rich Rauenzahn) writes:
>>I think all of you might want to reread the CERT advisory, paying
>>particular attention to the date:
>>
>>	http://x73.deja.com/getdoc.xp?AN=605122255.1
>
>I read this document and I feel they missed the mark. Under certain
>circumstances it is still possible to fail to exit properly therefore I
>have come up with the following:
>
>sub pleaseohgodpleasesomebodykillme {
>    my $status = shift;

Perhaps enclose the following block of code in a 'while' loop?

>    exit $status or
>    die $status or
>    kill 1, $$ or
>    eval "kill 9, $$" or
[...]

>}
>
>I'm still working on it though

You're right.  I think an additional technique might be to write an
XS/perl extension that dereferences 0 in order to force the process to
exit:

int exitnow() {
   strcpy(0,"pleaseexit");
}

Since this occurs at the hardware level, it is more likely to cause the
process to exit.  It should only be used as a last resort, though,
because invalid memory accesses can cause poor performance.

HTH,
	Rich


-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: Tue, 08 Aug 2000 00:30:46 GMT
From: tosh_v@my-deja.com
Subject: Largest files
Message-Id: <8mnkbm$usc$1@nnrp1.deja.com>

Hi,

I have a huge dir structure with .wrp files and I need to get the 10
biggest or 20 or any number I specify so that i can test my app to see
ho wit handles the largest files.

Any help on a perl script would be much appreciated.

tosh



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


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

Date: Tue, 08 Aug 2000 00:43:49 GMT
From: nancy@bigfishmail.com
Subject: Mail::Mailer - multiple recipients?
Message-Id: <8mnl45$va3$1@nnrp1.deja.com>

Using the Mail::Mailer module, I am able to send a mail using the
following chunk of code (actually, I'm using 'test', so no mail gets
sent):
$mailer->open({ From    => $From,
                To      => ['a@a.com','b@b.com','c@c.com'],
                Subject => $Subject});

However, when I change the To line to:
                To      => @To,
if only sends the message to the first recipient listed.

@To is an array that has slurped in the To addresses from the arguments
to the script (@To = @ARGV, script named send_message, called
with ./send_message a@a.com b@b.com c@c.com), it only sends mail to the
first recipient found in the @To array.

Is there something missing here?




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


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

Date: Mon, 07 Aug 2000 17:55:03 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Newbie error: arrays are not returned from subs correctly
Message-Id: <398F5A67.8F538C68@ipac.caltech.edu>

Too much code to grok, but this much is clear; you need to read 'perldoc
-f my' paying special attention to the meaning of the word "scope". E.g.

if(1) {
  my $b = 1;
}
# No more $b!

vs.

my $b;
if(1) { $b = 1; }
# $b still defined!


--

-- Tim Conrow         tim@ipac.caltech.edu       626-395-8435


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

Date: Tue, 8 Aug 2000 00:37:01 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Perl and Ftp question
Message-Id: <slrn8oulgt.ej.efflandt@efflandt.xnet.com>

On Mon, 07 Aug 2000, sankarmukh@my-deja.com <sankarmukh@my-deja.com> wrote:
>The following script just have a blinking cursor. I don't know what's
>wrong?
>
>********************************************************
>#!/usr/local/bin/perl -I /u/ctssmuk/myperllib/lib/site_perl/5.005/Net
>use blib;
>use Net::FTP;
>use Getopt::Long;
>
>##################################################
>#Name:ftp_test.pl
>
>###################################################
>
>
>$ftp= Net::FTP-> new ("hsdfs01") ;
>$ftp->login ("prod");
>$ftp->pwd;
>$ftp->quit;
>****************************************************

Is "hsdfs01" a valid hostname in DNS or your hosts file?
Is "prod" a valid guest account there (that accepts any password)?
You don't test if anything is successful and do not print anything at all,
so what result are you expecting?

This works for me:

use Net::FTP;
$ftp = Net::FTP-> new ("localhost");
$ftp->login () || die "Can't login";
print "Current dir is ", $ftp->pwd, "\n";
$ftp->quit;


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Tue, 8 Aug 2000 00:58:15 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: perlscript has problems with sendmail
Message-Id: <slrn8oumon.ej.efflandt@efflandt.xnet.com>

On Mon, 07 Aug 2000, johands@hotmail.com <johands@hotmail.com> wrote:
>
> i have a problem with sendmail (it's located at /usr/sbin/sendmail of
>my account at www.virtualave.net)

A 500 server error means your script has major problems and did not even
precompile.  Maybe you forgot to upload it as ASCII text.  I have
sources for scripts related to mail at http://cgi-help.virtualave.net/pub/

The regular open sendmail method used to be delayed for hours due to an
unknown spam filter, although, the last time I tried it it worked
immediately.  So I also demonstrate a verbose method using open3, which
does send immediately and will display any mail connection errors.

I don't think the smtp server has reverse DNS lookup, so that may be a
problem for some spam filters on the receiving end.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Mon, 07 Aug 2000 15:25:12 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Problem with NT & Excel
Message-Id: <398F3748.FB408547@vpservices.com>


robert_linne_nelson@my-deja.com wrote:
> 
> Software Error:
> Can't call method "Workbooks" on unblessed reference at
> D:\InetPub\intranet\intranet_2000\phonebook\search_dir.pl line 92.
> ...
> I'm not sure what this means but I'm instaniating $xl_app using this
> line of code:
>   $xl_app = CreateObject OLE 'Excel.Application' || die $!;

$! is for normal file opens and has nothing to do with OLE, use instead:

my $xl_app = Win32::OLE->new('Excel.Application')
             or die Win32::OLE->LastError();

-- 
Jeff


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

Date: Mon, 07 Aug 2000 23:30:23 GMT
From: robert_linne_nelson@my-deja.com
Subject: Re: Problem with NT & Excel
Message-Id: <8mngqh$sam$1@nnrp1.deja.com>


> $! is for normal file opens and has nothing to do with OLE, use
instead:>

> my $xl_app = Win32::OLE->new('Excel.Application')
>              or die Win32::OLE->LastError();
>
> --
> Jeff
>

Ok, here's the error I'm getting from OLE:

Win32::OLE(0.1101) error 0x80070005: "Access is denied" at
D:\InetPub\intranet\intranet_2000\phonebook\search_dir.pl line 89.

Does this have something to do with file permissions in NT?

thanks once again,

-Robert Nelson


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


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

Date: Mon, 07 Aug 2000 17:53:20 -0500
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Reap ?
Message-Id: <398F3DE0.79B372E4@arnis-bsl.com>

Tim Hammerquist wrote:
> 
> derek_chen@my-deja.com wrote:
> > sub REAP {
> >     1 until (-1 == waitpid(-1, WNOHANG));
> >     $SIG{CHLD} = \&REAP;
> > }
> > $SIG{CHLD} = \&REAP;
> >
> > This is the example to demonstrate how to avoid the zombie process
> > occur.But I'm wondering when does the sub REAP execute?And why are there
> > two $SIG{CHLD} = \&REAP .I tried to comment the first in the subroutine
> > and it worked as normal.why?The last question is ,I really can't
> > understand why the zombie won't occur with these codes.Thanks for help.
> >
> > Derek
> 
> REAP() executes when the program receives a CHLD signal.  Some signal
> handlers need to reinstall themselves each time they are called; CHLD is
> one of those.  See perlipc for more info.
> 

IMHO, better is to say: on some systems signal handlers need
to reinstall themselves.

Ilja.


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

Date: Tue, 8 Aug 2000 10:29:54 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: reg expression query
Message-Id: <SxIj5.78072$N4.1984192@ozemail.com.au>

Hi guys,
             I have $variable which contains the following text
"events in Indonesia. Links to related sites LINKS links"

I have $keyword="Links"

$variable=~ s/$keyword/<b>$keyword<\/b>/g;

Ok..that makes Links in variable bold when spat out in html. Is there a
simple way for me to be able to look for LINKS or links as well?

Ta :)

--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------




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

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


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