[13158] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 568 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 17 17:07:18 1999

Date: Tue, 17 Aug 1999 14:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 17 Aug 1999     Volume: 9 Number: 568

Today's topics:
        adding 30 days <jimmy@blackhole-designs.com>
        advice on html-ifying documentation (installhtml) <flavell@mail.cern.ch>
    Re: Anyone need an INDEPENDENT CONTRACTOR??? (Marcel Grunauer)
        Connecting to UNC share via Perl/CGI sandman69@my-deja.com
    Re: Counting the amount of lines in a file.. <makkulka@cisco.com>
    Re: Counting the amount of lines in a file.. (Larry Rosler)
        DBI and sp_sysmon sparky21@my-deja.com
        DBI and Sybase sp_sysmon problem grindrod@tfn.com
    Re: HARASSMENT -- Monthly Autoemail (John Stanley)
    Re: HARASSMENT -- Monthly Autoemail (Gil Harvey)
    Re: HARASSMENT -- Monthly Autoemail (Dave Salovesh)
    Re: HARASSMENT -- Monthly Autoemail (Dave Salovesh)
    Re: How to give Passwords on STDIN jjakes24@my-deja.com
    Re: Modulo of a string <aqumsieh@matrox.com>
    Re: Modulo of a string <Allan@due.net>
    Re: Modulo of a string (Bart Lateur)
    Re: Modulo of a string (Larry Rosler)
    Re: New Perl related Newsgroup, alt.comp.perlcgi.freela (David Alan Black)
    Re: Pattern matching on command line <aqumsieh@matrox.com>
        poor performance of activeperl vs MKS Perl liuyanshuang@my-deja.com
        problems creating and saving to file... <p8e77@keele.ac.uk>
        problems creating and saving to file... <p8e77@keele.ac.uk>
    Re: problems creating and saving to file... (John Stanley)
    Re: problems creating and saving to file... (Marcel Grunauer)
    Re: problems creating and saving to file... <sariq@texas.net>
    Re: Q:Two perl programs printing to one txt file (Larry Rosler)
    Re: Q:Two perl programs printing to one txt file <makkulka@cisco.com>
    Re: Q:Two perl programs printing to one txt file <All@n.due.net>
    Re: renaming a subroutine <uri@sysarch.com>
        Resolving, Capturing, Storing a file on the network <Jeff.T.Parker@compaq.com>
        Running Perl CGI in Apache on WinNT apothen@my-deja.com
    Re: What editors are folks using for PerlScript develop (Marcel Grunauer)
    Re: While we are on the subject of tainting.... (Alan Curry)
    Re: Write - multiple access <aqumsieh@matrox.com>
    Re: www.perl.org (David H. Adler)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 17 Aug 1999 21:01:06 GMT
From: Jimmy Humphrey <jimmy@blackhole-designs.com>
Subject: adding 30 days
Message-Id: <37B9CD80.E9496D2C@blackhole-designs.com>

I was wondering how I could go about adding 30 days to the current date.
I'm using perl 5.0005_02 on the latest Sun Solaris system.

Thanks

Jimmy



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

Date: Tue, 17 Aug 1999 21:09:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: advice on html-ifying documentation (installhtml)
Message-Id: <Pine.HPP.3.95a.990817205109.16706F-100000@hpplus03.cern.ch>


Re. Perl 5.005_03 on unix-flavoured OSes

The installhtml script seemed relatively clear (although its defaults
don't seem to come out as expected: at one point I succeeded in
installing the html tree to /html, when I expected it to go to ./html -
OUCH!)

However, the documentation shows a lot of things that one _could_ do,
leaving open some questions on what would be an appropriate choice. 

What seems clear is...

* If I html-ify in the distribution tree, it doesn't include the
additional library/modules that have been installed that aren't part
of the distribution.  (GD.pm and so on).

* Is one supposed to actually html-ify the pods in the place to
which they are installed (like /usr/local/lib/perl/pod etc.)?

* Or should one html-ify in the distribution tree and then install the
results into the /usr/local/lib/perl... hierarchy?

Sorry, I'm confused.  I _have_ read the INSTALL instructions and
the installhtml --help, honestly, it isn't that I don't understand what
options are open to me, it's more a question of making a good choice of
options without knowing the consequences... How should one best go about
this, please, 1.  for the distribution itself and 2. for any modules
installed separately? 

thanks



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

Date: Tue, 17 Aug 1999 19:34:12 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Anyone need an INDEPENDENT CONTRACTOR???
Message-Id: <37bfc75b.31930032@news>

On 17 Aug 1999 13:53:53 -0500, Kent Perrier <kperrier@blkbox.com>
wrote:

>toby <toby@venice.cas.utk.edu> writes:
>
>> Chirayu Shah wrote:
>> 
>> > Please e-mail me at shah_chirayu@hotmail.com if this interests you.
>> 
>> Yes,I am looking for someone to pour a new concrete floor in my
>> basement.
>
>And I am looking for someone to clear 4.6 acres of land.....

Or should that be 5.6 acres of perlland?


Marcel
-- 
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'


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

Date: Tue, 17 Aug 1999 20:00:30 GMT
From: sandman69@my-deja.com
Subject: Connecting to UNC share via Perl/CGI
Message-Id: <7pcf0n$gu4$1@nnrp1.deja.com>

I am having problems connecting to an NT share on another serverfrom a
Browser.
I have a form to allow servername, sharename and a test variable to be
submitted to my perlscript.

The webpage authenticates the connecting user using the NT PDC.

A snippet of the code is :
$servername=param("servername");
$sharename=param("sharename");

$path="\\\\$servername\\$sharename";
@filelist = <$path//*>;
@files = sort(grep(-T, @filelist));
$total_machines = scalar(@files);
foreach $file (@files){
    print $file;
        open (LOGFILE, $file)|| die "Can't open $file: $!\n";

yada yada yada

Things work perfectly if I send params to the script via a command line
interface... not using param of course but reading in @ARGV.

Any ideas or assistance would be greatly appreciated.

Thanks,
Shawn


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


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

Date: Tue, 17 Aug 1999 12:11:23 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Counting the amount of lines in a file..
Message-Id: <37B9B3DB.40FE7ED9@cisco.com>

[ Andrew Weller wrote:

> Is it possible to read in a file and count in the amount of lines so that a
> for loop can be initialised with the amount of lines (or data points)?

Yes. You could read one line at a time and keep a count of
how many you read. Or read all lines into an array and then
find how many elements this array contains ( assign this array
to a scalar, for example ).  Perl also has $. ( dollar DOT ) a
special variable that will have the current input line number
of the last filehandle that was read.
--Makarand




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

Date: Tue, 17 Aug 1999 12:51:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Counting the amount of lines in a file..
Message-Id: <MPG.12235d0bce21162c989e63@nntp.hpl.hp.com>

In article <37B9B3DB.40FE7ED9@cisco.com> on Tue, 17 Aug 1999 12:11:23 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ Andrew Weller wrote:
> 
> > Is it possible to read in a file and count in the amount of lines so that a
> > for loop can be initialised with the amount of lines (or data points)?
> 
> Yes. You could read one line at a time and keep a count of
> how many you read. Or read all lines into an array and then
> find how many elements this array contains ( assign this array
> to a scalar, for example ).  Perl also has $. ( dollar DOT ) a
> special variable that will have the current input line number
> of the last filehandle that was read.

And there is even a FAQ!  perlfaq5: "How do I count the number of lines 
in a file?"

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


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

Date: Tue, 17 Aug 1999 20:30:02 GMT
From: sparky21@my-deja.com
Subject: DBI and sp_sysmon
Message-Id: <7pcgno$i9q$1@nnrp1.deja.com>

I am having problems capturing the output of
sp_sysmon Sybase procedure in my perl script.
Even though I have no statement to print the
output, It comes out on my screen with errors. I
have a counter to keep track of all the lines of
output, but it only goes to 1, which does not make
sense due to the large amount of lines of output I
expect. My intent is to parse each line of out put
to gather statistics. Below is a small version of
the script w/the error. Any help would be great!

#!/usr/local/bin/perl -w
use DBI;

# Give DB information

my $dbinfo="dbi:Sybase:ESGDB";
my $uname="sa";
my $passwd="3ntrust";

my $dbh=DBI->connect($dbinfo, $uname, $passwd)||
die ("cannot open database dbi:
:errstr");

my $msql = $dbh->prepare('sp_sysmon 2');
my $count = 0;
$msql->execute() || die $dbh->errstr;
        while(@stats = $msql->fetchrow_array){
         ++$count;
print "line number $count\n";

}
$msql->finish();

$dbh->disconnect();

exit;


***end of output and error below***
=============================== End of Report
=================================
DBD::Sybase::st execute failed: Server message
number=2528 severity=10 state=1 line=102
server=ESGDB procedure=sp_sysmon text=DBCC
execution completed. If DBCC printed error
messages, contact a user with System Administrator
(SA) role.


any suggestions, please email me
thomas.grindrod@tfn.com


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


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

Date: Tue, 17 Aug 1999 20:24:00 GMT
From: grindrod@tfn.com
Subject: DBI and Sybase sp_sysmon problem
Message-Id: <7pcgch$i53$1@nnrp1.deja.com>

I am having problems capturing the output of sp_sysmon Sybase procedure
in my perl script. Even though I have no statement to print the output,
It comes out on my screen with errors. I have a counter to keep track of
all the lines of output, but it only goes to 1, which does not make
sense due to the large amount of lines of output I expect. My intent is
to parse each line of out put to gather statistics. Below is a small
version of the script w/the error. Any help would be great!

#!/usr/local/bin/perl -w
use DBI;

# Give DB information

my $dbinfo="dbi:Sybase:ESGDB";
my $uname="sa";
my $passwd="3ntrust";

my $dbh=DBI->connect($dbinfo, $uname, $passwd)|| die ("cannot open
database dbi:
:errstr");

my $msql = $dbh->prepare('sp_sysmon 2');
my $count = 0;
$msql->execute() || die $dbh->errstr;
        while(@stats = $msql->fetchrow_array){
         ++$count;
print "line number $count\n";

}
$msql->finish();

$dbh->disconnect();

exit;


***end of output and error below***
=============================== End of Report
=================================
DBD::Sybase::st execute failed: Server message number=2528 severity=10
state=1 line=102 server=ESGDB procedure=sp_sysmon text=DBCC execution
completed. If DBCC printed error messages, contact a user with System
Administrator (SA) role.


Please send any ideas to thomas.grindrod@tfn.com


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


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

Date: 17 Aug 1999 19:22:52 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7pccqc$2lh$1@news.NERO.NET>

In article <37b99102.81973@news.erols.com>,
Dave Salovesh <darsal@erols.com> wrote:
>In article <7pavp9$8ot$1@news.NERO.NET>,
>stanley@skyking.OCE.ORST.EDU (John Stanley) opined:
>>No, Dave, you have it backwards. If you want to prove I am wrong, then
>>you show me the document I signed that says I must accept email in
>>response to USENET postings. You show me something besides someone
>>else's opinion that I must accept such email. 
>
>Oh, now you're only gonna follow the rules you signed.  

No, Dave. I am telling you that you need to show me the rules that say
what I am doing is wrong. Specifying that I signed them as part of what
you have to produce was supposed to suggest to you that such rules do
not exist in any form.

>Does that apply everywhere, or just in arguments you can't win?  

I don't know what you mean by "can't win" in this regard. I will not
accept your claim that your opinion is "rule", and I don't really care 
if you change your opinion that you've solicited email when you post
(specific 'you', not generic), so what is there to win?

>Here are some sources that reinforce what I said:
>
>FYI28/RFC1855.  There's the "Rules for posting to Usenet" article that
>appears in *.answers .  

You are confused by the title. They are not "rules". They are opinion.
Just as any other FAQ is an opinion. If you think that the status as a
FAQ makes it a rule, then you are in more trouble than you can imagine.

>If you speak satire, there's the classic "Emily Postnews" article.  

Still just opinion.

>There's the Usenet guide at LSU, 

Still opinion.

>or another at the
>University of Alberta, or another at the University of Cincinnati,
>etcetera.

Still opinion.

>Over and over, I see this line:
>
>    Reply to other people's articles by mail unless there is a specific 
>    reason to do otherwise.

Yes, so what? This does not say that the email must be accepted. Being
told that someone does not want to get email from you is "a specific
reason to do otherwise." Follow your own rule.

>Now, -please- tell me what source you've seen which contradicts that.

What needs to be contradicted? The "rule" that isn't a rule that
doesn't say what you claim it does? 

>>Thank you so much for granting me the right to have an opinion. 
>
>You give me too much credit.  

Yes, it appears I did.

>All I did was agree that what you're
>saying -is- an opinion.  

Now you have to figure out that this is USENET, and there is nothing BUT
opinion. The closest thing there is to a rule is RFC1036, and even then
a lot of people treat it as just a suggestion.

>I wouldn't argue with your opinion if you
>wanted to say you had one, but once you try to tell me it's the rule, I

No, David. I have not told you it's the rule. I have told you that what
you are claiming is a rule is not. If you do not understand the
difference, then I am not going to waste my time trying to enlighten
you.

>>But you have told me it is not unsolicited, thus it is not U at all. There
>>goes the "U and C come together" excuse for objecting to spam.
>
>No, here comes that gray area.

There is no gray area. If posting is soliciting email, then email cannot
be unsolicited when it comes as a result of posting. The only way that
email as a result of posting can be unsolicited is if posting is NOT a
solicitation for email. But that would contradict your rule. 

>If active usenauts are no longer able to discern the difference between
>Usenet replies that use the email channel and UCE, 

No, David, I have no trouble differentiating, because I do not claim
that posting is a solicitation for email. It is only when you try making
up a rule that does not exist do you get confused.

>Where's that FAQ of yours?

They are posted regularly to news.groups. 



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

Date: Tue, 17 Aug 1999 19:35:05 GMT
From: gh@netquick.net (Gil Harvey)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37b9b91c.98343736@news.interpath.net>

On Tue, 17 Aug 1999 14:34:16 GMT, llornkcor@my-deja.com wrote:

>I happen to think it is easier to read with the replay at the top. It's
>the first thing you look at when it pops up, right? Why scroll, when you
>don't necessarly have too. 

   Because when I get to a reply I didn't see the original, it's a lot
easier to read in the sequence it was written.


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

Date: Tue, 17 Aug 1999 20:04:34 GMT
From: darsal@erols.com (Dave Salovesh)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37babfde.12079488@news.erols.com>

In article <7pccqc$2lh$1@news.NERO.NET>,
stanley@skyking.OCE.ORST.EDU (John Stanley) opined:

>No, Dave. I am telling you that you need to show me

I'm clearly not showing you anything, and to persist in trying would be
foolish.  I try to reduce my foolishness whenever I can.

Enjoy yourself.



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

Date: Tue, 17 Aug 1999 20:18:51 GMT
From: darsal@erols.com (Dave Salovesh)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37bcc2b6.12808178@news.erols.com>

In article <37bb49d8.39263948@nntp.ix.netcom.com>,
miker3@ix.netcom.com (Michael Rubenstein) opined:

>But this has nothing to do with what Tom is doing.  He is not
>responding to articles -- he's harassing.  He's sending email to
>someone who has asked that he stop.

I see that.  I don't know what anyone expects you or me to do about it.



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

Date: Tue, 17 Aug 1999 19:17:06 GMT
From: jjakes24@my-deja.com
Subject: Re: How to give Passwords on STDIN
Message-Id: <7pccf7$euo$1@nnrp1.deja.com>

Give the guy a break, an easy way to do it without
any modules would be to use system commands

Here is an example

#
`stty -echo`;
# Takes the echo off the terminal
my $passwd = <STDIN>;
chomp($passwd);

`stty echo`;
# Puts the echo back on

Joe

In article <379897f0@cs.colorado.edu>,
  tchrist@mox.perl.com (Tom Christiansen) wrote:
>      [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
>     tapplega@utk.edu writes:
> :He may have a irritable cuss  sysadmin who won't install any modules
outside of
> :the standard distribution.
>
> Not relevant.  He can always install his own modules.
>
> --tom
> --
> If you want to see useful Perl examples, we can certainly arrange to
have
> comp.lang.misc flooded with them, but I don't think that would help
the
> advance of civilization.  :-) --Larry Wall in
<1992Mar5.180926.19041@netlabs.com>
>


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


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

Date: Tue, 17 Aug 1999 14:08:20 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Modulo of a string
Message-Id: <x3y672ee0vf.fsf@tigre.matrox.com>


tsreyb@my-deja.com writes:

> What I was hoping to do is reduce arbitrary strings
> to a number between 0 & N-1, where N is the modulo
> value.

Reduce a string to a number? What do you mean by that?

How do you reduce the string
	"Just another Perl hacker, "

to the number 3, for example?

> For example, if N is 7, I can process a different
> segment of an array each day of the week. After

What array? What day of week? You work on Sundays?

> 7 days, all of the elements will have been processed
> once & only once. [Eventually in this code I won't
> have the names in an array .. so doing a modulo on
> the array index won't work]

What elements are you talking about? What names? I am confused beyond
repair!

> I tried this:
> 
> #---start----
>  @x[0] = "a" % 7;
>  @x[1] = "b" % 7;
>  @x[2] = "c" % 7;
>  @x[3] = "d" % 7;
>  @x[4] = "Joe" % 7;
>  @x[5] = "Sally" % 7;

The above are array slices. Not array elements. Read more about this
in perlfaq4:

	What is the difference between $array[1] and @array[1]?

>  for ( $i=0 ; $i<=5 ; ++$i ) {
>    print "x[$i]: @x[$i]\n";
>  }
> #---end----
> 
> and got this output:
> 
> x[0]: 0
> x[1]: 0
> x[2]: 0
> x[3]: 0
> x[4]: 0
> x[5]: 0
> 
> Any & all suggestions appreciated!

What is the output you're expecting? This is certainly the correct
output for your program.

Please clarify.

Ala



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

Date: Tue, 17 Aug 1999 15:56:11 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Modulo of a string
Message-Id: <7pcevb$b80$1@nntp4.atl.mindspring.net>

tsreyb@my-deja.com wrote in message <7pbtrp$35b$1@nnrp1.deja.com>...
:According to the camel book, the "% [modulo] operator
:will convert its operands to integers before finding
:the remainder according to integer devision"
:What I was hoping to do is reduce arbitrary strings
:to a number between 0 & N-1, where N is the modulo
:value.
:For example, if N is 7, I can process a different
:segment of an array each day of the week. After
:7 days, all of the elements will have been processed
:once & only once. [Eventually in this code I won't
:have the names in an array .. so doing a modulo on
:the array index won't work]

:#---start----
: @x[0] = "a" % 7;
: @x[1] = "b" % 7;
: @x[2] = "c" % 7;
: @x[3] = "d" % 7;
: @x[4] = "Joe" % 7;
: @x[5] = "Sally" % 7;
:
: for ( $i=0 ; $i<=5 ; ++$i ) {
:   print "x[$i]: @x[$i]\n";
: }
:#---end----
:and got this output:
:x[0]: 0
:x[1]: 0
:x[2]: 0
:x[3]: 0
:x[4]: 0
:x[5]: 0



When I was young they told me that drug use would eventually catch up
with me and I am afraid it looks like they must have been right.  It was
a long time ago, and I thougth I was safe, but I have read the above
more than 10 times and although I understand each word individually, it
doesn't make any sense to me at all.  Each time I read it I am even more
confused than the time before.  My brain seems to have completely come
unwired.  Well, off to seek some professional help.

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
A computer lets you make more mistakes faster than any invention in
human history - with the possible exceptions of handguns and tequila.
 - Mitch Ratliffe




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

Date: Tue, 17 Aug 1999 20:04:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Modulo of a string
Message-Id: <37babd24.2209028@news.skynet.be>

tsreyb@my-deja.com wrote:

>What I was hoping to do is reduce arbitrary strings
>to a number between 0 & N-1, where N is the modulo
>value.

Can be done.

>For example, if N is 7, I can process a different
>segment of an array each day of the week. After
>7 days, all of the elements will have been processed
>once & only once.

Can't be done. You not only want to reduce the strings to a number, but
to a *different* number from each other as well?

>[Eventually in this code I won't
>have the names in an array .. so doing a modulo on
>the array index won't work]

And yet it's you best shot. Load the strings into an arry and use the
index, or into a hash, string as the key, incremented number as the
value.

  $i = 0;
  while(<DATA>) {
	chomp;
	$index{$_} = $i++;
  }
  print $index{'Joe'};

__DATA__
a
b
c
d
Joe
Sally

	Bart.


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

Date: Tue, 17 Aug 1999 13:22:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Modulo of a string
Message-Id: <MPG.1223644ff8cd94c2989e64@nntp.hpl.hp.com>

In article <37B9A0B8.F8EE373D@cisco.com> on Tue, 17 Aug 1999 10:49:44 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ tsreyb@my-deja.com wrote:
> 
> > What I was hoping to do is reduce arbitrary strings
> > to a number between 0 & N-1, where N is the modulo
> > value.
> 
> --{Sample code deleted..}
> 
> > and got this output:
> > x[0]: 0
> > x[1]: 0
> > x[2]: 0
> > x[3]: 0
> > x[4]: 0
> > x[5]: 0
> 
> When strings get interpreted as numbers they are constructed by reading
> digits one at a time from the beginning of the string stopping when a
> non-digit is encountered. So "a" will be 0 when interpreted as a
> number.  Your results are as expected.

Certainly.  And he should look at the ord() function, which will do what 
he wants (convert the first character of the string argument to its 
ordinal value).

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


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

Date: 17 Aug 1999 15:59:38 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: New Perl related Newsgroup, alt.comp.perlcgi.freelance
Message-Id: <7pceva$ro$1@pilot.njin.net>

Jonathan Stowe <gellyfish@gellyfish.com> writes:

>Tomh <fetchNOhmSPAM@fetchound.com> wrote:
>> 
>> Hi,
>> 
>> There is a new perl/cgi related usenet group called,
>> alt.comp.perlcgi.freelance.
>> 

>Oh my word !!!!

Well, look on the bright side: maybe it will syphon some of the
"PERL/cgi" noise away from here.  The first handful of postings to
reach my site make me optimistic on that score, if on no other.


David Black



-- 
David Alan Black                 blackdav@shu.edu or dblack@pilot.njin.net
Associate Professor              Seton Hall University
Department of Communication      South Orange, NJ 07079
http://pirate.shu.edu/~blackdav  includes Syllabus Markup Language (SyML)


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

Date: Tue, 17 Aug 1999 14:17:34 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Pattern matching on command line
Message-Id: <x3y3dxie0g2.fsf@tigre.matrox.com>


tyeung@netscape.net writes:

> I am new to Perl so can you tell me exactly where perldoc and perldata
> is?  or do u mean the manpage for perldoc?

'perldoc' is a little program that comes with every complete Perl
distribution. To familiarize yourself with it, type 'perldoc perldoc'
at the command prompt. If you get an error message saying "Command not
found" or something of this sort, then your Perl installation was
not complete. Re-install Perl.

I suggest you then read 'perltoc' by typing 'perldoc perltoc' at the
command prompt. This will list all the documentation available on your
system. If any of them is missing, then your Perl installation was not
complete. Re-install Perl.

> I am trying to throw the "m/word/i" into the if condition
> so the $string will do a pattern matching with it..
> in the command line I can change the modifier if I want it to
> like "s/^word\b/g" something like that..

Ok. Good. What is your question?

Ala



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

Date: Tue, 17 Aug 1999 20:37:45 GMT
From: liuyanshuang@my-deja.com
Subject: poor performance of activeperl vs MKS Perl
Message-Id: <7pch6o$inv$1@nnrp1.deja.com>

Hi, folks,

                   I have a piece of code, which does parsing big file (
30MB) and a lot of
                   file I/O (40000 files). It is 10 times slower run
under activeperl than
                   MKS perl. It looks like MKS perl is more memory
intensive, and
                   activeperl is CPU intensive.

                   Can anybody explain this? Is there some thing I can
do to speed up
                   activeperl or make it memory intensive?

                   Thanks!

                   Michael LiuHi, folks,

                   I have a piece of code, which does parsing big file (
30MB) and a lot of
                   file I/O (40000 files). It is 10 times slower run
under activeperl than
                   MKS perl. It looks like MKS perl is more memory
intensive, and
                   activeperl is CPU intensive.

                   Can anybody explain this? Is there some thing I can
do to speed up
                   activeperl or make it memory intensive?

                   Thanks!

                   Michael Liu


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


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

Date: Tue, 17 Aug 1999 20:09:34 +0100
From: "Andrew Weller" <p8e77@keele.ac.uk>
Subject: problems creating and saving to file...
Message-Id: <7pcc18$si0$1@cfs2.kis.keele.ac.uk>

Dear all,

I am trying to open a new file that doesn't exist and write to that file -
this is the current code I am using:

  open (OUT, $filename) || die "Can't open $filename: $!";
  for ($k=1; $k<$counter; $k++) {
    if ($flag[$k] == 0)
    {print OUT "$xvalues[$k] $yvalues[$k] $zvalues[$k],\n"}
  close (OUT) || die "Can't close $filename: $!";
}

I think I need a 'w' tag somewhere or something?? This is the error message
I am receiving:

Can't open c:\testnew.txt: No such file or directory at ....

Any ideas??

Thanks in advance,

Andy

--
Andy Weller
e-mail: p8e77@keele.ac.uk




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

Date: Tue, 17 Aug 1999 20:09:34 +0100
From: "Andrew Weller" <p8e77@keele.ac.uk>
Subject: problems creating and saving to file...
Message-Id: <7pccgg$t30$1@cfs2.kis.keele.ac.uk>

Dear all,

I am trying to open a new file that doesn't exist and write to that file -
this is the current code I am using:

  open (OUT, $filename) || die "Can't open $filename: $!";
  for ($k=1; $k<$counter; $k++) {
    if ($flag[$k] == 0)
    {print OUT "$xvalues[$k] $yvalues[$k] $zvalues[$k],\n"}
  close (OUT) || die "Can't close $filename: $!";
}

I think I need a 'w' tag somewhere or something?? This is the error message
I am receiving:

Can't open c:\testnew.txt: No such file or directory at ....

Any ideas??

Thanks in advance,

Andy

--
Andy Weller
e-mail: p8e77@keele.ac.uk




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

Date: 17 Aug 1999 19:26:18 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: problems creating and saving to file...
Message-Id: <7pcd0q$2m1$1@news.NERO.NET>

In article <7pcc18$si0$1@cfs2.kis.keele.ac.uk>,
Andrew Weller <p8e77@keele.ac.uk> wrote:
>I am trying to open a new file that doesn't exist and write to that file -
>this is the current code I am using:

perldoc -f open



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

Date: Tue, 17 Aug 1999 19:38:11 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: problems creating and saving to file...
Message-Id: <37c0c7aa.32009146@news>

On Tue, 17 Aug 1999 20:09:34 +0100, "Andrew Weller"
<p8e77@keele.ac.uk> wrote:

>Dear all,
>
>I am trying to open a new file that doesn't exist and write to that file -
>this is the current code I am using:
>
>  open (OUT, $filename) || die "Can't open $filename: $!";
>  for ($k=1; $k<$counter; $k++) {
>    if ($flag[$k] == 0)
>    {print OUT "$xvalues[$k] $yvalues[$k] $zvalues[$k],\n"}
>  close (OUT) || die "Can't close $filename: $!";
>}
>
>I think I need a 'w' tag somewhere or something?? This is the error message
>I am receiving:
>
>Can't open c:\testnew.txt: No such file or directory at ....

You should use "use strict" and -w, as in

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

in any case.

Just to be sure, you didn't by any chance say

my $filename = "c:\testnew.txt"

??? Because in this case the "\t" is taken to be a tab, which
obviously won't work.



Marcel
-- 
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'


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

Date: Tue, 17 Aug 1999 14:43:07 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: problems creating and saving to file...
Message-Id: <37B9BB4B.EB30EA52@texas.net>

Andrew Weller wrote:
> 
> Dear all,
> 
> I am trying to open a new file that doesn't exist and write to that file -
> this is the current code I am using:
> 
>   open (OUT, $filename) || die "Can't open $filename: $!";

perldoc -f open

You want to *write to* the file.

- Tom


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

Date: Tue, 17 Aug 1999 12:18:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q:Two perl programs printing to one txt file
Message-Id: <MPG.1223557f518c6032989e62@nntp.hpl.hp.com>

In article <37B9A20F.2E2F08D9@cisco.com> on Tue, 17 Aug 1999 10:55:28 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ danmex@my-deja.com wrote:
> 
> > I have a problem: there are two perl programs that append to the same
> > TXT file, but when both of them try to do it at the same time the TXT
> > file end all messed up.
> > Is there any way for the programs to "take turns" or to know that the
> > other program is not finished and wait until its done?
> > Could you point me to a script that has some example code?
> 
> You need to lock the file and seek to the end before attempting
> to do a write to the file. Read perldoc -f   flock.
> There is some sample code also.

We have been over this several times alread.  Opening the file in each 
program to append is all that is necessary.  The seek is unnecessary.

Locking isn't really necessary, but cannot hurt.  The OS guarantees that 
each append to the file is atomic, but it needn't be a complete line, if 
that matters.  So interleaving of line fragments is possible if the file 
isn't locked by each writer.

See, for example, 
<URL:http://x30.deja.com/[ST_rn=ps]/getdoc.xp?AN=503630547>

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


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

Date: Tue, 17 Aug 1999 13:26:54 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Q:Two perl programs printing to one txt file
Message-Id: <37B9C58D.60D07CBB@cisco.com>

[ Larry Rosler wrote:

> Opening the file in each program to append is all that is necessary.  The
> seek is unnecessary.

Yes. Only if you assume that you want to do a single append and immediately
after opening the file.




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

Date: Tue, 17 Aug 1999 20:57:39 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: Q:Two perl programs printing to one txt file
Message-Id: <71ku3.16285$C6.182695@news2.rdc1.on.home.com>

Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.1223557f518c6032989e62@nntp.hpl.hp.com...

: See, for example,
: <URL:http://x30.deja.com/[ST_rn=ps]/getdoc.xp?AN=503630547>

$topic{'on'} = 0;
But just in case anyone cares.

http://x30.deja.com/=dnc/getdoc.xp?AN=503630547

Frankly, I like the old look using =dnc better.  Fewer ads, and cleaner.

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--Random Quote--
The product of an arithmetical computation is the answer to an equation; it
is not the solution to a problem.
  Ashley-Perry Statistical Axioms[4]





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

Date: 17 Aug 1999 16:08:34 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: renaming a subroutine
Message-Id: <x7lnbayxto.fsf@home.sysarch.com>

>>>>> "KH" == Kevin Howe <khowe@performance-net.com> writes:

  KH> # default call
  KH> print $food->GetPriceOf('Apple');

  KH> # rename the function name
  KH> $food->rename_functions(
  KH> GetPriceOf = 'Price',
  KH> );

  KH> # new call
  KH> print $food->Price('Apple');

use a typeglob.

something like (tested):

$foo = FOO->new() ;

$foo->rename_function( 'bar', 'barf' ) ;
$foo->bar() ;
$foo->barf() ;


package FOO ;

sub new { bless {} } ;

sub bar {
	print "bar called\n" ;
}

sub rename_function {

	my ( $self, $old_func, $new_func ) = @_ ;

	no strict 'refs' ;	# you have use strict enabled, don't you?

	*{__PACKAGE__ . "::$new_func"} = \&{$old_func} ;

# or more dynamically
#	*{ref($self ) . "::$new_func"} = \&{$old_func} ;

}


uri

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


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

Date: Tue, 17 Aug 1999 16:45:32 -0400
From: JP <Jeff.T.Parker@compaq.com>
Subject: Resolving, Capturing, Storing a file on the network
Message-Id: <37B9C9EC.E34687B2@compaq.com>

After the Perl FAQ, after the idiot's guide to CGI programming, after
reading & hoping
for a gem in the already posted mail of this and other newsgroups, I
grew weary
and decided to experiment with a few newbie lines of code.
 ....~~yea, right.  That was a while of wasted effort.
Feel free to flame if that's your normal M.O. for newbies.
But, here's my question (in addition to all the others out there):
In my current script, a user has inputed a path to a remote file, say:
I:\somedir\anotherdir\ohanother\yetanother\Config.txt
(yes, note the mapped drive, evil empire OS being the client's)
This path, stored in say, variable $FileFoo, means little to the machine
the
perl script resides on since it's certainly not the same mapping.
Q:  how to resolve that mapping, find the file & allow it to be used?
Bonus Q: how to use it?  How to rewrite it to a "control" file, always
where perl will know how to find it?
-you're forever in my debt for being challenged, all you japh's.



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

Date: Tue, 17 Aug 1999 20:39:31 GMT
From: apothen@my-deja.com
Subject: Running Perl CGI in Apache on WinNT
Message-Id: <7pcha1$iok$1@nnrp1.deja.com>

   I've recently installed the most recent
release of Active Perl on my WinNT machine. I
downloaded a simple file upload script, installed
it per instructions (that much I can do :), and
gave it a whirl. Unfortunately, whenever I
attempt to upload a file Apache returns the
unhelpful "Server Error"; checking the error log,
it says "No such file or directory: Unable to
spawn child process "e:\<path>"."

   I have never run scripts off WinNT before, so
I imagine that it is a very simple config error
on my part. Perhaps I have the permissions set
improperly, or I may not have the path info in
the Perl file correct. The path to Perl is
C:\Perl\bin, but the script itself resides on E:,
which may be a prob.

Thanks for any help,
 George


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


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

Date: Tue, 17 Aug 1999 19:33:09 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: What editors are folks using for PerlScript development?
Message-Id: <37bec471.31184190@news>

On Tue, 17 Aug 1999 11:27:52 -0700, "Ken Snyder" <ksnyde@pacbell.net>
wrote:

>What editors are folks using for PerlScript development under Windows?  I
>have had some success with Homesite but would like to use Visual Interdev.
>Is there anyway to get Interdev to parse Perl?  Is there a better editor I
>should use instead?

I don't use PerlScript, only Perl, and HomeSite is pretty decent. I've
also tried VI (that's Visual Interdev, not TomC's favorite editor vi),
but it forces you to install all sorts of server extensions, specify
routes to "deploy" your site (as opposed to simply copying it to the
server) and so on.

Use a *real* IDE: Emacs (http://www.emacs.org)

Not only is it a fully (not "fully" in the HomeSite or CodeWright
sense, but "fully in *every* aspect") programmable editor, it can also
be a mail reader, newsreader, shell, and (with the right package) it
also helps you to write Perl code and it even lets you execute Perl
code from within Emacs. Or you might configure it to bring up perldoc
or manpages at the touch of a button.

With most (with the possible exception of vi, which I don't really
know) other editors, you are ultimately limited by what the editor's
creators have thought of, but with Emacs you're only limited by your
imagination.


Marcel
-- 
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'


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

Date: Tue, 17 Aug 1999 19:41:38 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: While we are on the subject of tainting....
Message-Id: <SViu3.7267$x04.408766@typ11.nn.bcandid.com>

In article <FGLs51.CnK@csc.liv.ac.uk>, I.J. Garlick <ijg@connect.org.uk> wrote:
>I happen to be doing the following in a CGI where it is frequently said
[snip]

>For instance I do
>
>   my @ret = `$prog $opts 2>$errout`;
>
>However after reading the perlsec man page (essential reading for
>tainting) it appears it's impossible to untaint backticks when -T is on.
>Lower down there is a way of replacing the backtick command with a call to
>exec (I think, this is where the confusion sets in on my part). I am
>probably being dense here but I can not see how those 20 odd lines of code
>can be used to replace the backtick call above.

Well, unless your program really is set-id, you can forget about all the
uid-switching stuff. That cuts it down a lot.

>I won't reproduce the code here as evryone should have it (it's about 267
>lines down and starts use English;)

Here's the important part:

               exec 'myprog', 'arg1', 'arg2'
                   or die "can't exec myprog: $!";

This is where you put your command ($prog and $opts) but you must split it
into an argv array yourself rather than letting the shell do it. So, it goes
like this:

  exec $prog, split(/\s+/, $opts) or die "exec failed: $!";

That doesn't take care of your 2>$errout though. To do that, you should put
before the exec:

  open(STDERR, ">$errout") or die "Can't divert stderr: $!";

Now you've converted your original to a fork, open, and exec (and a read loop
in the parent process), and you can begin the actual untainting. To do that
you need to figure out which variable is tainted - $prog, $opts, or $errout.
Which one(s) came from user input? You need to decide what values you want to
allow for these variables, check them and untaint them using regexps. There's
an example of that in the perlsec man page.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: Tue, 17 Aug 1999 14:10:38 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Write - multiple access
Message-Id: <x3y4shye0rl.fsf@tigre.matrox.com>


"Pascal HOARAU" <pascal@stnfrance.com> writes:

> who can give me a valid and profesionnal solution to keep people from
> writing in a file that is already opened for writing.
> That is for a forum which can be visited 10M times per day ...
> 
> (please to avoid telling me about the "lock" file/sleep(1) method)

Why not? flock()ing the file is the best solution, especially if all
the programs that attempt to access the file check first for locked
files. Is there a reason why you don't want to use it?

Ala



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

Date: 17 Aug 1999 15:54:06 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: www.perl.org
Message-Id: <slrn7rjfes.4gl.dha@panix.com>

On Tue, 17 Aug 1999 12:57:44 -0400, Elaine -HFB- Ashton
<elaine@chaos.wustl.edu> wrote:

>brian d foy wrote:
>> i still rever your BOFH-ness, even though it has been an interesting
>> watching people guessing passwords.  lots of people are trying "root"
>> as a username.
>
>root? heh. 

"An intelligent Carrot.  The mind boggles."  Keep watching the logs...

:-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"supported" is an MS term that means the function exists.  The fact
that it always fails means, that it is an exercise for the programmer.
	- Sarathy, p5p


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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


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


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