[15450] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2860 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 25 14:10:27 2000

Date: Tue, 25 Apr 2000 11:10:17 -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: <956686217-v9-i2860@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Apr 2000     Volume: 9 Number: 2860

Today's topics:
    Re: How to replace these  strings in a html file (2nd p <lr@hpl.hp.com>
    Re: How to replace these  strings in a html file (2nd p <rootbeer@redcat.com>
    Re: HOW? auto execute perl on start session <rootbeer@redcat.com>
    Re: I'm about to lose a client!!! SOMEBODY HELP ME!!! <lr@hpl.hp.com>
        make install error <yaqoota@emirates.net.ae>
    Re: make install error <elaine@chaos.wustl.edu>
    Re: man2html <rootbeer@redcat.com>
    Re: min/max <lr@hpl.hp.com>
    Re: more string handling <redmonkey@madasafish.comx>
        multi-file search/replace <rsanford@nolimitsystems.com>
    Re: newbie: camel vs. llama <elaine@chaos.wustl.edu>
    Re: newbie: How many characters in each row? <bmb@ginger.libs.uga.edu>
        oracle client instalation jumac@my-deja.com
        Passing arguments to a perl script on NT <i.m.t.swartjes@wmw.utwente.nl>
    Re: Perl (UUCP mail server utility) hacking Mail::Send  <bgjohnso@unix.amherst.edu>
        Perl database Access <vautour@unb.ca>
    Re: Perl grammar? (Greg Bacon)
        perl problem??? <peterp100@hotmail.com>
    Re: PERL, FTP and MVS <sb@muccpu1.muc.sdm.de>
        question about formmail <patje1@hotmail.com>
        Question How can I su to a different user, and execute  (Dave LaPorte)
    Re: Recursion and scoping issue? (Bart Lateur)
    Re: REGEX tutorials ? (Mark-Jason Dominus)
        Retrieving file information from remote machines? <wyverny@hotmail.com>
        Security: why no '.' in path? jlamport@calarts.edu
        Set breakpoints in .perldb <kzeitler@lucent.com>
    Re: store hex in db, and retrieve as hex <rereidy@indra.com>
    Re: stress-test sandson@my-deja.com
        system return code problem <AlBundy@aol.net>
    Re: undefined value as a symbol reference <rootbeer@redcat.com>
    Re: using CPAN: what's all this junk!? jlamport@calarts.edu
        win32 ftp module... <kmojar@bmjgroup.com>
    Re: Writing to STDIN <rereidy@indra.com>
    Re: www.perlmonks.org <bmb@ginger.libs.uga.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Apr 2000 10:29:04 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to replace these  strings in a html file (2nd post)
Message-Id: <MPG.136f75b86469e1ba98a974@nntp.hpl.hp.com>

In article <e0aN4.3959$qY2.70095@newscontent-01.sprint.ca> on Tue, 25 
Apr 2000 01:32:08 -0400, Huy Vu <huyv@usa.net> says...
> I'm newbie in perl and have difficulty in trying to replace the string1
> below:
> 
> >·</FONT><FONT size=2  style="font-family:'Arial'; font-size:10pt; " >&nbsp;
> 
> with  string2=
> 
> >·</FONT><FONT size=2  style="font-family:'Arial'; font-size:9pt; "
> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT size=2
> style="font-family:'Arial'; font-size:10pt; " >
> 
> in file.htm
> 
> I tried the command below with Perl on NT4 but not successful
> I have difficulty in escaping the metacharacters in these strings.

You haven't shown the 'command below'.

> Thanks in advance for any help.

It will be hard to help without seeing what you have done.

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


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

Date: Tue, 25 Apr 2000 10:54:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to replace these  strings in a html file (2nd post)
Message-Id: <Pine.GSO.4.10.10004251041430.25963-100000@user2.teleport.com>

On Tue, 25 Apr 2000, Huy Vu wrote:

> Subject: How to replace these  strings in a html file (2nd post)

If your question didn't get an answer the first time you asked it, there
may be a good reason for that. Maybe it was unclear what you wanted.
Maybe it looked like you were asking for a fish, rather than asking to
learn how to fish.  Maybe nobody has an answer. Maybe you didn't wait
long enough before you gave up. Maybe it wasn't the most appropriate
newsgroup. There are lots of possible reasons. Posting again isn't
likely to fix any of them, unless you've changed something.

If you've asked clearly and no one has responded in a reasonable amount
of time, there's something else you can try before asking again. In
reading the newsgroup during the last month (you _have_ been doing that,
haven't you?) you must have noticed at least two or three people who
post frequently, politely, and accurately. A short, polite letter by
private e-mail to one of these folks asking for meta-help (help on
getting help on your problem) would not be out of line.

> I'm newbie in perl and have difficulty in trying to replace the string1
> below:
> 
> >·</FONT><FONT size=2  style="font-family:'Arial'; font-size:10pt; " >&nbsp;
> 
> with  string2=
> 
> >·</FONT><FONT size=2  style="font-family:'Arial'; font-size:9pt; "
> >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT size=2
> style="font-family:'Arial'; font-size:10pt; " >

> I tried the command below with Perl on NT4 but not successful

What "command below"? 

> I have difficulty in escaping the metacharacters in these strings.

First of all, it's generally a mistake to try to parse HTML with simple
regular expressions. But if you want what you say you want, you can do it
with a substitution of the s{}{}g variety. In the strings you supply, I
don't see any metacharacters which should need escaping there. But for
more information on escaping metacharacters, see the section on quote and
quote-like operators in the perlop manpage.

Good luck with it!

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



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

Date: Tue, 25 Apr 2000 10:40:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: HOW? auto execute perl on start session
Message-Id: <Pine.GSO.4.10.10004251038390.25963-100000@user2.teleport.com>

On Tue, 25 Apr 2000, Joshua Cheng wrote:

> does PERL have features like global.asa (in ASP) (to execute command
> lines on start session) ? plz let me know the filename?

I don't know what you mean. Do you mean you want to do something whenever
you log in? Search for the docs, FAQs, and newsgroups about your system.  
Do you mean you want to do something whenever someone views a web page?
Search for the docs, FAQs, and newsgroups about your webserver and how
it's configured at your site. Do you want something else entirely?

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



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

Date: Tue, 25 Apr 2000 10:04:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: I'm about to lose a client!!! SOMEBODY HELP ME!!!
Message-Id: <MPG.136f6ff051f741eb98a972@nntp.hpl.hp.com>

In article <3904F507.5204@modulus.com.au> on Tue, 25 Apr 2000 11:29:43 
+1000, Peter Hill <phill@modulus.com.au> says...

 ...

> my @array = <TXT>;
> foreach (@array) {

For line-at-a-time processing, it is wasteful of memory to slurp the 
entire file into an array before processing each element of the array.  
People may take what you wrote here as an acceptable Perl idiom.  It 
isn't!

  while (<TXT>) {

> 	tr/|/ /;
> 	print "$_<BR>\n";

Leaving newlines in HTML output to a browser is a good, humane idea.  
But adding a newline when there already is one is overkill.  :-)

> }

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


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

Date: Tue, 25 Apr 2000 17:30:20 +0400
From: "Quaid Joher" <yaqoota@emirates.net.ae>
Subject: make install error
Message-Id: <8e46g9$ktf1@news.emirates.net.ae>

While installing GD.pm, a perl interface for GD Module Library, I came
accross the following error.  Cann't make out where I have gone wrong.  I
have tried several combinations in the Makefile.PL script to see if this
error is avoided.

Can any geek guess where am I going wrong.  For secutity I have typed 'home'
inplace of my home directory name.

-----------------
bash-2.01$ pwd
/usr/www/home/prgm/GD-1.27
bash-2.01$ make test

PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -
I/usr/local/lib/perl5/5.
00502/i386-freebsd -I/usr/local/lib/perl5/5.00502 -e 'use
Test::Harness qw(&runt
ests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/GD................Can't load './blib/arch/auto/GD/GD.so' for module
GD: Can't
find shared library "libz.so.1.1" at /usr/local/lib/perl5/5.00502/i386-
freebsd/D
ynaLoader.pm line 168.

 at t/GD.t line 11
BEGIN failed--compilation aborted at t/GD.t line 11.
dubious
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-10
        Failed 10/10 tests, 0.00% okay
Failed Test  Status Wstat Total Fail  Failed  List of failed
--------------------------------------------------------------------------
-----
t/GD.t            2   512    10   10 100.00%  1-10
Failed 1/1 test scripts, 0.00% okay. 10/10 subtests failed, 0.00%
okay.

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

QUAID




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

Date: Tue, 25 Apr 2000 14:10:28 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: make install error
Message-Id: <B52B1FD4.2FD4%elaine@chaos.wustl.edu>

in article 8e46g9$ktf1@news.emirates.net.ae, Quaid Joher at
yaqoota@emirates.net.ae quoth:

> While installing GD.pm, a perl interface for GD Module Library, I came
> accross the following error.  Cann't make out where I have gone wrong.  I
> have tried several combinations in the Makefile.PL script to see if this
> error is avoided.

You keep posting this and I keep telling you how to try to fix it. Did you
do the patch to the gdlib source and rebuild it? If you read the README, it
would tell you how to do this and why you should do this. I don't believe
you would be seeing this error had you followed the directions. If you in
fact have done what the README suggests, then there may be some other
problems.

e.




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

Date: Tue, 25 Apr 2000 11:03:49 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: man2html
Message-Id: <Pine.GSO.4.10.10004251102130.25963-100000@user2.teleport.com>

On Tue, 25 Apr 2000, Ira Weiner wrote:

> I guess the question now becomes: how to pass an environment variable
> from a browswer to a UNIX script

So, you're saying it's a CGI question now, and not a Perl question, right?
:-)

If you want to get a browser or server to send some different information
to your program than it's doing now, you should probably search for the
docs, FAQs, and newsgroups about browsers, servers, and how to get them to
do what you want. Cheers!

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



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

Date: Tue, 25 Apr 2000 09:50:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: min/max
Message-Id: <MPG.136f6ccec4bed2f298a971@nntp.hpl.hp.com>

In article <7a3dob9gsv.fsf@Merlin.i-did-not-set--mail-host-address--so-
shoot-me> on Tue, 25 Apr 2000 00:15:45 GMT, Ala Qumsieh 
<aqumsieh@hyperchip.com> says...
> 
> "Dimitri Ostapenko" <dimitrio@perlnow.com> writes:
> 
> > is there a better (shorter) way to get min/max of 2/many values without
> > loading any modules  ?
> > 
> > I use : $min = ($a>$b)?b:a;   for 2 values
> > 
> > and  (sort {$a<=>$b} @nums)[0];   for many
> > 
> > while 2-nd seems concise enough for what it does, I'm too lazy and curious
> > about the 1st.
> 
> Here's a cool variant:
> 
> 	$min = [$a => $b] -> [$b <= $a];

For some definitions of 'cool'.  Performance certainly isn't one of 
those definitions.

Benchmark: timing 262144 iterations of array, comp...
     array:  6 wallclock secs ( 4.31 usr +  0.00 sys =  4.31 CPU) @ 
60794.06/s (n=262144)
      comp:  1 wallclock secs ( 0.94 usr +  0.00 sys =  0.94 CPU) @ 
279471.22/s (n=262144)

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

$a = 0;
$b = 1;

timethese(1 << (shift || 0), {
  array => 'my $min = [$a => $b] -> [$b <= $a]',
  comp  => 'my $min = $a < $b ? $a : $b',
});
 

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


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

Date: Tue, 25 Apr 2000 16:10:17 GMT
From: "red" <redmonkey@madasafish.comx>
Subject: Re: more string handling
Message-Id: <JrjN4.9998$VR6.1048906@news3.cableinet.net>

thanks everyone

(yes thx = thanx = thanks = thank you :)

--

Graham "red" Reeves

uk's Q3 news - - www.quadmonkey.co.uk
newsDuck news engine - - www.fravia.com/newsduck/
beOS icon and design - - www.fravia.com



"red" <redmonkey@madasafish.comx> wrote in message
news:i2%M4.8464$VR6.865068@news3.cableinet.net...
> okay, this might be a little hard to explain:
> i want to limit a string to say 80 characters,
> if its more, i want it cut, and add ... to the end.
> if its not that long, dont add 3 dots.
>
> okay, not so difficult. thx.
> --
>
> Graham "red" Reeves
>
> uk's Q3 news - - www.quadmonkey.co.uk
> newsDuck news engine - - www.fravia.com/newsduck/
> beOS icon and design - - www.fravia.com
>
>
>
>
>




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

Date: Tue, 25 Apr 2000 09:00:41 -0500
From: "mr. wobbet" <rsanford@nolimitsystems.com>
Subject: multi-file search/replace
Message-Id: <94AE790C199AAAB1.07059869C72618F0.4E5F555903EBA5DF@lp.airnews.net>

can someone point me to a perl implementation of a multi-file search
and replace utility?

thanks,

rjsjr


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

Date: Tue, 25 Apr 2000 14:15:47 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: newbie: camel vs. llama
Message-Id: <B52B2114.2FD5%elaine@chaos.wustl.edu>

in article 8e3fib$di3$1@nnrp1.deja.com, octinomos endemoniado at
jesucristo2@netscape.net quoth:
> what do you mean it doesn't spit?

Well...I was being flip with regard to llamas and camels.

> is amazon really 50% off? i saw them at 20% off
> at Fatbrain.com... but if they're really that cheap

http://www.bookpool.com/ often has the best discounts, fatbrain isn't bad
either. The thing is though is that you have to take the sum of the amount
saved per book then weigh that against shipping vs. taxes in your state.
Sometimes it isn't worth it.
 
e.



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

Date: Tue, 25 Apr 2000 09:09:38 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: newbie: How many characters in each row?
Message-Id: <Pine.A41.4.10.10004250900110.17758-100000@ginger.libs.uga.edu>

On Mon, 24 Apr 2000, Doran wrote:

> Is there a rule (either a "real" rule or a suggested style rule)
> regarding how many characters can be in each line of code? I try to
> limit it to about 72 characters/line, but (particularly when there are
> a number of tabs an/or HTML code) that is often difficult to achieve
> without spending a lot of extra time prettying things up. Is there a
> problem with having a line that's, say 120 (or more) characters long?
> 
> I'm interested in both "real" problems (it breaks the code) and
> "style" problems (it makes it difficult to read), but primarily the
> former.
> 
> TIA
> Doran...

Is there a "real" rule?  No.  My editor, vi, won't handle lines longer
than 256, but perl has no such arbitrary limit.  Is there a suggested
style rule?  There are as many suggested styles as there are programmers.

I myself like your limit of 72 chars per line, because I like to have
numbers on in vi, and that works well.  The code emails better that way,
too, for what it's worth.

I do use tabs for indenting, but I set my tabstops to 2 characters, so
that I don't send things south so quickly.  As regards html code, have you
played around with the "here doc" syntax?  I find it works very well with
html.

My last bit of advice is this: go ahead and take the time to pretty things
up.  Enforce a consistent set of rules upon yourself.  I think you will
find that the benefits outweigh the time it takes to do that.  It will
soon become automatic.

Cheers,

--
Brad



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

Date: Tue, 25 Apr 2000 16:51:55 GMT
From: jumac@my-deja.com
Subject: oracle client instalation
Message-Id: <8e4if6$gsh$1@nnrp1.deja.com>

Hi,

I need install an perl Oracle client in a Linux box to make querys
to a Oracle database installed in another machine (running HPUX).

Somebody knows what packages I need install?

I need files/packages form Oracle?

Ing. Juan Manuel Calvo
System administrator
Universidad del CEMA


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


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

Date: Tue, 25 Apr 2000 17:01:01 +0200
From: "Ivo Swartjes" <i.m.t.swartjes@wmw.utwente.nl>
Subject: Passing arguments to a perl script on NT
Message-Id: <8e4bvf$2rd$1@dinkel.civ.utwente.nl>

Hello all,

Call me weird or not, but I've browsed to many perldocs and perlfaqs to find
out how to pass arguments to a perl script when runned on an NT server.

I would like to debug a script I made, and would like to have functionality
that the following line implies:

perl   log.pl   "name=Test&password=Test"

I'm pretty sure something like that can be done, I just don't know the
syntax.

If you know how to do that, please tell me, or tell me where to find
information about it. I've become desperate ;)

Ivo Swartjes
University of Twente, the Netherlands




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

Date: Tue, 25 Apr 2000 16:45:05 GMT
From: Brad Johnson <bgjohnso@unix.amherst.edu>
Subject: Re: Perl (UUCP mail server utility) hacking Mail::Send ack.
Message-Id: <3905c93b@amhnt2.amherst.edu>

Jonathan Stowe <gellyfish@gellyfish.com> wrote:
: On Sat, 22 Apr 2000 02:30:11 GMT Brad Johnson wrote:
:> (Using Mail::Mail)
:> I assume to specify the sendername I'd have to hack the
:> Mail::Mailer::smtp code.
:> 

: Er no.  You simply supply the desired headers to the open() method or use the
: set() method to add the headers earlier.

I'm confused; the set() method of what?

I tried:

use Mail::Send;
use Net::Config qw(%NetConfig);

# set the variables here;
$sendername = 'JAPH';
$mailaddress = 'perl@test.com';
$server = 'localhost';         # or whatever it should be 
$sendto = 'Me <me@home.com>';  # put your address here 
$subject = 'Test mail';

&sendmail($sendername,$mailaddress,$server,$sendto,$subject);

sub sendmail {
	my ($message,$sendto,$subject) = @_;
	$msg = new Mail::Send;
	$msg->to($sendto);
    $msg->subject($subject);
	$NetConfig{'smtp_hosts'} = [$server];
	$ENV{MAILADDRESS} = $mailaddress;
	my %headers = (From => $sendername . ' <'.$mailaddress.'>');
	
	$fh = $msg->open('smtp',\%headers);
	print $fh $message;
	$fh->close;
}

I want that to do the same as this:
use Net::SMTP;
use Net::Config qw(%NetConfig);

# set the variables to be right for you
$sendername = 'JAPH';
$mailaddress = 'perl@test.com';
$server = 'localhost';           # or whatever it should be 
$recipient = 'Me <me@home.com>'; # put your address here    
$subject = 'Test mail';

$NetConfig{'smtp_hosts'} = [$server];

$SENDER = $sendername . ' <'.$mailaddress.'>';
my $smtp = Net::SMTP->new(Debug=>1);	

$smtp->mail($SENDER);
$smtp->recipient($recipient);
$smtp->data();
$smtp->datasend("From: $SENDER\n");
$smtp->datasend("To: $recipient\n");
$smtp->datasend("Subject:  $subject\n");
$smtp->datasend("\n");
$smtp->datasend("$message\n");
$smtp->dataend();
$smtp->quit;

But it doesn't.

The first snippet works almost the same as the second, but the 
first sends an email with "From: perl@test.com" while the second sends 
an email with "From: JAPH <perl@test.com>"

I want the second. Looking at the modules, it looks like I'd have to hack
this section of Mail::Mailer::smtp

sub set_headers {
    my($self,$hdrs) = @_;
    $self->SUPER::set_headers({
	From => "<" . mailaddress() . ">",
	%$hdrs,
	'X-Mailer' => "Mail::Mailer[v$Mail::Mailer::VERSION] Net::SMTP[v$Net::SMTP::VERSION]"
    })
}

-- bradj.
------------------------Nullus Oppidenda Est--------------------------
brad johnson (bgjohnso@unix.amherst.edu)    'Disc, God, Country, Pork'
http://www.amherst.edu/~bgjohnso/             'Chickens! No Cynics!'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


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

Date: Tue, 25 Apr 2000 14:54:22 -0300
From: Gil Vautour <vautour@unb.ca>
Subject: Perl database Access
Message-Id: <3905DBCE.1102F4C0@unb.ca>

Hello,

I was wondering if it is possible to access a MS Access database on a
Solaris box using Perl and DBI?  If so, are there any good resources
on the Web for this sort of thing?



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

Date: 25 Apr 2000 14:39:50 GMT
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Subject: Re: Perl grammar?
Message-Id: <8e4anm$rh0$4@info2.uah.edu>

In article <39048185.B78D5F31@ncsu.edu>,
	Tom Roche <Tom_Roche@ncsu.edu> writes:

: Does anyone know where I might find a BNF (or other) grammar for Perl?

There is perly.y in the Perl distribution.  Keep in mind that a lot
goes on behind the scenes when parsing perl.  Ever looked at the lexer?
It's in toke.c and a boggling read.

: I'm currently trying to defined the regexps to identify subroutine
: calls in static sources, and this might help. Also, longer-term I'd
: <cough><blush><feeling of complete inadequacy> like to work on a Perl
: Development Environment for Emacs (a la Kinnucan's JDE).

The answer is nothing can parse Perl but perl.  Feel free to change it,
but don't expect the endeavor to be easy. :-)

Greg
-- 
The only real zero-tolerance policy at a school these days is the one
prohibiting intelligence and common sense.
    -- Gary Heston


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

Date: Tue, 25 Apr 2000 10:44:52 -0700
From: peter <peterp100@hotmail.com>
Subject: perl problem???
Message-Id: <77mbgsc6kjfo100u41hiuga3krgje7q5uk@4ax.com>

I've just started learning perl. I'm writing a little program that
will log the users using my linux machine.

I've sent the output of the UNIX command "who -q" command into a file
called "whofile"

Now, what I want to do is go into that file and extract the # of users
on my system.

This should be pretty easy to do, because the "who -q" command's
output looks like 

"root
users=1"

So, is there anyway I can extract the number from the file and then
print it in some other formatted text so it will look like "You have 1
user(s) on your system"

Thanks,

peter
      

 


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

Date: 25 Apr 2000 15:40:37 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: PERL, FTP and MVS
Message-Id: <8e4e9l$dla$1@solti3.sdm.de>

In article <8ctie2$tpl$1@nnrp1.deja.com>, John W. <John_Wunderlich@ceridian.ca> wrote:

> Forgive me if this is a newbie question. When trying to automate some
> file transfers via FTP to an MVS box run FTP server software I need to
> send a quote site command before I put a file. We are using Net::FTP
> from the libnet, running ActiveState perl (build 5.22) on an NT 4.0 SP4
> server.

> Does anyone have any code snippets that accomplish the following:

> Read the text output from the remote server that is put on the console
> (i.e. things like STOR SUCCESSFUL)

> Issue a quote site command and interpret the result (from the FTP
> command line I would type:
> quote site recfm=xx lrecl=xx blksize=xx cylinders primary=x secondary=x
> and the server would respond with
> site command accepted.)

> Any suggestions or snippets would be appreciated.

[Answer mailed]

-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: Tue, 25 Apr 2000 15:55:10 +0200
From: "Patrick" <patje1@hotmail.com>
Subject: question about formmail
Message-Id: <0E16861EE7BCD111BE9400805FE6841F0FA1AB7D@c1s5x001.cor.srvfarm.origin-it.com>

I have made a form In this form the user can type their email address. Now I
want to sent a copy to us and to the email address provided by the user.
I have the following, but this is just for own our:

$should_i_mail = "yes";
$should_i_send_user_email = "yes";
$email_of_sender = "name\@domain.com;
$email_to = "name\@domain.com;
$email_subject = "test";


What is the line to enter to use for user emailaddress??
Is it something like:

$email_cc = $emailbsm;

emailbsm is the variable i use in the form.


Please advise.

Thanks, Patrick






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

Date: Tue, 25 Apr 2000 14:04:52 GMT
From: laporte@pcpros.net (Dave LaPorte)
Subject: Question How can I su to a different user, and execute mail as that user.
Message-Id: <3905a548.3982658@news.g2a.net>

Could someone help me with the following,  I am trying to have a perl
program send mail using another users UID ( NOTE: the app will be
fired off from one of roots crons ). The program will su to a user
name, and then send mail as that user.  I have tried the following
unsuccesfully so far.

system ( " su - <username> -c mail user@internet.com < filename" );

Would anyone know how I can achieve this. 

The program ( when finised ) will be run every 2 minutes from roots
cron schedule, and check a directory that users write the file to.
What I want is for my perl program ( which again is being executed by
root ) to su to that username, and mail the file, then return as user
root.  The reason I su to the username, is because I want all
returened email, replied mail, or errors to go to the users unix mail
account vs roots. I have popd runnind on the linux server, so the
users will be able to check their linux mail accounts via there pc
clients like Outlook.

Thanks

P.S.  Please feel free to email me at 

dave@wausausteel.com
laporte@pcpros.net


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

Date: Tue, 25 Apr 2000 16:17:31 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Recursion and scoping issue?
Message-Id: <3907c42f.2030247@news.skynet.be>

chris@subtlety.com wrote:

>On the other hand, it would
>have been helpful if any of the books I'm using (O'Reilly's Programming
>Perl and Perl Cookbook) had mentioned how important "use strict" is.
>It's as if they want you to learn how to do things the wrong way first,
>and then relearn everything the right way afterwards.

That is because originally, Perl didn't have any of these restrictions.
"use strict" was an afterthought, a later addition to Perl. The first
edition of "Programmming Perl" predates strict.pm, so that's why it's
not in there. It definitely should be in there in future editions. OTOH,
the examples in the Perl Cookbook work perfectly without "use strict".
After all, it's nothing but a safety net in case you screw up. You don't
need it in error-free examples.  ;-)

-- 
	Bart.


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

Date: Tue, 25 Apr 2000 13:16:22 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: REGEX tutorials ?
Message-Id: <8e45p5$cmp$1@monet.op.net>

In article <3904b496.180868@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Inner workings: Mark Jason Dominus' intro is really nice. "How Regexes
>Work", URL: <http://www.plover.com/~mjd/perl/Regex/>. But currentl, the
>site seems do be down. This has already been mentioned about a week ago.

http://old.plover.com/~mjd/perl/Regex/ will still work.  And Bell
tells me that their snail-like efforts to restore my service will
probably be completed by Friday.



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

Date: Tue, 25 Apr 2000 10:34:39 -0700
From: "Wyvern" <wyverny@hotmail.com>
Subject: Retrieving file information from remote machines?
Message-Id: <8e4kta$42l6$1@uvaix7e1.comp.UVic.CA>

I've been trying to write a script to retrieve timestamp information from a
remote machine. I was wondering if there was an easier way of doing it than
using sockets to connect to the remote telnet server. Any help would be
appreciated.

Thanks,

Jan
wyvern@uvic.ca




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

Date: Tue, 25 Apr 2000 17:42:06 GMT
From: jlamport@calarts.edu
Subject: Security: why no '.' in path?
Message-Id: <8e4ldb$jvs$1@nnrp1.deja.com>

Okay, I've been reading the CGI security FAQs, and there's one
recommendation that I'm not sure I understand:  why is it bad to have the
current directory in the search path?  And does this only apply to the
path, or to @INC as well?  I mean, the directory in which the current
script is running is *obviously* one that I'm not going to let random
people write to.  So why is it any more dangerous to search in '.' than
in any other part of the system?

-jason


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


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

Date: 25 Apr 2000 17:00:16 +0200
From: Klaus Zeitler <kzeitler@lucent.com>
Subject: Set breakpoints in .perldb
Message-Id: <q5g4s8qi5tr.fsf@lucent.com>


Hi all,

I'm using perl5db (+emacs) to debug a few perl scripts. Found a few hints but
not much information in the docu about a config file .perldb. Is there a way
to set breakpoints so that I don't have to define them every time I start
debugging? Can I write a history file and reexcute this file?

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
If you've seen one redwood, you've seen them all.  -- Ronald Reagan


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

Date: Tue, 25 Apr 2000 07:02:51 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: store hex in db, and retrieve as hex
Message-Id: <3905977B.8C9D9876@indra.com>

Hardy Merrill wrote:
> 
> I'm working with hex numbers in bitwise operations in CGI scripts.  I'd
> like to store a hex number in an Oracle table, and be able to retrieve
> that hex number and use it *AS A HEX NUMBER(?)* in bitwise comparisons,
> so that I don't have to convert from hex to decimal and back again.  The
> only method I've found so far is to take the hex number in the CGI
> script, store it in Oracle as a VARCHAR2(character representation), and
> read it out into a decimal number with an Oracle TO_NUMBER - conversions
> all over the place.
> 
> I know this can be done better/easier - ideas?
> 
> TIA.
> --
> Hardy Merrill
> Mission Critical Linux
> http://www.missioncriticallinux.com
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

You could use a BLOB type, but I think this would be a horrible waste of
space.  Is the point to make the data persistent?  If so, have you
thought of using Storable.pm?  What about using DBM files?

If you must store this in Oracle, why do you need to use TO_NUMBER? 
Perl will store the variable correctly (see perldoc perlguts) as a
number type (I am assuming you are storing the number as 0xnnnnnn).
-- 

Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: Tue, 25 Apr 2000 13:33:19 GMT
From: sandson@my-deja.com
Subject: Re: stress-test
Message-Id: <8e46qv$4uv$1@nnrp1.deja.com>

Hi all,
Thank you again for your input.
I ended up using sockets and indeed timing the response, as some of you
suggested.
Thank's again!

In article <slrn8fupug.dp7.elaine@chaos.wustl.edu>,
  elaine@chaos.wustl.edu (Elaine -HFB- Ashton) wrote:
> In article <8dm9nj$jtg$1@nnrp1.deja.com>, sandson@my-deja.com wrote:
> >Thank you both for your comments.
> >To clarify, response-times wil be clocked, but not by me.
>
> If you have apache you might try using ab which is located in the
> src/contrib directory iirc.
>
> "NAME
>      ab - Apache HTTP server benchmarking tool
>
> SYNOPSIS
>      ab [ -k ] [ -i ] [ -n requests ] [ -t timelimit ] [ -c  con-
>      currency   ]   [   -p   POST   file   ]  [  -A  Authenticate
>      username:password    ]    [    -P     Proxy     Authenticate
>      username:password  ]  [  -H  Custom  header  ]  [  -C Cookie
>      name=value ] [ -T content-type ] [ -v verbosity  ]  ]  [  -w
>      output HTML ] ] [ -x <table> attributes ] ] [ -y <tr> attri-
>      butes     ]     ]     [     -z     <td>     attributes     ]
>      [http://]hostname[:port]/path
>
>      ab [ -V ] [ -h ]
>
> DESCRIPTION
>      ab is a tool for benchmarking the performance of your Apache
>      HyperText  Transfer Protocol (HTTP) server.  It does this by
>      giving you an indication of how  many  requests  per  second
>      your Apache installation can serve."
>
> And you can use Perl to drive it and collect statistics.
>
> enjoy
>
> e.
>


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


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

Date: Tue, 25 Apr 2000 11:27:14 -0600
From: Al Bundy <AlBundy@aol.net>
Subject: system return code problem
Message-Id: <f1lbgscrc1cfmdu5j1tcpjog1s88nguhcn@4ax.com>

I am trying to execute a system call such as:

system( "myprogram | tee afile.log" );

In a Unix shell, executing "myprogram | tee afile.log" always
returns the exit status of myprogram, which is what I desire.

When I do this in Perl 5, forcing a return code of 127 in myprogram,
the above  system call returns 0.

If I remove the "| tee afile.log" from the system command, the
return value is as expected, 32512.  (127 * 256).

Any ideas on how to get around this?  I can not simply add
"> afile.log" to the command due to other requirements.

Thanks in advance.


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

Date: Tue, 25 Apr 2000 10:33:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: undefined value as a symbol reference
Message-Id: <Pine.GSO.4.10.10004251031570.25963-100000@user2.teleport.com>

On 24 Apr 2000, gene wrote:

> Can't use an undefined value as a symbol reference at HTMLTemplate.pm 
> line 31

>     if (eof($fh)) {  # <--- error here

If $fh is anything but undef here, it looks as if you've found a bug in
perl. If $fh is undefined, that's your problem. (Or maybe your problem is
to step through your code in the debugger to learn why it's undef.) 

Can it really be that easy? :-)

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



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

Date: Tue, 25 Apr 2000 17:32:22 GMT
From: jlamport@calarts.edu
Subject: Re: using CPAN: what's all this junk!?
Message-Id: <8e4kr7$jc6$1@nnrp1.deja.com>

In article <slrn8gaef9.34e.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Tue, 25 Apr 2000 06:01:21 GMT, jlamport@calarts.edu wrote:
> >In article <slrn8g8rfi.n77.elaine@chaos.wustl.edu>,
> >  elaine@chaos.wustl.edu (Elaine -HFB- Ashton) wrote:
> >> In article <8e0sac$o17$1@nnrp1.deja.com>, jlamport@calarts.edu wrote:
> >> >I just used CPAN for the first time.  It seems to have worked, but now I
> >> >want to know: what are all of these extra files and directories that got
> >>
> >> 'perldoc CPAN' should explain how it works quite nicely.
> >>
> >> e.
> >>
> >
> >Actually, I *read* perldoc CPAN, and it doesn't really answer my
> >questions.  I mean, after installing the modules, there are probably 30+
> >directories and 100+ files in my account that weren't there before.  Most
> >of them I haven't the foggiest clue what they have to do with the modules
> >I just installed.  As I said, the install worked, I can use the modules
> >just fine -- that's not my problem.  My problem is, for example: what the
> >hell are all these .3pm files that got installed in ~/.cpan/build/IO-
> >stringy-1.207/blib/man3/ and do I really need them?
>
> From perldoc CPAN:
>
>           Currently the cache manager only keeps track of the build
>           directory ($CPAN::Config->{build_dir}). It is a simple FIFO
>           mechanism that deletes complete directories below build_dir
>           as soon as the size of all directories there gets bigger
>           than $CPAN::Config->{build_cache} (in MB). The contents of
>           this cache may be used for later re-installations that you
>           intend to do manually, but will never be trusted by CPAN
>           itself. This is due to the fact that the user might use
>           these directories for building modules on different archi-
>           tectures.
>
> Assumming you didn't actually set the install location to ~/.cpan/build and
> didn't change to many of the default set up options then ~/.cpan/build is the
> value of $CPAN::Config->{build_dir}. The CPAN module will delete the stuff
> at some point, you can delete it too. It should be noted that some modules
> (Tk comes to mind) have lots of demo scripts that don't get moved out of the
> build directory (to my knowledge anyway) and thus disappear unless you copy
> them.
>
> In summary - you should be able to delete everything in the build subdirectory,
> unless you did strange (and bad) things with your install prefix...
>

Oh!  Now I understand why I'm confused!  When I did the install, CPAN
complained about not having proper priv's (said I'd need to suid to root,
which I can't do -- I only have a plain user account on this machine).
So the installation wasn't technically successful, but the modules did
get "installed" (so to speak) in the build directory.  To get them to
work, I just added the appropriate directory within the build directory
to @INC, and my test scripts worked fine.  Since I'd never used CPAN
before -- and since the CPAN perldoc isn't that clear about what to do if
you're installing into a user account rather than into the system's perl/
lib directory -- I just assumed that that was how it was *supposed* to
work.

Thanks for the pointer!  It would have taken me forever to have figured
that out from the perldoc alone...

I think I can probably figure the rest of it out from here, though if
anyone has any tips/warnings about installing modules for use in a user
account, I'm sure I and others on this list could benefit from the
knowlege...

-jason


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


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

Date: Tue, 25 Apr 2000 15:06:16 +0100
From: Kourosh A Mojar <kmojar@bmjgroup.com>
Subject: win32 ftp module...
Message-Id: <3905A658.863EEA05@bmjgroup.com>

Dear all,

I am a moderately novice perl programmer. I am using perl (win32) to
automate some ftp tasks. I was using cross platform perl before which
worked great. Now I am using win32 I have installed the NetLib module (I
think I did it properly) although I cannot continue to work with my ftp
scripting. I get an error:

"can't call method "login" without a package or object reference at ...
line... etc."

Any help or suggestions?

Kind regards,

Kourosh A Mojar
kmojar@bmjgroup.com


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

Date: Tue, 25 Apr 2000 06:49:20 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Writing to STDIN
Message-Id: <39059450.EA443236@indra.com>

"Larry R. Waibel" wrote:
> 
> My Perl script is running a program that prompts for Y/N and I want to always
> answer it no.  I've had the script create a file with "N" in in and redirect
> stdin to the program and that works.  But I'm wondering if there isn't some
> way to avoid having to create a file.  Is there some way I can place the "N"
> directly into STDIN?  Thanks!

Well, you can't write to STDIN.  Try using the Expect module for this,
or think of a way to grab a default answer if none is given.
-- 

Ron Reidy
Oracle DBA
Reidy Consulting, L.L.C.


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

Date: Tue, 25 Apr 2000 09:25:42 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: www.perlmonks.org
Message-Id: <Pine.A41.4.10.10004250925200.17758-100000@ginger.libs.uga.edu>

On Mon, 24 Apr 2000, Makarand Kulkarni wrote:

> I came across this website
> www.perlmonks.org
> for the perl user. Worth a visit.

Are they UNIX?


:-)

__
Brad



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

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


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