[17566] in Perl-Users-Digest
Perl-Users Digest, Issue: 4986 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 29 09:05:39 2000
Date: Wed, 29 Nov 2000 06:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975506711-v9-i4986@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 29 Nov 2000 Volume: 9 Number: 4986
Today's topics:
adduser <Per-fredrik.Pollnow@epk.ericsson.se>
Re: affiliate program script in perl? (B Gannon)
Re: AOL email --> RFC822, stuck. <bart.lateur@skynet.be>
Re: AOL email --> RFC822, stuck. (Rafael Garcia-Suarez)
Re: AOL email --> RFC822, stuck. <bart.lateur@skynet.be>
Re: Authorising net access? <mtx064@coventry.ac.uk>
Re: Can anyone help me with this script??? (Anno Siegel)
for each file in dir ? <M.I.Planchant@ncl.ac.uk>
Re: for each file in dir ? <vesteraas@nospam.usa.nospam.net>
Re: for each file in dir ? (B Gannon)
Re: for each file in dir ? <krahnj@acm.org>
Formating file in Win-Perl bakha_ma@my-deja.com
Re: Formating file in Win-Perl <carvdawg@patriot.net>
Re: Getting Path variable from remote NT server <aolla@austintx.net>
Re: Getting Path variable from remote NT server <carvdawg@patriot.net>
how do i direct compiler errors to a file-newbie lightfoote@my-deja.com
Re: how do i direct compiler errors to a file-newbie <geoff-at-farmline-dot-com@127.0.0.1>
Re: how do i direct compiler errors to a file-newbie <bart.lateur@skynet.be>
Re: how do i direct compiler errors to a file-newbie <geoff-at-farmline-dot-com@127.0.0.1>
Re: how to browse directory in my system from remote sy <nickco3@yahoo.co.uk>
how to browse directory in my system from remote system epdass@my-deja.com
Re: How to find what is between n'th and the next tab? nobull@mail.com
lynx with PERL waseema@my-deja.com
Re: lynx with PERL <dickey@saltmine.radix.net>
Palm Doc converter? <prlawrence@lehigh.edu>
Re: Perl not executing from Cron job <paul@NOSPAM.multibase.com.au>
perl2exe <hmacdonald@europarl.eu.int>
Problems calling a second script under NT <steve_jinks@uk.ibm.com>
Re: running Perl program on NT and accessing a UNIX mac <carvdawg@patriot.net>
Re: Skipping lines in a file <mjcarman@home.com>
Socket-Programming: setsockopt(....) <schneider@hrz.uni-dortmund.de>
use of Net::Telnet <l.hagen@HumanInference.com>
Why? <johngros@Spam.bigpond.net.au>
Re: Why? <dave@dave.org.uk>
working with lists of associative arrays (jim crawford)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Nov 2000 14:34:59 +0100
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: adduser
Message-Id: <90305e$k5v$1@newstoo.ericsson.se>
Hi,
I'm doing a litel program, I'm a newbie @ perl, so please help me.
Ok this is what the program is going to do:
First the user run the program and enter all the information I need, thats
no problem..
The problem begins here: when I got all the information I whant to crate an
account with his name and a random password.
The name I now erlier from the program, I don't whant the user to enter the
password(the user gets an email with all the information and password later
in the program).
------------------------------
Date: 29 Nov 2000 09:02:52 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: Re: affiliate program script in perl?
Message-Id: <902gns$585$1@news.liv.ac.uk>
Try http://www.hotscripts.com
-----------------------------------
B Gannon
http://www.kopnews.com
http://www.kopnews.co.uk
Home of the LFC Prediciton League
-----------------------------------
------------------------------
Date: Wed, 29 Nov 2000 08:30:45 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: AOL email --> RFC822, stuck.
Message-Id: <3gf92tkc9nmklkuaekliijc39t6ias3e4e@4ax.com>
gjs.REMOVE@khalsa.com wrote:
>foreach $822 (@822) {
Are these actually legal Perl variable names, for general purpose
variables? I would be surprised.
@1 = 'A' .. 'E';
foreach $1 (@1) {
print $1;
}
-->
ABCDE
I'm surprised. Why doesn't Perl reject this?
--
Bart.
------------------------------
Date: Wed, 29 Nov 2000 08:56:57 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: AOL email --> RFC822, stuck.
Message-Id: <slrn929h86.ntb.rgarciasuarez@rafael.kazibao.net>
Bart Lateur wrote in comp.lang.perl.misc:
> gjs.REMOVE@khalsa.com wrote:
>
> >foreach $822 (@822) {
>
> Are these actually legal Perl variable names, for general purpose
> variables? I would be surprised.
>
> @1 = 'A' .. 'E';
> foreach $1 (@1) {
> print $1;
> }
> -->
> ABCDE
>
> I'm surprised. Why doesn't Perl reject this?
I don't why Perl should reject @1, it's not reserved.
$1 becomes a local() alias to the elements of @1 in the foreach loop,
then it looses its properties (immutability, set by regexp matching).
Here's an example:
"abc" =~ /(b)/; # set $1 to 'b'
print "$1\n";
@1=1..5;
for $1 (@1){
print $1;
$1 = 2; # Sets $1 (without a runtime error)
"abc" =~ /(c)/; # Does not set $1
};
print "\n";
for $1 (@1) {print $1};
print "\n";
print "$1\n";
Output :
b
12345
22222
b
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 29 Nov 2000 12:06:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: AOL email --> RFC822, stuck.
Message-Id: <p0s92tkmoniiiuvmpudr5namo66coa0rud@4ax.com>
Rafael Garcia-Suarez wrote:
>$1 becomes a local() alias to the elements of @1 in the foreach loop,
>then it looses its properties (immutability, set by regexp matching).
> @1=1..5;
$\ = "\n"; # every print() on a new line
> for $1 (@1){
> print $1;
> $1 = 2; # Sets $1 (without a runtime error)
> "abc" =~ /(c)/; # Does not set $1
print "match: $1";
> };
print "@1";
It sounds like a bad idea. And your regex example is a clear indication
of why it is a bad idea. Here's the output:
1
match: 2
2
match: 2
3
match: 2
4
match: 2
5
match: 2
2 2 2 2 2
--
Bart.
------------------------------
Date: Wed, 29 Nov 2000 09:57:08 +0000
From: Dominic Hibbs <mtx064@coventry.ac.uk>
Subject: Re: Authorising net access?
Message-Id: <Pine.OSF.3.91.1001129094103.14736D-100000@leofric>
On 28 Nov 2000 nobull@mail.com wrote:
> philhibbs@my-deja.com writes:
>
> > I believe that I need LWP:UserAgent and that it will allow authenticated
> > communication but I cannot find how to use this. The perldoc pages are
> > not very readable.
>
> Can you go into more detail on the difficulty you have reading the
> LWP::UserAgent perldoc? Simply saying "are not very readable" doesn't
> help anyone improve them.
>
> $ua->credentials($netloc, $realm, $uname, $pass)
> Set the user name and password to be used for a realm.
Quite possibly. I want to automatically get, and process the data in, some
pages which are username and password protected.
My program so far is
use strict;
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
my $netloc = "foo.net:80";
my $realm = "coventry.ac.uk";
my $uname = "d.hibbs";
my $pass = "D0m1n1c";
$ua->credentials($netloc,$realm,$uname,$pass);
# url to fetch:
my $url = "foo.net/dnacs/prot-doc/index.shtml";
my $request = HTTP::Request->new('GET',$url);
my $response = $ua->request($request);
my $page = $ua->content();
print $page;
The errors I get are
Use of uninitialized value at
/usr/opt/PERL5004/lib/perl5/site_perl/LWP/Protocol
.pm line 110.
Use of uninitialized value at
/usr/opt/PERL5004/lib/perl5/site_perl/LWP/Protocol
.pm line 85.
Can't locate auto/LWP/UserAgent/content.al in @INC (@INC contains:
/usr/opt/PERL
5004/lib/perl5/alpha-dec_osf/5.00404 /usr/opt/PERL5004/lib/perl5
/usr/opt/PERL50
04/lib/perl5/site_perl/alpha-dec_osf
/usr/opt/PERL5004/lib/perl5/site_perl .) at
./http2.prl line 22
-----------------------------------------------------
Dominic Hibbs (Senior Lecturer)
School of Maths and Information Sciences
Coventry University
Priory Street
Coventry
CV1 5FB
02476 631313 Ext 7063
-----------------------------------------------------
------------------------------
Date: 29 Nov 2000 13:04:04 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Can anyone help me with this script???
Message-Id: <902us4$jod$1@lublin.zrz.tu-berlin.de>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote in comp.lang.perl.misc:
>On Tue, 28 Nov 2000 15:07:31 -0000,
> Ross <patelro@viacode.com> wrote:
>> Hi All!
>>
>> I'm desperately hoping that their is some kind should out there that can
>> help me!!
>
>The documentation can help you. Learn to use it. Read it.
>
>> What I'm trying to create is a program that will use the /etc/dict (or other
>> wordfile) and pick random words from this file and insert them into a
>
>Perl FAQ, section 5, question 'How do I select a random line from a
>file?'.
>
>> textfile, replacing each instance of 'ZZZZ' with one of these random words.
>
>open the file, loop over the lines, use s/ZZZZ/$word/g to replace
>them.
This is probably not what the OP intended. I think he wants to replace
each occurrence of 'ZZZZ' with a different word. As there may be more
than one replacement per line, a nested loop will be necessary. If
@ranwords already contains a sufficient supply of words, this may
look like this:
while ( <DATA> ) {
while ( /ZZZZ|ZZZX/ ) {
my $word = shift @ranwords;
s/(ZZZZ|ZZZX)/$word/;
last if $1 eq 'ZZZX';
}
print;
}
Anno
------------------------------
Date: 29 Nov 2000 09:14:25 GMT
From: "M.I. Planchant" <M.I.Planchant@ncl.ac.uk>
Subject: for each file in dir ?
Message-Id: <902hdh$qvi$1@ucsnew1.ncl.ac.uk>
Im trying to write a script that works as below :
foreach file in a directory
cat file >> aNewFile
Each file in a specified directory is appended to a new file in turn.
Thanks for any help
------------------------------
Date: Wed, 29 Nov 2000 11:03:40 +0100
From: "Werner Vesterås" <vesteraas@nospam.usa.nospam.net>
Subject: Re: for each file in dir ?
Message-Id: <eu4V5.6159$5H3.167655@news1.oke.nextra.no>
> Im trying to write a script that works as below :
>
> foreach file in a directory
> cat file >> aNewFile
>
> Each file in a specified directory is appended to a new file in turn.
>
> Thanks for any help
The following code takes a directory as an argument. The contents of all
files in this directory will be glued together in a file named out.txt, in
the
current working directory. I'm quite sure your problem could be solved in a
more elegant way, but hey - I'm not a guru!
#!/usr/bin/perl -w
if ((-d $ARGV[0]) || die("Not a directory!")) {
open OUT, ">out.txt" || die("Can't open file!");
foreach (<$ARGV[0]/*>) {
if (-f) {
open IN, "<".$_ || die("Can't open file!");
while (<IN>) {
print OUT;
}
close IN;
}
}
close OUT;
}
Regards,
Werner Vesteraas <vesteraas@nospam.usa.nospam.net> (Remove nospam to get my
real address)
------------------------------
Date: 29 Nov 2000 10:24:18 GMT
From: admin@kopnews.co.uk (B Gannon)
Subject: Re: for each file in dir ?
Message-Id: <902lgi$779$1@news.liv.ac.uk>
Try
opendir (Web, "files/") ||die "nooooo";
foreach $name (sort readdir(Web)) {
if ($name == ".") {
}
else {
open(LOGFILE, ">$name.new");
print LOGFILE "\n";
close(LOGFILE);
}
}
closedir (Web);
-----------------------------------
B Gannon
http://www.kopnews.com
http://www.kopnews.co.uk
Home of the LFC Prediciton League
-----------------------------------
------------------------------
Date: Wed, 29 Nov 2000 10:22:59 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: for each file in dir ?
Message-Id: <3A24D95B.7FC4874F@acm.org>
"M.I. Planchant" wrote:
>
> Im trying to write a script that works as below :
>
> foreach file in a directory
> cat file >> aNewFile
>
> Each file in a specified directory is appended to a new file in turn.
opendir DIR, '/path/to/dir' or die "Cannot open directory /path/to/dir:
$!";
open OUT, '> aNewFile' or die "Cannot open aNewFile: $!";
binmode OUT;
my $file;
while ( defined( $file = readdir DIR ) ) {
next if $file eq '.' or $file eq '..';
open FILE, "< $file" or warn "Cannot open $file: $!";
binmode FILE;
my $data;
read FILE, $data, -s $file;
print OUT $data;
close FILE;
}
close OUT;
closedir DIR;
>
> Thanks for any help
Your welcome
John
------------------------------
Date: Wed, 29 Nov 2000 09:42:43 GMT
From: bakha_ma@my-deja.com
Subject: Formating file in Win-Perl
Message-Id: <902j2i$h66$1@nnrp1.deja.com>
Hello everyone!
I am new to Perl and have a question about writing to a file using Perl
for Windows. I have a script which writes user input from a web form
to the web server, but the formatting looks wrong. There are carriage
returns being added after each line.
Can anyone help?
Thanks,
Bakha
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 29 Nov 2000 06:45:21 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Formating file in Win-Perl
Message-Id: <3A24EC51.4DF95809@patriot.net>
Go into the CGI script and remove the extra "\n"
bakha_ma@my-deja.com wrote:
> Hello everyone!
> I am new to Perl and have a question about writing to a file using Perl
> for Windows. I have a script which writes user input from a web form
> to the web server, but the formatting looks wrong. There are carriage
> returns being added after each line.
>
> Can anyone help?
>
> Thanks,
> Bakha
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: Wed, 29 Nov 2000 08:14:53 GMT
From: "Aaron Olla" <aolla@austintx.net>
Subject: Re: Getting Path variable from remote NT server
Message-Id: <902e02$5m0$1@shaitan.golconda.net>
"David Riskind" <driskind@freemarkets.com> wrote in message
news:3a22e08c$0$154$3936f1fe@news-core.twtelecom.net...
> I need to locate the directory(ies) where specific files are located. The
> directories are always in the %PATH% variable.
> Is there a way that Perl can get the value of the %PATH% variable from a
> remote NT machine(assume we have trusted login to root of NT server)?
> Maybe a call in the WIN32 module?
I have had good success using rcmd.exe + remotecmd svc in scripts.
ex. C:\> rcmd \\server path
which, would obviously return the path for the user acct running the
service.
These utils are from the resource kit.
If you just care about the system path it should be pretty easy to read
from the registry remotely. I can provide a sample if desired. Accessing a
user's
path will be more of a challenge since the hive will not (probably) be
loaded.
-Aaron
------------------------------
Date: Wed, 29 Nov 2000 06:44:39 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: Getting Path variable from remote NT server
Message-Id: <3A24EC27.1A907CF9@patriot.net>
> If you just care about the system path it should be pretty easy to read
> from the registry remotely. I can provide a sample if desired. Accessing a
> user's
> path will be more of a challenge since the hive will not (probably) be
> loaded.
Accessing the user's path via the Registry isn't much of a problem, as long as
they are logged in at the time...just pull it from the HKEY_CURRENT_USER
hive rather than the HKEY_LOCAL_MACHINE hive...
------------------------------
Date: Wed, 29 Nov 2000 11:05:41 GMT
From: lightfoote@my-deja.com
Subject: how do i direct compiler errors to a file-newbie
Message-Id: <902nu2$kfd$1@nnrp1.deja.com>
hi perl family...
using perl 5.5 compiler... ah how do i get the
compiler errors messages to print to a file... currently they
run off the screen.... perldoc wasn't too helpful... also
how do you stop perldoc... what magic keys do you hit so I dont
keep getting more...
thanks ... foote...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 29 Nov 2000 11:22:13 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: Re: how do i direct compiler errors to a file-newbie
Message-Id: <902osg$3o0$1@soap.pipex.net>
<lightfoote@my-deja.com> wrote in message
news:902nu2$kfd$1@nnrp1.deja.com...
: hi perl family...
:
: using perl 5.5 compiler... ah how do i get the
: compiler errors messages to print to a file... currently they
: run off the screen.... perldoc wasn't too helpful... also
: how do you stop perldoc... what magic keys do you hit so I dont
: keep getting more...
Depends which shell you're using, but generally look in the shell
documentation for information on how to redirect stderr.
Geoff
------------------------------
Date: Wed, 29 Nov 2000 12:07:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how do i direct compiler errors to a file-newbie
Message-Id: <jcs92ts13damcgk8sp8muoujkva6hckark@4ax.com>
lightfoote@my-deja.com wrote:
>using perl 5.5 compiler... ah how do i get the
>compiler errors messages to print to a file... currently they
>run off the screen....
BEGIN {
open STDERR, ">errorlog.txt";
}
--
Bart.
------------------------------
Date: Wed, 29 Nov 2000 12:16:47 -0000
From: "Geoff Winkless" <geoff-at-farmline-dot-com@127.0.0.1>
Subject: Re: how do i direct compiler errors to a file-newbie
Message-Id: <902s2u$537$1@soap.pipex.net>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:jcs92ts13damcgk8sp8muoujkva6hckark@4ax.com...
: lightfoote@my-deja.com wrote:
:
: >using perl 5.5 compiler... ah how do i get the
: >compiler errors messages to print to a file... currently they
: >run off the screen....
:
: BEGIN {
: open STDERR, ">errorlog.txt";
: }
For the -compiler- error messages?
Geoff
------------------------------
Date: Wed, 29 Nov 2000 12:23:21 +0000
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: how to browse directory in my system from remote system using cgi/perl
Message-Id: <3A24F538.9ABACEF6@yahoo.co.uk>
epdass@my-deja.com wrote:
> Hi
>
> I am doing one cgi program using perl. In which I
> eagerly want to do one new function which is
> nothing but listing of my local directories and
> files .
>
> i.e., if I type www.xys.com/cgi-bin/test.pl it
> should ask for user input(which is local
> directory like c:\windows/temp)then when user
> press submit it should print all directories and
> files which is inside the c:\windows\temp
> directory.
>
> note: my program is hosted in remote server.what
> I mean is not listing of my remote directories
> and files. It is purely user machine directory.
Perl executes on the server, you can't use it to do anything on the
client. Why don't you ask those nice Javascript folks, they might be
able to help you.
------------------------------
Date: Wed, 29 Nov 2000 11:04:32 GMT
From: epdass@my-deja.com
Subject: how to browse directory in my system from remote system using cgi/perl
Message-Id: <902ns0$kdd$1@nnrp1.deja.com>
Hi
I am doing one cgi program using perl. In which I
eagerly want to do one new function which is
nothing but listing of my local directories and
files .
i.e., if I type www.xys.com/cgi-bin/test.pl it
should ask for user input(which is local
directory like c:\windows/temp)then when user
press submit it should print all directories and
files which is inside the c:\windows\temp
directory.
note: my program is hosted in remote server.what
I mean is not listing of my remote directories
and files. It is purely user machine directory.
I hope it can be done, because we can able to get
localtime and ofcourse we can able to read local
file while uploading thro' browser.
please help me out to do this
bye
epdass@rediffmail.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 29 Nov 2000 08:33:39 +0000
From: nobull@mail.com
Subject: Re: How to find what is between n'th and the next tab?
Message-Id: <u966l7p0fs.fsf@wcl-l.bham.ac.uk>
Bart Lateur <bart.lateur@skynet.be> writes:
> It needs to be compiled only once per column. So, if you want the 17th
> column of each record, you get one closure for this column, and call it
> for each line.
If you run the example in my earlier contibution to this thread where
I benchmark the split(), recompiled regex and precompiled regex
approaches you'll see that actually avoiding recompilation is probably
not justified in this case. (I didn't include the closure and /o case
because I'm running in 5.5).
I forgot to include the output last time so here it is again (slightly
modified):
#!/usr/bin/perl -w
use Benchmark;
use strict;
my $n = 50;
my $data = join "\t" => map "foo$_" => 0 .. 100;
my $piece;
my @regex_cache;
my %regex_cache;
timethese 10000 => {
split => sub {
$piece = (split /\s/, $data, $n+2)[$n];
},
match => sub {
($piece) = $data =~ /(?:\S*\s){$n}(\S+)/;
},
match_o => sub {
($piece) = $data =~ /(?:\S*\s){$n}(\S+)/o;
},
match_cache_h => sub {
($piece) = $data =~ ( $regex_cache{$n} ||= qr/(?:\S*\s){$n}(\S+)/ );
},
match_cache => sub {
($piece) = $data =~ ( $regex_cache[$n] ||= qr/(?:\S*\s){$n}(\S+)/ );
},
}
Benchmark: timing 10000 iterations of match, match_cache, match_cache_h, match_o, split...
match: 1 wallclock secs ( 1.08 usr + 0.00 sys = 1.08 CPU)
match_cache: 1 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU)
match_cache_h: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU)
match_o: 1 wallclock secs ( 1.01 usr + 0.00 sys = 1.01 CPU)
split: 3 wallclock secs ( 2.62 usr + 0.00 sys = 2.62 CPU)
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 29 Nov 2000 10:41:00 GMT
From: waseema@my-deja.com
Subject: lynx with PERL
Message-Id: <902mfs$jbi$1@nnrp1.deja.com>
Hi
I am accessing a page on the net using lynx, when i use lynx though
telnet i get the following message
www.xyz.com cookie: ASPSESSION=FFEFNAIAPADA Allow? (Y/N/Always/neVer)
Now when i run the command via a perl script using the follwoing
syntax :
-------------------------------------
print "Content-type: text/html\n\n";
$url = "http://www.xyz.com";
open (TEMP, "/usr/bin/lynx -source '$url'|") | | die "boom...";
while (<TEMP> ) {
print $_;
}
close (TEMP);
------------------------------------------
I get page cannot be displayed on the browser , which i dont really
mind my questions is that is there anyway i could grab that
ASPSESSION=FFEFNAIAPADA value using this script ?
My 2nd question is :
If i create an HTML form , and then want to submit it to
http://www.abc.com/login.asp it works ok , is there a way i can create
a form but rather that it being submitted via IE its submitted via
lynx ? i cant send any values via the url ,as the script on the other
side is configured to chuck an error if this happens
Sorry i think i am confusing everyone here , but i am need of some help
so go on answer my question
Waseem
------------------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 29 Nov 2000 13:27:17 GMT
From: Thomas Dickey <dickey@saltmine.radix.net>
Subject: Re: lynx with PERL
Message-Id: <90307l$8aq$1@news1.Radix.Net>
waseema@my-deja.com wrote:
> I get page cannot be displayed on the browser , which i dont really
perhaps a problem reading from the stdin (some configurations also need
a valid $TERM to be set). I'd check by running lynx with strace to see
where the failure occurred.
> mind my questions is that is there anyway i could grab that
> ASPSESSION=FFEFNAIAPADA value using this script ?
not easily: the message comes out in interactive mode, which has various
types of escape sequences sprinkled on it to place things on the screen.
The current version of lynx is 2.8.3
It's available at
http://lynx.browser.org
ftp://lynx.isc.org/lynx-2.8.3
2.8.4 Development & patches:
http://lynx.isc.org/current/index.html
--
Thomas E. Dickey <dickey@radix.net> <dickey@herndon4.his.com>
http://dickey.his.com
ftp://dickey.his.com
------------------------------
Date: Wed, 29 Nov 2000 08:14:10 -0500
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Palm Doc converter?
Message-Id: <902vf3$jgk@fidoii.CC.Lehigh.EDU>
Hello, I'm looking for anyone who has implemented a text to palm doc converter
with Perl. If there's a module on CPAN I missed it in my search...
Thanks,
Phil
------------------------------
Date: Wed, 29 Nov 2000 18:54:43 +1000
From: "Paul Mulloni" <paul@NOSPAM.multibase.com.au>
Subject: Re: Perl not executing from Cron job
Message-Id: <3a24c44b@grissom>
You are absolutely right. No environment variable specific to that user
when running the cron job. You suggestion sounds interesting and will give
it a go.
Thanks again.
Paul.
Douglas Apperley <douglas@apperley.com> wrote in message
news:3A234E45.D0D8249D@apperley.com...
> Hey Paul:
>
> I have run across this exact problem in HP UNIX and it killed me for a
week.
> I solved my problem by executing a shell script that ran the .profile of
the
> user
> that runs the program at the command line just fine. You need to have
PATHS
> SET and whatever else is in the .profile of the user that can run at the
command
> line
> just fine. When you call a program from CRONTAB there is NO environment
> set up at all (that I can see). Try calling something like this (in
Cron):
>
> 00 07 * * * /usr/joeblow/run_it.sc
>
> The shell script run_it.sc should look something like this:
>
> cd /usr/joeblow
> ./.profile
> cd /your_run_dir
> ./you_perl_program
>
> Good-Luck
> Douglas Apperley
>
> Paul Mulloni wrote:
>
> > Hello all,
> > System:
> > Red hat 6.1
> > Perl 5.005_03
> >
> > The perl script will execute from the command line but when the perl
scripts
> > is run from a cron job it does not work. It looks like it wants to run
the
> > script file using the /usr/sh shell instead of the perl shell even
though
> > the "#!/usr/bin/perl" line is set. I have found that a SHELL environment
> > variable can be set within the cron job so setting it to
"/usr/bin/perl"
> > has the perl script working to a certain extent. When this is set then
the
> > perl script is executed as if the -c option is set so it does not
actually
> > execute the script only compiles it!!!
> >
> > Not sure why this is happening??
> >
> > Paul.
>
------------------------------
Date: Wed, 29 Nov 2000 12:32:12 +0100
From: harry macdonald <hmacdonald@europarl.eu.int>
Subject: perl2exe
Message-Id: <3A24E93C.677E9330@europarl.eu.int>
Where can I find a perl2exe for Perl5.6 on NT
Or has the method of doing this changed ?
thanks for any info
------------------------------
Date: Wed, 29 Nov 2000 09:47:50 +0000
From: Steve Jinks <steve_jinks@uk.ibm.com>
Subject: Problems calling a second script under NT
Message-Id: <3A24D0C6.29C2659@uk.ibm.com>
Hi,
The following problem is driving me insane, this is my last hope before
I choose a completely different approach.
Environment: Active Perl v5.0, NT server, Apache server.
I am trying to execute a second perl script from within an executing CGI
script. The problem is that no matter how I try executing the second
script (system(), `xxx` or Win32::process) it can not see anything on
STDIN or STDOUT.
Is there a another method for executing a second script ?
What happens to the NT environment during CGI execution ?
Any help would be appreciated.
Regards,
Steve.
------------------------------
Date: Wed, 29 Nov 2000 06:42:35 -0500
From: H C <carvdawg@patriot.net>
Subject: Re: running Perl program on NT and accessing a UNIX machine
Message-Id: <3A24EBAB.E1CD4FF0@patriot.net>
Maybe I'm making this simpler than it needs to be, but why not use
Net::Telnet? I use it
all the time to log into my ISP...
> > Is it possible to run a Perl program on a Windows NT machine, that logs
> > on
> > to a remote UNIX machine? On that machine the Perl program should
> > execute some
> > commands and when this is finished, it should disconnect from the UNIX
> > machine and execute some commannds on the Win NT machine (from where it
> > is running). After that the Perl program can be terminated.
------------------------------
Date: Tue, 28 Nov 2000 14:07:09 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Skipping lines in a file
Message-Id: <3A24106D.3B4D08D9@home.com>
"J. Stone" wrote:
>
> What is the most graceful way to skip a number of lines in a file?
> Here is a code sample that shows how I currently accomplish this:
>
> while (<INFILE>){
> chop;
Use chomp() here instead of chop() -- it will only remove the last char
if it matches $/. chop() will eat the last character no matter what.
> if (m/PORTFOLIO TOTALS:/){
> $line = <INFILE>;
> $line = <INFILE>;
> $line = <INFILE>;
> .
> .
> .
Close; just a little ugly. No need for the variable there, and I'd put
the reads inside a loop for brevity's sake:
if (m/PORTFOLIO TOTALS:/) {
# Replace N with the number of lines to skip
for (1 .. N) {
<INFILE>;
}
}
Basically, if you're processing a file line-by-line, you need to do N
scalar reads to skip N lines. If you've slurped it all into an array,
you can just increment your index by N.
-mjc
------------------------------
Date: Wed, 29 Nov 2000 09:07:31 +0100
From: Christian Schneider <schneider@hrz.uni-dortmund.de>
Subject: Socket-Programming: setsockopt(....)
Message-Id: <3A24B943.E8F2ADF2@hrz.uni-dortmund.de>
Hello folks,
please could anybody help me with the following problem:
I want to write a ip-multicast application in perl.
Therefore I have to perform a setsockopt()-operation, like
the one here, given in C-sourcecode:
#define TEST_ADDR "234.5.6.7"
struct ip_mreq stMreq;
<...some more lines for opening the socket....>
stMreq.imr_multiaddr.s_addr=inet_addr(TEST_ADDR);
stMreq.imr_interface.s_addr=INADDR_ANY;
setsockopt(socketname,
IPPROTO_IP,
IP_ADD_MEMBERSHIP,
(char*)&stMreq,
sizeof(stMreq));
The problem is, that I couldn't find information about the OPTVAL
parameter. How is it built to conform with the function-call ???
For a simple operation I found the following perl-code:
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))
Here the OPTVAL parameter is built with the help of the pack-function,
but I think that this won't work for the more complex struct given in
the C-sourcecode.....
Any kind of helpful comment is welcome!
Thank you very much
Christian
------------------------------
Date: Wed, 29 Nov 2000 13:19:01 +0100
From: Lex Hagen <l.hagen@HumanInference.com>
Subject: use of Net::Telnet
Message-Id: <04932F2B7E20D211856C00A0C9A060952B1CD3@mail.humaninference.com>
Hi,
I'm really new to Perl. And have to use the Net::Telnet module, but
don't really know how. Maybe someone can send me a short example on how
to use the Net::Telnet module. (e.g. a piece of code that connects to a
remote machine, loggs in, etc.)
I'm going to run the program on a NT-machine and connect to a remote
UNIX-machine.
I would really, really appreciate it!
Thanks in advance,
Lex
------------------------------
Date: Wed, 29 Nov 2000 12:29:07 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Why?
Message-Id: <nE6V5.10803$GW5.68887@news-server.bigpond.net.au>
The following script wiped the contents of the file.
I don't know why, as I understand it the print statement should go to
<STDOUT> not <BOGUS>.
#!E:/Millenium Programs/perl/bin/Perl -w
$path = "C:/Program Files/G6FTP/";
$file = $path."Users.ini";
open BOGUS,"$file";
while ( defined( $line = <BOGUS> ) )
{
print $line;
}
------------------------------
Date: Wed, 29 Nov 2000 13:25:03 -0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: Why?
Message-Id: <90306t$iuj$1@taliesin.netcom.net.uk>
John Boy Walton <johngros@Spam.bigpond.net.au> wrote in message
news:nE6V5.10803$GW5.68887@news-server.bigpond.net.au...
> The following script wiped the contents of the file.
> I don't know why, as I understand it the print statement should go to
> <STDOUT> not <BOGUS>.
>
> #!E:/Millenium Programs/perl/bin/Perl -w
> $path = "C:/Program Files/G6FTP/";
> $file = $path."Users.ini";
> open BOGUS,"$file";
> while ( defined( $line = <BOGUS> ) )
> {
> print $line;
> }
You're getting your input from BOGUS, but your output is still going to the
default filehandle (i.e. STDOUT).
You need to
a) open the file for writing.
b) print to a different filehandle.
c) beware that reading and writing the same file simultaneously will
probably lead to badness.
hth,
Dave....
--
<plug>Data Munging with Perl http://www.manning.com/cross/</plug>
------------------------------
Date: Wed, 29 Nov 2000 12:04:19 GMT
From: pfister_@mindspring.com (jim crawford)
Subject: working with lists of associative arrays
Message-Id: <3a24ee40.30007372@news.mindspring.com>
I'm having problems working with a list of associative arrays.
I have a loop that fills the list like so:
$n=0;
while(<>)
{ chomp;
if($_ eq "-") { $n++; next; }
($var, @val)=split(/=/);
$data[$n]{$var}="@val";
}
I have functions that work with this list, but I tired of typing out
$data[$_[0]]{"fieldname"} to access the data, and tried to create a
temporary variable as a shortcut:
$x=$data[$_[0]];
Now... the intention is for the right side of this assignment to
evaluate to a hash... but perl doesn't like
%x=%data[$_[0]];
because I "can't use subscript on associative array dereference".
This gives me the impression that in, this expression, %data
represents a hash named data. As in (%data)[$_[0]]. Like % is an
operator that binds more closely than [].
Clearly the expression $data[$_[0]]{"fieldname"} isn't indexing into
the scalar "$data", given that it works.
This gives me the impression that I really have only the vaguest idea
what the variable prefixes represent and how they affect the code.
I've probably gotten this far on sheer luck and some overly-friendly
DWIM on the part of the interpreter.
I've done some research, and I haven't been able to find a good
explanation anywhere of what's actually going on. I'm afraid to look
at the perl source.
Another tangible problem, possibly related for all I know, is that
this doesn't work:
sub sortentries #($field)
{ @data=sort { $a{$_[0]} cmp $b{$_[0]} } @data;
}
while this does:
sub sortentries #($field)
{ @data=sort { deref($a, $_[0]) cmp deref($b, $_[0]) } @data;
}
sub deref #(%hash, $index)
{ return $_[0]{$_[1]};
}
I'm completely at a loss as to why.
Please, enlighten me!
--
Jim Crawford
http://www.mindspring.com/~pfister_
------------------------------
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 4986
**************************************