[10255] in Perl-Users-Digest
Perl-Users Digest, Issue: 3848 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 29 08:08:06 1998
Date: Tue, 29 Sep 98 05:00:42 -0700
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, 29 Sep 1998 Volume: 8 Number: 3848
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: Alternate colors in tables with perl command? (Michael Fuhr)
Automatically change content of HTML-page with Perl mcalbers@multivisual.nl
Automatically uploading files with perl mcalbers@my-dejanews.com
Cookies w Perl on IIS 3.0 <pinne@pegit.se>
delayed $aa += $n desired <xah@best.com>
Re: File Reading <paaa@uic.nnov.ru>
Re: format help huntersean@hotmail.com
help needed (bjjgann)
Re: how do I get array slice of multidim. array???? huntersean@hotmail.com
Last Logon info extracted from RAS server logfiles Help <avi318k1@pn.nettuno.it>
Re: leading space <paaa@uic.nnov.ru>
Re: LWP on NT fails to fetch more than 4000 URLs. <aas@sn.no>
Re: Manipulating Single lines in file... <paaa@uic.nnov.ru>
Re: Perl bug? Pack command huntersean@hotmail.com
Re: Perl Script Running as Root <J.D.Gilbey@qmw.ac.uk>
Re: Perl with use/require doesn't work under cron <paaa@uic.nnov.ru>
Re: Poll: How Did You Learn Perl? <phinneas@eskimo.com>
Re: Question about Sendmail, Perl, and CGI <paaa@uic.nnov.ru>
Re: Quick question about perl <paaa@uic.nnov.ru>
Socet script problem. <erhmiru@erh.ericsson.se>
Re: Sockets and setsockopt with multicasting (Ted Marz)
Re: system call treats vars as literals... (perl 5.005) <paaa@uic.nnov.ru>
Re: System() help <paaa@uic.nnov.ru>
URL & strings searches <meyricklouiseNOJUNK@btinternet.com>
Win32::OLE (Oscar Vallarino)
Win32::OLE (Oscar Vallarino)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Sep 1998 10:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage907064641.25785@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 29 Sep 1998 08:35:58 GMT
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Alternate colors in tables with perl command?
Message-Id: <6uq658$5g1@flatland.dimensional.com>
daniel@intecomp.com (Daniel Pray) writes:
> I've seen some professional web site that have a perl script list a
> database request. The table is alternated rows of color. Does anyone know
> how to do this?
Here's one way:
my @colors = qw(red white);
my $i = 0;
foreach my $answer (@answers) {
my $color = $colors[$i++ % @colors];
# your code here
}
--
Michael Fuhr
http://www.fuhr.net/~mfuhr/
------------------------------
Date: Tue, 29 Sep 1998 11:17:39 GMT
From: mcalbers@multivisual.nl
Subject: Automatically change content of HTML-page with Perl
Message-Id: <6uqfki$s9l$1@nnrp1.dejanews.com>
Does anyone know how to change the content of a HTML-page automatically using
Perl.
I need to change a page on a weekly base.
Thanks
Michael.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 10:24:27 GMT
From: mcalbers@my-dejanews.com
Subject: Automatically uploading files with perl
Message-Id: <6uqcgp$pd5$1@nnrp1.dejanews.com>
Hello,
Does anyone know how to automatically changing the content of a web page using
perl.
I need to add an url every week.
Thanks,
Michael.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 13:19:19 +0200
From: Pinne <pinne@pegit.se>
Subject: Cookies w Perl on IIS 3.0
Message-Id: <3610C237.552E@pegit.se>
Hi, does
anyone know what the deal with cookies under IIS 3.0 is
Why can't i access or set them them using the
$ENV{'HTTP_COOKIE'} variable ?
Please, I need help urgently
If, please reply to my email as well
/regards
Bjvrn-Eke Segrell / Pegit AB
------------------------------
Date: Tue, 29 Sep 1998 03:33:35 +0000
From: "Xah" <xah@best.com>
Subject: delayed $aa += $n desired
Message-Id: <6uqci0$crk$1@nntp2.ba.best.com>
Is there a way to get something like $aa =+ 2, so that the value of the
variable is returned before it is incremented?
What follows is a more detailed explanation.
The following code will print "1 2".
#!perl -w
my $aa = 1;
&{sub {print "$_[0] ";}}($aa++);
print $aa;
But, I really need the increment to be 2. So, if I change $aa++ to $aa+=2,
then it prints "3 3", which is not what I wanted. I want "1 3".
**The above is an extraction of my problem.** Here is my question: Is there
a way to replace ($aa++) by something else so I get my desired effect?
Xah, xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
Mountain View, CA, USA
------------------------------
Date: Tue, 29 Sep 1998 13:03:09 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: File Reading
Message-Id: <3610A24D.2FF74C60@uic.nnov.ru>
Reiner wrote:
>
> In some code I need to read a file until a certain line is reached so
> that I can read in the following lines. This code works well:
>
> $question = 1;
> # Go to current question
> while (?FILE? != $question) { }
>
> The problem is if the $question does not exist. I tried things like the
> line below but had no luck.
> while ((?FILE? != $question)) ?? (!$!) { }
Try this:
while((defined($_=<FILE>))&&($_!=$question)){}
------------------------------
Date: Tue, 29 Sep 1998 10:32:38 GMT
From: huntersean@hotmail.com
Subject: Re: format help
Message-Id: <6uqd06$pmc$1@nnrp1.dejanews.com>
try
format STDOUT_TOP=
foo bar whatever
----------------
.
Also, split with no args split on whitespace.
It would also be cooler to run the df command in a pipe and directly read from
it. Something like:
format STDOUT_TOP=
foo bar whatever
----------------
.
format STDOUT =
@<<<< @<<<<<<<< @<<<<<<<<
$one,$two,$three
.
open DF, "df -k |");
while (<DF>) {
($one,$two,$three);
write;
}
Good luck!
Sean Hunter
In article <360FCC7E.7E0E@klaskycsupo.com>,
jamdiaz@klaskycsupo.com wrote:
> I am trying to get info on formatting using perl.
>
> for example in unix if i want reformat the output of the df -k
> command
>
> open (test, "/etc/tester"); ##tester is df output
>
> while (<test>) {
>
> ($one,$two,$three) = split(' ');
> write >out;
>
> }
> format STDOUT =
> @<<<< @<<<<<<<< @<<<<<<<<
> $one,$two,$three
>
> I want to create column headers in the format ..for example
>
> Total Megabytes
> ----------------
>
> any ideas..
>
> Jamie Diaz
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 10:02:09 GMT
From: bjjgann@liv.ac.uk (bjjgann)
Subject: help needed
Message-Id: <F01IJL.6o4@liverpool.ac.uk>
I have a small perl script which opens a file , searches for a string and
replaces the string then saves the outcome to another file. This works fine
unless the serach string is a + to which i get an error :-
/+/: ?+* follows nothing in regexp
below is the code:-
($infilename = a);
($outfilename = b);
($search = "+");
($replace = "");
open(IN,$infilename) || die "cannot open $infilename for reading";
open(OUT,">$outfilename") || die "cannot create $outfilename";
while (<IN>) {
s/$search/$replace/gie;
print OUT $_; # print that line to file $b
}
close(IN);
close(OUT);
The code works fine with other $search variables such as = or &
Any help appreciated
------------------------------
Date: Tue, 29 Sep 1998 09:33:29 GMT
From: huntersean@hotmail.com
Subject: Re: how do I get array slice of multidim. array????
Message-Id: <6uq9h9$mm6$1@nnrp1.dejanews.com>
Your approach works the same in the multidimensional case. Use exactly the
same syntax, though. Don't try put in the second index or thinbgs will go
all "oeuf-shaped". Please note that your approach leaves an extra copy of
the last item in the array in each case. To be strictly correct, you should
pop it off.
Regards,
Sean Hunter
In article <6uoiva$7e6$1@news-1.news.gte.net>,
smaring@gte-es.com wrote:
> I have a two dimensional array from which I wish to delete a row.
>
> In the one dimensional case I can say:
> @array[$i..($sizeofarray-1)] = @array[($i+1)..($sizeofarray-1)];
>
> and $array[$i] will be deleted with subsequent entries shifted up.
>
> Given $array[$i][$j] and a desire to delete a given $i, the same
> approach
> does not work.
>
> Any ideas would be greatly appriciated.
>
> -Steve Maring
> Tampa, FL
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 04:18:51 +0000
From: "James A. Abercromby II" <avi318k1@pn.nettuno.it>
Subject: Last Logon info extracted from RAS server logfiles Help
Message-Id: <36105FAB.9CE4BB16@pn.nettuno.it>
My office has a RAS server running on a Win3.1 Box/486DX that we always
keeps 2 months or basically 2 log files. What I would like to do is
write a script that will extract any last logons by users that are 50
days old or more and dump to another text file in a little report
format, and then have the script email me and a couple of other people.
BTW - I read somewhere that there are no supported Perl distros for
Win3.1.
However I figure I can just install Win32 Perl 5 on my NT Box and copy
the RAS server log files to my machine and run the script from there.
I have written and ran just basic beginner type scripts based on info
from books and tutorials but nothing that complex and practical for the
real world.
Will a script like this be beyond a newbies potential?
Also, if anyone here can tell if there has already been a script like
this written, I would greatly appreciate it if someone can point me in
the right direction.
Our Network is basically 90% NT and ms, but I am slowly trying to wean
the management off of their dependency. If I can accomplish this job
using perl, and also create some other stuff to make managing the NT
domain easier. They will be convinced somewhat and maybe I can get them
to use more GPLed software.
Thank you very much for any info, insights, suggestions and help.
Jim Abercromby II
send email to
avi318k1@pn.nettuno.it
james.abercromby@aviano.af.mil
------------------------------
Date: Tue, 29 Sep 1998 13:25:53 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: leading space
Message-Id: <3610A7A1.388D2D83@uic.nnov.ru>
Sameer Sharma wrote:
>
> Hi,
> If I read in the contents of a file into an array and then print it, I
> get leading space in each of the elements but the first one.
>
> e.g.
>
> @bench = ?FILE_BENCH?;
> close (FILE_BENCH);
> open (FILE_BENCH, "?$file_bench");
> print FILE_BENCH ("@bench");
> close (FILE_BENCH);
>
> Since I am new at Perl, I could not find any direction from the
> docs/FAQs.
> Hopefully someone can tell me precisely what is wrong here.
> Sameer
Use instead:
$,='';
print FILE_BENCH @bench;
Lesha.
------------------------------
Date: 29 Sep 1998 11:32:45 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP on NT fails to fetch more than 4000 URLs.
Message-Id: <m3yar3uuv6.fsf@furu.g.aas.no>
fergus@twig.demon.co.uk (Fergus McMenemie) writes:
> Further to this article. I have copied the script to UNIX and had
> better luck there. The unix version ran fine fethcing over 68000
> page, but there appears to be some kind of limit on NT.
I recently got a copy of this message from Sarathy. Does this apply
to your situation?
-------------------------------
On Thu, 24 Sep 1998 09:40:58 CDT, Craig Brockmeier wrote:
>I'm using the perl5.00402-bindist04-bc.tar.gz build of perl on Windows/NT
>
>I wrote a program to check http links, but it starts failing with 500 server
>errors after checking about 4000 links. Using netstat -an to look at open
>sockets, it seems that the sockets are not being closed correctly.
There is a known socket leak in the win32 support in 5.00402. Later
versions don't have the problem.
- Sarathy.
gsar@engin.umich.edu
-------------------------------
------------------------------
Date: Tue, 29 Sep 1998 13:07:20 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: Manipulating Single lines in file...
Message-Id: <3610A348.F63C67C6@uic.nnov.ru>
The Astrochicken wrote:
>
> I am working on a glossary script and am almost complete; all i have left
> is the admin script, which has been causing me some troubles. I have 26
> files (one for each letter in the alphabet), in which the words and their
> definitions are stored, so each file looks something like this:
>
> word|number_assigned_2_word|definition
> word2|another_number|definition
> etc.
>
> I have gotten as far as making the admin script that displays the word that
> you wish to edit or delete, but i don't know how to manipulate single lines
> in a file. Is it possible to open the desired file and delete the line i
> wish to delete so i can replace it with the new, updated line (or not even
> replace it if i just want to delete the record)?
>
> If my previous paragraphs didn't make any sense, pretty much what i want to
> know is how to delete individual lines from a file. If you can provide
> information that would help me, it would be greatly appreciated. Thank
> you.
>
> -erik (The Astrochicken)
> agn@cryogen.com
> ICQ: 5408410
Try to read all file into array :
@Dict=<FILE>;
and you can manipulate $Dict[$Num] -single line!
Lesha.
------------------------------
Date: Tue, 29 Sep 1998 10:23:30 GMT
From: huntersean@hotmail.com
Subject: Re: Perl bug? Pack command
Message-Id: <6uqcf0$pcv$1@nnrp1.dejanews.com>
Perhaps you should learn a little perl before you go posting bugs. The test
code you posted demonstrates no knowledge or understanding of the language. A
slightly more knowlegeable perl hacker might write something like:
#!/usr/bin/perl -w
my @array = (["This ", "is ", "a ", "test."]) x 8;
print pack("A*" x 4, @{$array[0]});
print pack("A*", $array[0][0]);
> First, remember that "AAAA" means to return four strings space filled.
> (Which is different from "CCCC" which would mean to return four
> characters.)
Ok, I'm remembering... Perhaps you should remember that "space filled" !=
"space padded". Actually pack("An"...) means "take a string, and pack it as
a string of length n, padding with space if needed". "A" on its own = "A1"
in other words "a string of length 1" (a character). "A" skips trailing
spaces and nulls when unpacking, not when packing.
> What the results mean to me is that the PACK command doesn't know how to
> reference into the list of arrays properly.
>
What the results mean to me is that _you_ don't know how to reference into the
list of arrays properly. Or initialise one, or use pack, come to that. Check
out the perlref manpage (it should come with your docs, use the "perldoc"
utility if you have it on mac)
I have found the perl debugger in "interactive mode" very helpful. I do
perl -de 0
... and start exploring. Try this, try initialising variables, packing them,
and printing them out. If you try to print an array reference without
dereferencing it, you get something like "ARRAY(0xabadcafe)". This is what
your program does. It then packs the first char of four of these, and prints
them out. Voila!..."AAAA"
Regards,
Sean Hunter
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 29 Sep 1998 10:47:59 +0100
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Perl Script Running as Root
Message-Id: <3610ACCF.4A4E4521@qmw.ac.uk>
Benjamin wrote:
>
> How could I sortof 'su' at run-time in a Perl script? So that I can change
> some sensitive files if the script authenticates the
> session.
su requires a password, so unless you're prepared to put root's
password in the script, you might find this doesn't work.
One possible way around the problem is for the script to be
setuid root, and to either drop its privileges (with $>=$<;
or $EUID=$UID; if you use English;) if the authentication
fails, or to spawn a setuid-root child process to do the
sensitive processing, immediately drop privileges in the parent,
and then get the child to do the sensitive stuff if the
parent authenticates. Having the script setuid automatically
switches on taint checking, which is probably useful too.
HTH,
Julian
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey Email: J.D.Gilbey@qmw.ac.uk
Dept of Mathematical Sciences, Queen Mary & Westfield College,
Mile End Road, London E1 4NS, ENGLAND
-*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-
------------------------------
Date: Tue, 29 Sep 1998 13:15:09 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: Perl with use/require doesn't work under cron
Message-Id: <3610A51D.9619169@uic.nnov.ru>
bobmorgan@my-dejanews.com wrote:
>
> Hi,
>
> I have a perl script that that uses "use myPackage;". The script works fine
> from the command line (AIX 4.1.4). When I try and run the script as a cron
> job, the script never runs. I tested this by using some print statements to
> a file and they never show up when under cron but work fine when run from
> the command line.
>
> I changed my script to use "require" and that did not work either from cron.
> Again it worked fine from the command line.
>
> If I take out the "use" and "require" statements from the script - then it
> works fine from the command line and from cron.
>
> The packages that I am using are some of my own located in the same
> directory as the script.
>
> Any ideas ? Has anyone encountered this problem ?
>
> Thanks in advance.
>
> Bob Morgan
> bob.morgan@computer.org
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Try use:
push @INC,'path_to_your_dir_with_modules';
require 'mymodule.pl';
.....
Lesha.
------------------------------
Date: Tue, 29 Sep 1998 02:20:00 -0700
From: "Phinneas G. Stone" <phinneas@eskimo.com>
To: Zenin <zenin@bawdycaste.org>
Subject: Re: Poll: How Did You Learn Perl?
Message-Id: <3610A63F.D16273FD@eskimo.com>
I've noticed a few comments regarding Matt's scripts, and as a relative
newbie who has recently implemented Matt's guestbook for a customer, I wonder
if someone could clue me in as to how to fix this problem.
Zenin wrote:
> Bart Lateur <bart.mediamind@ping.be> wrote:
> : Nah. Most of the trouble with Matt's Scripts are related to making them
> : robust, for example he forgot most of the file locking.
>
> That and, well, the extra added feature that most web sites
> lack nowadays that I've always liked; Being able to open an
> xterm on the server from a guestbook form. I mean, when you make
> a typo in a guestbook entry it is really nice to be able to fix
> it yourself rather then bother the busy web master. :-)
------------------------------
Date: Tue, 29 Sep 1998 13:19:00 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: Question about Sendmail, Perl, and CGI
Message-Id: <3610A604.F90C2E86@uic.nnov.ru>
Patrick Hunter wrote:
>
> I've been trying to find some way to pull this off and I'm hoping that
> someone here has gotten it to work.
>
> I have a form on a website that I'm designing for a university group
> that hires students to help other students improve writing skills. There
>
> is an online application for interested students to sign up. Part of the
>
> application process is the submission of two writing samples. I wrote a
> CGI script in Perl 5 that calls sendmail and sends the submission to the
>
> responsible person. I would also like to be able to offer the ability
> for the student to submit their writing samples online as well, using
> the file upload feature of Netscape. I would then want the submitted
> files to be included as attachments when sendmail sends the data to the
> recipient. Does anybody know if this is possible? I know how to write
> the HTML for the form, however, I am unclear of the coding on the Perl
> side and sendmail attachments. Any help or advice would be appreciated.
> Public posting or private emails welcome.
>
> Patrick Hunter
> hunterp@xmission.com
On some Unix systems you can do:
$mailprog="mail"; #or sendmail
open MAIL,"|$mailprog you@host";
print MAIL "Hello here!";
print MAIL "Form submition ...";
.......
close MAIL;
Lesha.
------------------------------
Date: Tue, 29 Sep 1998 13:39:27 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: Quick question about perl
Message-Id: <3610AACF.83E58521@uic.nnov.ru>
Juan C. Paez wrote:
>
> Hi !
> I am not an expert, even a beginner in perl. However, I need
> to modify a script written in perl. I would
> like to know how get the date from script program
> in perl
> in order to write the date in a file.
> I will appreciate any help.
> Please answer to jpaezca@banrep.gov.co
>
> Thanks in advance,
> Juan
Use: $var=localtime;
Lesha.
------------------------------
Date: 29 Sep 1998 12:04:15 +0200
From: Michal Rutka <erhmiru@erh.ericsson.se>
Subject: Socet script problem.
Message-Id: <laww6ndylb.fsf@erh.ericsson.se>
Hello,
I have the following script:
use Socket;
use FileHandle;
$remote = shift @ARGV || 'erhs74';
$port = shift @ARGV || 13;
$iaddr = inet_aton($remote) or die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);
$porto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $porto) or die "socket: $!";
connect(SOCK, $paddr) or die "connect: $!";
select(SOCK); $| = 1; select(STDOUT);
while(<SOCK>){
print;
last unless /\S/;
}
close SOCK;
which prints date/time from the remote host. It works fine both under
UNIX and Windows. However only when Windows machine is on the LAN. When
I run this script at home (where I have Windows and dialup networking), it
dies on socket. What is annoying that it does not give any error message.
$! is empty. Does anybody know where a problem might be? All other programs
which I am using at home with Winsock are working fine.
Best regards,
Michal
------------------------------
Date: Tue, 29 Sep 1998 11:57:38 GMT
From: tfm@sei.cmu.edu (Ted Marz)
Subject: Re: Sockets and setsockopt with multicasting
Message-Id: <3610ca48.586068141@news>
Jonathan Nichols <jnichols@leland.stanford.edu> wrote:
>
>I can replicate every command in PERL except for line /* 3 */. The
>structure mreq is of type ip_mreq
>which is defined in in.h (On a DEC at least). How do I create a
>PERL object that contains the
>same information as mreq so I can pass it into PERL's setsockopt
>function? Every permutation
>I try gives me an ERRNO=22 (bad argument). So, I'm obviously not
>sending the right argument
>to PERL's setsockopt.
This is a GUESS, but I suppose that you could use pack() to create an
appropriate packed array with all the correct data in the correct
relative positions, and then pass the packed variable.
As I said, This is a GUESS. I haven't done it.
I have checked the ORA book, Perl cookbook, chapter 17. It seems that
this is what they are doing (pretty much).
Ted Marz
------------------------------
Date: Tue, 29 Sep 1998 13:10:40 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: system call treats vars as literals... (perl 5.005)
Message-Id: <3610A410.4952F507@uic.nnov.ru>
Paul Pazandak wrote:
>
> I am trying to simply call cat (win95) with three vars, but they are treated as literals...
> Why?
>
> E.g.
>
> system ( 'cat i:\foo.txt $_ ? $mytmpfile');
>
> Doing a print works:
> print $_ ;
> or
> print "Processing file: $_" ;
>
> so, why is the variable handled like a literal in the system call??????
> Were's this darn oddity documented in "Programming Perl"?
>
> Thanks SO much (in advance)!
>
> Paul.
> [please respond directly to me.]
>
> p.s.[I am using File::Find, and all I want to do is insert a few lines at the top of every
> file in a directory (including subdirs) -- the file traversing works, just not the insertion.]
Try this:
$tmp="cat i:\foo.txt $_ ..... ";
system($tmp);
Lesha.
------------------------------
Date: Tue, 29 Sep 1998 13:32:30 +0400
From: "Aleksey A. Pavlov" <paaa@uic.nnov.ru>
Subject: Re: System() help
Message-Id: <3610A92E.D8D3DF88@uic.nnov.ru>
Doyle Johnson wrote:
>
> I have read through the man and the FAQ and I find information on system()
> but I'm not 100% sure it will work for what I want.
>
> I need to call a server function and print what the server returns to a
> file or to an array....
>
> Can anyone give me the correct syntax for exicuting a server command and
> capturing the output?
>
> Thanks
>
> D. Johnson
try to use:
$string=`yourcommand`;
or
@arr=`yourcommand`;
Lesha.
------------------------------
Date: Tue, 29 Sep 1998 10:06:11 +0100
From: "meyrick" <meyricklouiseNOJUNK@btinternet.com>
Subject: URL & strings searches
Message-Id: <6uq8ks$f7f$1@mendelevium.btinternet.com>
I start by admitting I am a complete newbie as far as Perl is
concerned - apologies to all gurus :-)
Can anyone help with the following challenge?
I want a script that will:
1/ access defined URLs on the internet (say www.ft.com, www.wsj.com,etc)
2/ search all public pages on the root address (www.wsj.com) for strings
(say bonds or Greenspan) as defined at the programmes initiation.
3/ return the number of times the defined string occurs in the complete
site.
A script called WebPluck has been suggested to but on closer inspection does
not specifically return the string hit rate and also only searches defined
pages.
Any help would be very much appreciated.
Tks
Meyrick
------------------------------
Date: Tue, 29 Sep 1998 14:23:41 GMT
From: ovallari@tse.com (Oscar Vallarino)
Subject: Win32::OLE
Message-Id: <6uqejv$ql3$1@nntp3.uunet.ca>
Hi folks !
I am trying to write some Perl code to drive Excel97 through its
object interface on WinNT 4.0. I recorded a macro (listed below) to
identify the OLE automation calls required. However, I can't find
anywhere examples of how to translate VBA's statements with multiple
operands (eg, OpenText, SetSourceData) into Perl's references. I am
using ActiveState's Perlscript 5.00502.
Any help will be appreciated.
Oscar
--------------------------------------------------------------------------------------------------------------
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 9/28/98 by ovallari
'
'
Workbooks.OpenText FileName:="E:\P9901\results\T00211-00.TXT", _
Origin:= xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
1), Array(3, 1))
Range("A1:B12").Select
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
ActiveChart.SetSourceData
Source:=Sheets("T00211-00").Range("A1:B12"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "This is the tible"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"This is elapsed time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"This is transactions"
End With
End Sub
------------------------------
Date: Tue, 29 Sep 1998 14:26:01 GMT
From: ovallari@tse.com (Oscar Vallarino)
Subject: Win32::OLE
Message-Id: <6uqeo0$ql3$2@nntp3.uunet.ca>
Hi folks !
I am trying to write some Perl code to drive Excel97 through its
object interface on WinNT 4.0. I recorded a macro (listed below) to
identify the OLE automation calls required. However, I can't find
anywhere examples of how to translate VBA's statements with multiple
operands (eg, OpenText, SetSourceData) into Perl's references. I am
using ActiveState's Perlscript 5.00502.
Any help will be appreciated.
Oscar
email: ovallari@tse.com
--------------------------------------------------------------------------------------------------------------
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 9/28/98 by ovallari
'
'
Workbooks.OpenText FileName:="E:\P9901\results\T00211-00.TXT", _
Origin:= xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
1), Array(3, 1))
Range("A1:B12").Select
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
ActiveChart.SetSourceData
Source:=Sheets("T00211-00").Range("A1:B12"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "This is the tible"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"This is elapsed time"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = _
"This is transactions"
End With
End Sub
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3848
**************************************