[15452] in Perl-Users-Digest
Perl-Users Digest, Issue: 2862 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 25 18:10:31 2000
Date: Tue, 25 Apr 2000 15:10:19 -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: <956700618-v9-i2862@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 25 Apr 2000 Volume: 9 Number: 2862
Today's topics:
Re: How to replace these strings in a html file (2nd p (Tad McClellan)
Keystrokes on Win32 neilmoomey@my-deja.com
Re: man2html (Tad McClellan)
Re: man2html <gellyfish@gellyfish.com>
Re: min/max (Bart Lateur)
Re: multi-file search/replace <rootbeer@redcat.com>
Re: multi-file search/replace (Marcel Grunauer)
Re: newbie: camel vs. llama <gellyfish@gellyfish.com>
Re: oracle client instalation <makarand_kulkarni@My-Deja.com>
Re: Out of memory! (Tad McClellan)
Package for handling INI-type files? <paul_m_thompson@my-deja.com>
Re: Package for handling INI-type files? <jeff@vpservices.com>
Re: Package for handling INI-type files? (Jerome O'Neil)
Re: Passing arguments to a perl script on NT <nasinowski@hbesoftware.com>
Re: Passing arguments to a perl script on NT <rootbeer@redcat.com>
Re: Perl (UUCP mail server utility) hacking Mail::Send <gellyfish@gellyfish.com>
Re: perl problem??? <rootbeer@redcat.com>
Re: perl problem??? <gellyfish@gellyfish.com>
Printing Line Numbers <Chris.Ottinger@iname.com>
Re: Printing Line Numbers <rootbeer@redcat.com>
Re: Printing Line Numbers <lr@hpl.hp.com>
Re: Printing out the hex or ascii values of a string of siva_ayyar@my-deja.com
Re: problems with spaces in filenames <sid@eurekanet.com>
Re: question about formmail <rootbeer@redcat.com>
Re: Question How can I su to a different user, and exec <rootbeer@redcat.com>
Re: Retrieving file information from remote machines? <rootbeer@redcat.com>
script help! dreiger@rnci.com
Re: script help! <rootbeer@redcat.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 25 Apr 2000 08:08:04 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to replace these strings in a html file (2nd post)
Message-Id: <slrn8gb2l4.56q.tadmc@magna.metronet.com>
On Tue, 25 Apr 2000 01:32:08 -0400, Huy Vu <huyv@usa.net> wrote:
>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; " >
>
>with string2=
>
>>·</FONT><FONT size=2 style="font-family:'Arial'; font-size:9pt; "
>> </FONT><FONT size=2
>style="font-family:'Arial'; font-size:10pt; " >
>I have difficulty in escaping the metacharacters in these strings.
I don't think your difficulty is related to metachars.
There are no regex metacharacters in either of those strings!
Show us the code that you tried, and we will try and help you fix it.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 25 Apr 2000 18:50:07 GMT
From: neilmoomey@my-deja.com
Subject: Keystrokes on Win32
Message-Id: <8e4pcr$nv5$1@nnrp1.deja.com>
Is it possible to use Perl to open up a Windows
application like MS Word or Adobe Acrobat and
enter short cut keystrokes. I am trying to
automate word to pdf on a server. Thanks a bunch.
Neil
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 24 Apr 2000 19:34:12 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: man2html
Message-Id: <slrn8g9mfk.4kb.tadmc@magna.metronet.com>
On Mon, 24 Apr 2000 23:18:08 GMT, Ira Weiner <idontlikespam_jcman@worldnet.att.net> wrote:
> I recently installed this
What "this"?
A Google search shows several programs named "man2html".
Best to include a URL or version number or something, so
we know what it is that you have.
I will assume that we are talking about the one written by
Earl Hood.
>on my linux machine to convert man pages to an
>easily readable HTML doc. But I am unable to get it to work.
^^^^^^^^^^^^^^^^^^^^^^^^
Errr, what did you try?
We can't tell you what you did wrong if you don't tell us
what it is that you did.
The documentation on the homepage
http://www.oac.uci.edu/indiv/ehood/man2html/doc/man2html.html
shows pretty clearly how to run it.
>I can run
>other CGI scripts,
^^^^^
Oh.
We must be talking about different software named 'man2html'
then. Earl's is a command line program, has nothing to do
with the WWW.
>so I don't think it is a web server or permissions
>problem.
Me either.
>Has anyone else gotten this perl script to work?
^^^^^^^^^^^^^^^^
We (I, anyway) am not too sure what that is.
Which program, exactly, is it that you are referring to?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 25 Apr 2000 21:15:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: man2html
Message-Id: <8e4ucl$soe$1@orpheus.gellyfish.com>
On Tue, 25 Apr 2000 12:33:42 GMT Ira Weiner wrote:
> Bart Lateur <bart.lateur@skynet.be> wrote in message
> news:39066518.8663375@news.skynet.be...
>> Makarand Kulkarni wrote:
>>
>> >> Has anyone else gotten this perl script to work?
>> >
>> >yes. I got it to work. It works !!
>>
>> Gee, that is helpful.
>>
>
> The version I have appears to work such that I need to "man <command> |
> man2html" and man2html reads stdout and formats it to HTML. I wrote a
> simple script to do this, but it does not recognize my environment variable.
> I guess the question now becomes: how to pass an environment variable from a
> browswer to a UNIX script
>
> #!/bin/bash
> /usr/bin/man $1 | ./man2html
>
Quite honestly I wouldnt bother ;-} If you get the latest version of
'groff' then you can do :
groff -man -Thtml /usr/man/man1/red.1
For instance and cut out the middle man.
If you are using a version of 'man' that supports it you
could use the '-w' flag to get the path of the file that man would use.
Of course you could wrap all this in a Perl program.
/J\
--
The only link between Literature and the Drama left to us in England at
the present moment is the bill of the play.
--
fortune oscar homer
------------------------------
Date: Tue, 25 Apr 2000 20:57:57 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: min/max
Message-Id: <39070663.519590@news.skynet.be>
Ilmari Karonen wrote:
>Hey, now! Sort may be an inefficient tool for this job, but it's not
>quite *that* bad. We're not talking about some silly bubblesort here,
>but quicksort, which is O(n*log n) on average.
Oops, sorry.
>loop_random: 3 wallclock secs ( 3.79 usr + 0.00 sys = 3.79 CPU)
>loop_sorted: 6 wallclock secs ( 5.38 usr + 0.00 sys = 5.38 CPU)
>sort_random: 25 wallclock secs (25.10 usr + 0.00 sys = 25.10 CPU)
>sort_sorted: 13 wallclock secs (13.11 usr + 0.00 sys = 13.11 CPU)
Oof. So my approach is faster than dumb sorting. Good to see that common
sense still pays off. Well, with plain perl vs. compiled primitives,
you're never really sure.
--
Bart.
------------------------------
Date: Tue, 25 Apr 2000 11:08:52 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: multi-file search/replace
Message-Id: <Pine.GSO.4.10.10004251108380.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, mr. wobbet wrote:
> can someone point me to a perl implementation of a multi-file search
> and replace utility?
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 19:10:10 GMT
From: marcel@linux.local (Marcel Grunauer)
Subject: Re: multi-file search/replace
Message-Id: <slrn8gbrlr.1g1.marcel@linux.local>
On Tue, 25 Apr 2000 09:00:41 -0500, mr. wobbet
<rsanford@nolimitsystems.com> wrote:
>can someone point me to a perl implementation of a multi-file search
>and replace utility?
Something along the lines of
perl -i -pe 's/old/new/g' *.txt
might help.
perldoc perlrun
too.
HTH
Marcel
------------------------------
Date: 25 Apr 2000 22:21:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie: camel vs. llama
Message-Id: <8e5291$9o6$1@orpheus.gellyfish.com>
On Tue, 25 Apr 2000 06:56:13 GMT octinomos endemoniado wrote:
> On Mon, 24 Apr 2000 13:13:37 GMT,
> Elaine Ashton <elaine@chaos.wustl.edu> wrote:
> #
> # in article 8e0v8q$rsp$1@nnrp1.deja.com, octinomos endemoniado at
> # jesucristo2@netscape.net quoth:
> # > i heard the camel and llama books were pretty good
> # > by christiansen... if so, which one should i start
> # > with, what's the difference, why is the camel one
> # > more expensive... any info appreciated...
> #
> # One spits, one don't.
> #
> # The one that spits purports to be 'learnin'' Perl for those new to
> # Perl not to programming.
>
> what do you mean it spits?
>
> # The one that doesn't spit is a hefty tome
> # for those who are already familiar.
>
> what do you mean it doesn't spit?
>
Well there are these big furry things with legs at the corner. Some of
them are smaller and live in the Andes and have rather an unpleasant
reaction to things that displease them. And some of them live in North Africa
and the Arabian penininsula are slightly larger and dont do that so much.
/J\
--
Mmmm, purple.
--
fortune oscar homer
------------------------------
Date: Tue, 25 Apr 2000 13:06:02 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: oracle client instalation
Message-Id: <3905FAAA.7265160B@My-Deja.com>
> Somebody knows what packages I need install?
you need DBI and DBD::oracle which in turn
need some client files/libs that are supplied by oracle.
> I need files/packages form Oracle?
yes.
Please check some messages from a discussion
group. The url is below
http://theoryx5.uwinnipeg.ca/CPAN/data/DBD-Oracle/README.clients.html
that might help.
------------------------------
Date: Mon, 24 Apr 2000 19:12:08 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Out of memory!
Message-Id: <slrn8g9l68.4gf.tadmc@magna.metronet.com>
On Mon, 24 Apr 2000 21:14:31 GMT, vinman72@my-deja.com <vinman72@my-deja.com> wrote:
>as is seen in the following actual code:
^^^^^^^^^^^
^^^^^^^^^^^
>open (OUTFILE, ">/collector/test.ver");
Aww, quit joking with us.
Nobody calls open() in "actual code" without checking the return value.
You'll have to do better than that to fool us.
Nice try.
open (OUTFILE, '>/collector/test.ver') ||
die "could not open '/collector/test.ver' $!";
:-)
:-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 25 Apr 2000 18:31:10 GMT
From: pt <paul_m_thompson@my-deja.com>
Subject: Package for handling INI-type files?
Message-Id: <8e4o9e$n0b$1@nnrp1.deja.com>
Is there a package for handling windows INI-style files?
--
* Extra or missing linefeeds free from Deja.
* Obscure what you know.
* Pontificate on what you don't.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 25 Apr 2000 11:48:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Package for handling INI-type files?
Message-Id: <3905E885.A934DAA8@vpservices.com>
pt wrote:
>
> Is there a package for handling windows INI-style files?
>
DBD::RAM will handle simple name=value INI files. It does not (yet)
know how to handle sections within the files e.g. [prog-name].
Basically the module treats the INI file as a database and allows you to
search, select, update, delete, insert records within it.
--
Jeff
------------------------------
Date: Tue, 25 Apr 2000 19:34:10 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Package for handling INI-type files?
Message-Id: <SqmN4.667$iU2.21720@news.uswest.net>
In article <8e4o9e$n0b$1@nnrp1.deja.com>,
pt <paul_m_thompson@my-deja.com> writes:
> Is there a package for handling windows INI-style files?
IniConf.pm
NAME
IniConf - A Module for reading .ini-style configuration
files
HTH!
------------------------------
Date: Tue, 25 Apr 2000 18:10:30 GMT
From: Nelson Asinowski <nasinowski@hbesoftware.com>
Subject: Re: Passing arguments to a perl script on NT
Message-Id: <3905DF92.9030705@hbesoftware.com>
Ivo Swartjes wrote:
> =
> 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.=
Check out info on the @ARGV variable.
Here is a snippit of code the uses it.
# cla.pl
$i=3D0;
foreach $arg (@ARGV) {
print "Argument ",$i++," is ",$arg,"\n";
}
This is the log of=A0 running it with a list of=A0 arguments.
perl cla.pl "name=3DTest&password=3DTest" hello 1 2 3.4 'in single quotes=
' =
"in double quotes"
Argument 0 is name=3DTest&password=3DTest
Argument 1 is hello
Argument 2 is 1
Argument 3 is 2
Argument 4 is 3.4
Argument 5 is 'in
Argument 6 is single
Argument 7 is quotes'
Argument 8 is in double quotes
Note this ran on Win 98.=A0 Your results may vary.
------------------------------
Date: Tue, 25 Apr 2000 11:19:36 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Passing arguments to a perl script on NT
Message-Id: <Pine.GSO.4.10.10004251119140.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, Ivo Swartjes wrote:
> 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.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.cpan.org/
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html
http://www.cpan.org/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 25 Apr 2000 20:36:59 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl (UUCP mail server utility) hacking Mail::Send ack.
Message-Id: <8e4s4r$lcp$1@orpheus.gellyfish.com>
On Tue, 25 Apr 2000 16:45:05 GMT Brad Johnson wrote:
> 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?
>
The set method of the Mail::Send object.
/J\
--
Ah, good ol' trustworthy beer. My love for you will never die.
--
fortune oscar homer
------------------------------
Date: Tue, 25 Apr 2000 11:18:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl problem???
Message-Id: <Pine.GSO.4.10.10004251116510.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, peter wrote:
> Subject: perl problem???
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> 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"
Sure. Consider running the program via backticks, so as to capture its
output. Then you can parse it with a regular expression and print whatever
you'd like. Any good introductory book on Perl (such as the popular Llama
book, "Learning Perl" from O'Reilly) should cover these topics in
sufficient detail.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 25 Apr 2000 21:36:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl problem???
Message-Id: <8e4vk7$13r$1@orpheus.gellyfish.com>
On Tue, 25 Apr 2000 10:44:52 -0700 peter wrote:
> 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"
>
Why use a file ? You can simply do something like :
my ($users) = `/usr/bin/who -q` =~ /users=(\d+)/;
And if you want to lose that horrid 'user(s)' you might do :
my $utext = $users > 1 ? 'users' : 'user';
Then print it all :
print "You have $users $utext on your system\n";
/J\
--
Hey, I asked for ketchup! I'm eatin' salad here!
--
fortune oscar homer
------------------------------
Date: Tue, 25 Apr 2000 15:39:29 -0700
From: "Chris Ottinger" <Chris.Ottinger@iname.com>
Subject: Printing Line Numbers
Message-Id: <donN4.469$t4.16099@news.ou.edu>
This is probably and easy ? but I was wondering if there is any way to print
line numbers:
For Example I have a script that has a sub routine built for Win32 Error
handling and I wanted to inject the Line # of the script that sent it to
that routine:
ie LINE #25 ERROR: ????
Thanx
Chris
------------------------------
Date: Tue, 25 Apr 2000 13:45:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Printing Line Numbers
Message-Id: <Pine.GSO.4.10.10004251344100.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, Chris Ottinger wrote:
> This is probably and easy ? but I was wondering if there is any way to
> print line numbers:
I think you want __LINE__, which is the current line number.
&my_error_handler("Broken frammistat", __LINE__, __FILE__);
I'll let you guess what __FILE__ is. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 14:21:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Printing Line Numbers
Message-Id: <MPG.136fac22cf77ba4f98a97d@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <Pine.GSO.4.10.10004251344100.25963-
100000@user2.teleport.com> on Tue, 25 Apr 2000 13:45:26 -0700, Tom
Phoenix <rootbeer@redcat.com> says...
> On Tue, 25 Apr 2000, Chris Ottinger wrote:
>
> > This is probably and easy ? but I was wondering if there is any way to
> > print line numbers:
>
> I think you want __LINE__, which is the current line number.
>
> &my_error_handler("Broken frammistat", __LINE__, __FILE__);
It might well be simpler and require fewer changes to existing code to
let the called function figure it out.
In &my_error_handler:
($package, $filename, $line) = caller;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 25 Apr 2000 19:51:48 GMT
From: siva_ayyar@my-deja.com
Subject: Re: Printing out the hex or ascii values of a string of characters
Message-Id: <8e4t0e$ru7$1@nnrp1.deja.com>
In Unix, od -xc [filename]
> I would like to print out the ascii values of a string. How would one
go
> about doing this? This is so I can identify the non displayed
characters?
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 25 Apr 2000 14:16:30 -0500
From: Sid Mal <sid@eurekanet.com>
Subject: Re: problems with spaces in filenames
Message-Id: <3905e108$0$25401@news.eurekanet.com>
It appears that you are working with windows.
I am assuming you are using 95 or 98. I have no experience with NT or
2000 so it might or might not work.
Try using the MSDOS naming format where
"C:/program files/fred.exe" will probably be
"C:/progra~1/fred.exe"
Hope this helps.
Sid.
Paul Spitalny wrote:
>
> Hi,
> I can't seem to get this type of statement to work:
>
> system("c:/program files/fred.exe $arg1 $arg2");
>
> It seems that the space in the directory name is the problem. How can I
> get around this problem (WITHOUT re-naming the directory, too late for
> that, I'm in too deep).
>
> Thanks,
>
> Paul
>
> --
> To respond to this posting, remove -nospam- from my email address.
> Sorry for the inconvenience
------------------------------
Date: Tue, 25 Apr 2000 11:10:41 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: question about formmail
Message-Id: <Pine.GSO.4.10.10004251109240.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, Patrick wrote:
> Subject: question about formmail
> What is the line to enter to use for user emailaddress??
If the docs which came with your program are insufficient to answer such a
simple question, you should ask for your money back. But consider asking
whoever gave it to you whether there are better docs available. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 11:15:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Question How can I su to a different user, and execute mail as that user.
Message-Id: <Pine.GSO.4.10.10004251111040.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, Dave LaPorte wrote:
> I am trying to have a perl program send mail using another users UID
I hope the other user doesn't mind!
> ( NOTE: the app will be fired off from one of roots crons ).
So, I hope you've read the perlsec manpage.
> The program will su to a user name, and then send mail as that user.
No; just set $< and friends. Of course, if you're wanting to do this for
more than one user, fork first and let the child change IDs. See perlvar.
> 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.
You don't have to change IDs for that! Just send the right headers. To
learn more about headers and how to send them, search for the docs, FAQs,
and newsgroups about e-mail.
Of course, you could write a simple program which the users would use to
send their own mail. It could avoid a lot of security worries. But that
would be too easy. :-)
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 12:42:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Retrieving file information from remote machines?
Message-Id: <Pine.GSO.4.10.10004251241590.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000, Wyvern wrote:
> 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.
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.cpan.org/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 25 Apr 2000 21:21:42 GMT
From: dreiger@rnci.com
Subject: script help!
Message-Id: <39060b7a.350766465@news.fast.net>
Help!
I'm stuck in this project, and I am NOT any kind of programmer
(as my code will show)... I can't figure out how to get this to loop,
so it generates my report for all "clients" instead of the last one on
the list.... What I have so far is listed below... Looks like my
news reader mangled the layout - sorry :(
#!/usr/bin/perl
#Main bandwidth reporting script
#Version 1 - 03/08/2000 - DMR
#Updated 4/20/2000
#This is still quick and dirty, without error checking!
#
#Portion to connect to workflow DSN and get client login info
#
use DBI;
#$dsn=test;
$dsn=workflow;
$user=workflow;
$pass=workflow;
$host="workbeth1.rnci.com";
#DBI:FreeTDS:database=$DATABASE;host=$DBHOST
unlink 'dbitrace.log' if -e 'dbitrace.log';
DBI->trace(1, 'dbitrace.log'); #transaction logging for error finding
my $dbh = DBI->connect( "dbi:FreeTDS:database=$dsn;host=$host",
"$user", "$pass" );
#statbeth2 processing here
#
$sth = $dbh->prepare( "
SELECT StatLogin,
StatsServer, DomainName, Deprecated
FROM DNSForward
WHERE Hostname = 'www'
AND DomainName NOT
LIKE '%.name removed%'
AND StatsServer =
'name removed'
AND StatLogin NOT LIKE
'%EMPLOYEE%'
AND StatLogin NOT LIKE
'%RNCI-CORP%'
AND Deprecated = 'AP'
AND StatLogin <> ' '
");
$sth->execute();
open FILE1, ">temp.statbeth2" or die "No Database For You: $!";
$rows = $sth->dump_results( 80, "\n", ";", \*FILE1);
$words=~s/ ' / /g;
close FILE1 or die "No can close dude: $!\n";
cleanup1(); #cleans the DB output to it's easier to use and read
getlogin1(); #searches cleaned up DB file for variables to assign to
$login, $domain, and $server
makereport(); #writes html template file so reports can be put
somewhere
dodynamic(); #Pulls the dynammic URL number from statbeth2 for each
client report and posts to array @mymatch
#error logging to /tmp/statbeth2-error.log
open (FILE, "lynx.statbeth2") || die "Can't open temp file: $!\n
>>/tmp/statbeth2-error.log";
while (<FILE>) {
@mymatch = /\b(_\d+_)\b/;
}
close (FILE);
print "The array dynamic contains: @mymatch\n";
#routine for pulling bandwidth report from tempfile for statbeth2
#error logging to /tmp/statbeth2-error.log
fetchreport();
open (FILE1, "report.temp") || die "Can't open temp file: $!\n
>>/tmp/statbeth2-error.log";
while (<FILE1>) {
@mymatch2 = /Total bandwidth : \d+\.\d+
kilobytes/;
@mymatch2 = $&;
}
print "Array mymatch2 is: @mymatch2\n";
close (FILE1);
open (REPORT, ">>statbeth2-report.html") || die "Can't open html
report file: $!\n >>/tmp/statbeth2-error.log";
printf REPORT "<TD>$login</TD><TD>@mymatch2</TD><TD>$domain</TD>\n";
close (REPORT);
closereport();
#subroutine for gathering temp data from statbeth2
sub dodynamic {
system "/usr/bin/lynx -dump
http://webstats3.rnci.com/ss?setsite=$login >lynx.statbeth2";
return;
}
#subroutine that gathers temp report containing bandwidth usage for
each client from statbeth2
#this uses the array from dodynamic() to assign the dynamic number
used in the URL
sub fetchreport {
system "/usr/bin/lynx -dump
http://webstats3.rnci.com/@mymatch/ss?execprevmonth >report.temp";
open (FILE1, ">>report.temp") || die "Can't open temp file:
$!\n >>/tmp/statbeth2-error.log";
if (-z 'FILE1') {
$_ = "";
printf FILE1 "This client has no data!\n";
} else {
return;
}
}
#Subroutine below cleans up the database dump, as well as some of the
temp files no longer needed after this part
#for the db dump only for statbeth2
sub cleanup1 {
system "cleanup";
return;
}
#Subroutine for makeing the html template
#
sub makereport {
#backup old report first!
# backup();
$today = (localtime);
system "rm statbeth2-report.html";
open (REPORT, ">statbeth2-report.html") || die "Can't generate
the HTML Report: $!\n >>/tmp/statbeth2-error.log";
printf REPORT "<META Content-type: text/html>\n\n";
printf REPORT "<HTML><HEAD><TITLE>Last Month Bandwidth Report
for Statbeth2 Clients</TITLE></HEAD>\n";
printf REPORT "<BODY><CENTER>Last Month Bandwidth Report for
Statbeth2 Clients - Generation Date: <B>$today</B></CENTER>\n";
printf REPORT "<HR>";
printf REPORT "<table BORDER COLS=3 WIDTH=\"75%\"><tr>\n";
printf REPORT "<td><center><b>Client Stats
Login</b></center></td>\n";
printf REPORT "<td><center><b>Bandwidth Used in
Kilobytes</b></center></td>\n";
printf REPORT "<td><center><b>Domain
Name</b></center></td></tr>\n";
close (REPORT);
return;
}
sub closereport {
open (REPORT, ">>statbeth2-report.html") || die "MS Says:
Netscape Engineers Are Weenies! $!\n";
printf REPORT "</TABLE>\n";
close (REPORT);
return;
}
sub clean1 {
system "cat temp.statbeth2 | sed s/\'//g >dbdump.txt";
return;
}
sub clean2 {
system "cat dbdump.txt | sed s/AP//g >dbddump.txt";
return;
}
sub clean3 {
system "cat dbddump.txt | sed s/\;/\|/g >dbclean.txt";
return;
}
#Subroutine for pulling $login, $domain, and $server from temp DB file
sub getlogin1 {
open (DATABASE, "dbclean.txt");
while (<DATABASE>) {
@fields = split(/\|/), <DATABASE>;
$login = $fields[0];
$domain = $fields[2];
$server = $fields[1];
}
print "Database splitup into: @fields\n";
print "Login is: $login\n";
print "Domain is: $domain\n";
print "Stats Server is: $server\n";
close (DATABASE);
}
#backup sub
sub backup {
system "tar cvf statbeth2-backup.tar ./statbeth2.report.html";
return;
}
------------------------------
Date: Tue, 25 Apr 2000 14:52:04 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: script help!
Message-Id: <Pine.GSO.4.10.10004251447470.25963-100000@user2.teleport.com>
On Tue, 25 Apr 2000 dreiger@rnci.com wrote:
> Subject: script help!
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I am NOT any kind of programmer
So, do you want to become a programmer, or to hire one? If you're looking
to become one, perhaps you should search for an introductory course on
programming. If you'd like to hire one, there are many newsgroups with
'jobs' in their names, or you could just visit your local Perl Mongers.
If you'd like help on your code, cut it down to one or two lines which
aren't doing what you want, and be sure to check the docs about those
lines. But if you're still stuck, post those one or two lines here,
perhaps with a line or two more to give them context. That'll help to
ensure that you'll get some help from the newsgroup.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 2862
**************************************