[10113] in Perl-Users-Digest
Perl-Users Digest, Issue: 3706 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 13 23:07:22 1998
Date: Sun, 13 Sep 98 20:00:23 -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 Sun, 13 Sep 1998 Volume: 8 Number: 3706
Today's topics:
Re: kto movet.......... pomagite povalujsta! (Martien Verbruggen)
Re: [Q] How modify file? (Martien Verbruggen)
a very simple question <STEVENHENDERSON@prodigy.net>
can I make inverted index of big text files? (Ralph Brands)
dan@fearsome.net <dan@fearsome.net>
Re: dan@fearsome.net <dan@fearsome.net>
Re: expression in a variable problem (Jasmin F. Patry)
Re: grep difficulties (Martien Verbruggen)
Re: grep difficulties (Jonathan Stowe)
Re: grep difficulties (Jasmin F. Patry)
Re: Help with file test operators (Mark-Jason Dominus)
Re: History of Perl - round 1 <eashton@bbnplanet.com>
Re: Incrementing a Multi-dimensional Hash Array (Martien Verbruggen)
Max. Length of an Array <niting@raleigh.ibm.com>
Memory considerations with PERL <niting@raleigh.ibm.com>
Re: Memory considerations with PERL <uri@sysarch.com>
Re: Memory considerations with PERL (Martien Verbruggen)
Re: multiple patern matches (Alan Barclay)
Re: passing an argument. (Martien Verbruggen)
Re: Perl & Java - differences and uses <metcher@spider.herston.uq.edu.au>
Re: problem with strict refs while using GIFgraph (Martien Verbruggen)
Re: Question about the URI::URL module (Alan Barclay)
Re: read a file through HTTP (Jonathan Stowe)
Registration Script <tonya@jacksonville.crosswinds.net>
Re: Registration Script (Martien Verbruggen)
Re: Registration Script <tonya@jacksonville.crosswinds.net>
Re: Registration Script (Martien Verbruggen)
Re: Seeking Perl program to transfer files between mach (Jeremy Mathers)
Strange ! inserted in sendmail results <- HELP!!! <feedback@websummary.com>
this is a very stupid question.... <STEVENHENDERSON@prodigy.net>
Re: this is a very stupid question.... (Larry Rosler)
Re: Using File::Find under -T switch (Jonathan Stowe)
using loadable modules... (GEMINI)
Re: using loadable modules... (Larry Rosler)
Re: what good is flock $LOCK_NB? (Matthew Bafford)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Sep 1998 00:05:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: kto movet.......... pomagite povalujsta!
Message-Id: <N4ZK1.15$0u4.128914@nsw.nnrp.telstra.net>
In article <6tfhf4$9av$27@dragon.infopro.spb.su>,
"Andrew" <andrewy@windoms.sitek.net> writes:
> kAK MOVNO NA LOKALXNOJ MA[INE (DOMA) PROWERITX FAJLY CGI, PL.
> Perl U MENQ USTANOWLEN. a ^TO DALX[E???
yes. i think..
> pI[ITE NA E-Mail: andrewy@chat.ru
> bUDU O^ENX BLAGODAREN!
I don't think so.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 00:18:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: [Q] How modify file?
Message-Id: <chZK1.18$0u4.128914@nsw.nnrp.telstra.net>
In article <6tgpps$5un$2@news.kornet.nm.kr>,
Park <okcivil@soback.kornet.nm.kr> writes:
> I found answer myself.
>
> open (FILE, "+<data.dat");
> seek ...
> syswrite ...
> close ...
We definitely need more of these posters. Post a question, then post a
followup quoting your full first post, to change a few things, then
post a followup to that, quoting everything again, telling the world
that it's solved, probably by finally reading the documentation. No
work needed from us, except go through the garbage and delete it.
Great.
Now if we could only convince these posters to read the documentation
_before_ posting.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: Sun, 13 Sep 1998 18:48:50 -0700
From: "steven t henderson" <STEVENHENDERSON@prodigy.net>
Subject: a very simple question
Message-Id: <6thsut$gc34$1@newssvr04-int.news.prodigy.com>
greetings all, i appologize if this is a duplicate post,
my connection timed out and have no idea if my original
request made it.
anyway, its pretty simple, i a trying to load (or 'Jump To')
another local HTML page depending on CGI logic stored in a
perl program.
abstracted, i would like to run the following program and
have the local.htm file displayed in the browser, however
i can only seem to get "Location ..." printed on the first
line of STDOUT.
how can i tell the browser not to display the data, but rather
load the page i have pointed to?
>> #!/usr/bin/perl
>> print "Location: /local.htm\n\n";
>> 1;
thanks, and oh yeah; i am runing Win98, IE4 and Perl 5, build 110.
------------------------------
Date: 14 Sep 1998 02:48:46 GMT
From: brinton@unixg.ubc.ca (Ralph Brands)
Subject: can I make inverted index of big text files?
Message-Id: <brinton-1309971940190001@p063.intchg2.net.ubc.ca>
#!/usr/local/bin/perl
require 5.001;
use DB_File;
# create a new index
unlink("C:Desktop Folder:perl mod:search_index.db.new");
dbmopen(%db, "C:Desktop Folder:perl mod:search_index.db.new", 0644);
# find all HTML files
open (INFILEINPUT, "C:Desktop Folder:perl mod:infilelist.txt") || die
"Cannot find input file. Quit and
startover.\n";
@filename=<INFILEINPUT>;
$fileno = 0;
# my $filename;
#while(defined($filename = <FILES>)) {
foreach $filename (@filename) {
print "indexing $filename\n";
chop $filename;
# read file's contents into $html
open(HTML, "$filename") || die "Cannot find html file. Quit and
startover.\n";
#CHANGE
@html = <HTML>;
$html = join(" ", @html);
# store a link to the file
$db{--$fileno} = "$filename";
# extract the words from the HTML
$html =~ s/<[^>]+>//g;
$html =~ tr/A-Z/a-z/;
@words = ($html =~ /\w+/g);
# add this page to the inverted index
$last = "";
for (sort @words) {
next if($_ eq $last);
$last = $_;
$db{$_} = defined $db{$_} ? $db{$_}.$fileno : $fileno;
}
}
# close the new index and replace any existing index
untie %db;
unlink("C:Desktop Folder:perl mod:search_index.db");
rename("C:Desktop Folder:perl mod:search_index.db.new","C:Desktop
Folder:perl mod:search_index.db");
unlink("C:Desktop Folder:perl mod:search_index.db.new");
&MacPerl'SetFileInfo("R*ch", "TEXT", "C:Desktop Folder:perl
mod:search_index.db");
------------------------------
Date: Mon, 14 Sep 1998 01:35:26 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: dan@fearsome.net
Message-Id: <905733257.28644.0.nnrp-10.c2deb1c5@news.demon.co.uk>
test to daniel
------------------------------
Date: Mon, 14 Sep 1998 02:11:41 +0100
From: "Daniel Adams" <dan@fearsome.net>
Subject: Re: dan@fearsome.net
Message-Id: <905735432.8578.0.nnrp-09.c2deb1c5@news.demon.co.uk>
Apologies. My younger brother was messing around on my computer. :-[
Sorry,
--
Dan Adams
dan@fearsome.net
Daniel Adams wrote in message
<905733257.28644.0.nnrp-10.c2deb1c5@news.demon.co.uk>...
>test to daniel
>
>
------------------------------
Date: Sun, 13 Sep 1998 22:58:35 GMT
From: jfpatry@undergrad.math.uwaterloo.ca (Jasmin F. Patry)
Subject: Re: expression in a variable problem
Message-Id: <Ez8vto.ALs@undergrad.math.uwaterloo.ca>
Margaret Robbins <margaretrobbins@compuserve.com > wrote:
>if ($line =~ /test1|test2/)
>{
> print(STDERR "match\n");
>}
>
>matches, but
>
>$pat = "/test1|test2/";
>if ($line =~ $pat)
>{
> print(STDERR "match\n");
>}
>
>never does.
Omit the delimiters in $pat, and your code will work:
$pat = "test1|test2";
if ($line =~ $pat)
{
print(STDERR "match\n");
}
>From Chapter 2 of the Camel Book (Binding Operators):
If the right argument is an expression rather than a search pattern,
substitution, or translation, it is interpreted as a search pattern at
run-time. That is, $_ =~ $pat is equivalent to $_ =~ /$pat/.
Also, if the match will be repeated often, and $pat won't change in between
executions of that pattern match, then it is more efficient to write:
if ($line =~ /$pat/o) { ... }
because the /o modifier tells Perl to compile the pattern once, rather than
every time the expression is evaluated.
HTH,
Jasmin Patry
------------------------------
Date: Mon, 14 Sep 1998 00:21:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: grep difficulties
Message-Id: <HkZK1.19$0u4.128914@nsw.nnrp.telstra.net>
In article <35FC2CD7.B9FD6C5@igg-tx.net>,
Jeff Hunter <jhunter@igg-tx.net> writes:
> Can someone explain why this doesn't work:
>
> #!/usr/bin/perl
>
> $host=`uname -n`;
> $uic=`grep "$host" /path/to/somefile.txt`;
It will work. As long as your somefile.txt contains your hostname followed
by a newline. If it doesn't you might want to read
# perldoc -f chomp
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd. | am.
NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 00:56:05 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: grep difficulties
Message-Id: <35fc6385.851557@news.btinternet.com>
On Sun, 13 Sep 1998 15:36:39 -0500, Jeff Hunter wrote :
>Can someone explain why this doesn't work:
>
>#!/usr/bin/perl
>
>$host=`uname -n`;
>$uic=`grep "$host" /path/to/somefile.txt`;
>print "$uic \n";
>
>
Off the top of my head:
$host = `uname -n`;
chomp($host);
open(SOMEFILE,"/path/to/somefile.txt") || die "etc - $!\n";
@uic = grep /$host/,<SOMEFILE>;
print @uic,"\n";
close SOMEFILE;
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 13 Sep 1998 23:17:45 GMT
From: jfpatry@undergrad.math.uwaterloo.ca (Jasmin F. Patry)
Subject: Re: grep difficulties
Message-Id: <Ez8wpL.M01@undergrad.math.uwaterloo.ca>
Jeff Hunter <jhunter@igg-tx.net> wrote:
>#!/usr/bin/perl
>
>$host=`uname -n`;
>$uic=`grep "$host" /path/to/somefile.txt`;
>print "$uic \n";
>
>I get the host variable, but the the grep doesn't work.
There is a newline character at the end of the string in $host, because it is
included in the output of uname. You'll need to get rid of this newline
character for the grep to work the way you want:
chomp($host = `uname -n`);
(See perldoc -f chomp.)
HTH,
Jasmin Patry
------------------------------
Date: 13 Sep 1998 20:44:25 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Help with file test operators
Message-Id: <6thot9$evg$1@monet.op.net>
In article <slrn6vo6el.66u.bspring@j51.com>,
Brian Springstead <bspring@j51.com> wrote:
>Shouldn't it be NOT zero length?!?!
>open(OUT,">$fileout") || die;
>print OUT "This file is now not empty\n";
>stat($fileout);
For efficiency, Perl (like most programs) doesn't write directly to
the disk. Instead, it saves the data in a region of memory called a
`buffer', and then later, when the buffer is full of data, it is all
written at once. This is more efficient than asking the operating
system to write data every time.
You wrote the data, but it's still in the buffer when you `stat'.
One way to solve the problem: close the file after writing; this
flushes out the buffer.
Another way to solve the problem: After opening OUT, do
{ my $ofh = select OUT;
$| = 1;
select $ofh;
}
Setting $| to 1 makes OUT `hot', which means that the buffer is
flushed every time you write to OUT, so that data goes into the file
immediately.
------------------------------
Date: Sun, 13 Sep 1998 23:46:00 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: History of Perl - round 1
Message-Id: <35FC56D7.704B5148@bbnplanet.com>
> Until this point, Elaine, at least you were taking the high ground in
> this thread with regards to composition (and capitalization, puncuation,
> et al.). Now you've probably alienated everyone who was still
> interested in helping you. The first real suggestion you got in the
> newsgroup, and you responded by sinking to the same low level of
> attacking people's writing skills. :-(
Well, this may be true, but I highly doubt it. This is Usenet, it was
5am while I was dealing with a server during a maintainence window. I
was cranky and I seriously think the person was smoking something.
Nothing personal, just a perception. Whatever.
e.
------------------------------
Date: Sun, 13 Sep 1998 23:56:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Incrementing a Multi-dimensional Hash Array
Message-Id: <3ZYK1.12$0u4.128914@nsw.nnrp.telstra.net>
In article <35F983AE.657E@mgic.com>,
Kevin Skelton <kevin_skelton@mgic.com> writes:
> While (<FILE>) {
> ($userid,$reportid) = split(/,/);
> $total{$userid}++;
> }
[snip]
> $total{$userid}{$report}++;
> does not work.
Not even if you use $reportid, instead of $report?
Maybe you should consider starting to run perl with the -w flag, and
maybe program with use strict. Things like this are much less likely
to happen then.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: Sun, 13 Sep 1998 17:16:07 -0700
From: "Nitin Gupta" <niting@raleigh.ibm.com>
Subject: Max. Length of an Array
Message-Id: <6thn52$lim$1@ausnews.austin.ibm.com>
Is there a maximum (upper limit) to the number of items an array can
hold? Is this dependent on the systems available memory?
------------------------------
Date: Sun, 13 Sep 1998 18:07:47 -0700
From: "Nitin Gupta" <niting@raleigh.ibm.com>
Subject: Memory considerations with PERL
Message-Id: <6thq5t$ipc$1@ausnews.austin.ibm.com>
Does PERL return all the memory (real) it takes up during execution once
the script has ended? I have a script which creates arrays with a large
number of elements (running into hundreds and possibly thousands) and I
wanted to know whether I need to do some kind of "garbage collection" at
the end of the script so that all the memory is freed up.
------------------------------
Date: 13 Sep 1998 22:37:39 -0400
From: Uri Guttman <uri@sysarch.com>
To: "Nitin Gupta" <niting@raleigh.ibm.com>
Subject: Re: Memory considerations with PERL
Message-Id: <x7vhmrxvv0.fsf@sysarch.com>
>>>>> "NG" == Nitin Gupta <niting@raleigh.ibm.com> writes:
NG> Does PERL return all the memory (real) it takes up during
NG> execution once the script has ended? I have a script which creates
NG> arrays with a large number of elements (running into hundreds and
NG> possibly thousands) and I wanted to know whether I need to do some
NG> kind of "garbage collection" at the end of the script so that all
NG> the memory is freed up.
do you mean after the process itself exits? if so all that is reclaimed
by the OS and perl has nothing to do with it. if you mean in the
process, all that memory is permanently allocated to it. it may be
reclaimed by perl but it can never be given back to the system until it
exits.
and this is from an IBM employee :-)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Mon, 14 Sep 1998 02:43:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Memory considerations with PERL
Message-Id: <yp%K1.374$Qx4.12182@nsw.nnrp.telstra.net>
In article <6thq5t$ipc$1@ausnews.austin.ibm.com>,
"Nitin Gupta" <niting@raleigh.ibm.com> writes:
> Does PERL return all the memory (real) it takes up during execution once
It's perl if you talk about the program, Perl if you talk about the
language. There really isn't anything called PERL that we'd be
discussing here.
> the script has ended? I have a script which creates arrays with a large
That is up to the operating system. Not to perl.
> number of elements (running into hundreds and possibly thousands) and I
> wanted to know whether I need to do some kind of "garbage collection" at
> the end of the script so that all the memory is freed up.
Perl does garbage collection. But that only, on most operating
systems, frees up the memory for re-use within the same program. What
happens when the program exits, in this case when perl exits, is up to
the OS.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: 14 Sep 1998 01:08:21 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: multiple patern matches
Message-Id: <905735299.889211@elaine.drink.com>
In article <FadK1.57$VG5.648652@news2.voicenet.com>,
Matt Knecht <hex@voicenet.com> wrote:
>Steve . <syarbrou@ais.net> wrote:
>I have a feeling this is going to become a common saying here, but, The
>_Perl_Cookbook_ has a great regex in it to match a valid IP address.
>Unfotunately, it is about 200 bytes (guessing) long. I highly recommend
>it.
I really don't like using regexes for matching ip addresses. It seems
to me to be more of a problem for split, something like this:
#!/usr/local/bin/perl -w
@nibs = grep { ! /\D/ &&
$_+0 < 255 &&
$_+0 >= 0 } split(/\./,"199.246.75.5");
print "Valid ip\n" if(@nibs == 4);
will work on the common ddd.ddd.ddd.ddd format, and an extension of this
with more tests would get the less commmon formats like 0xc7.246.75.0x5
------------------------------
Date: Mon, 14 Sep 1998 00:03:29 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: passing an argument.
Message-Id: <l3ZK1.14$0u4.128914@nsw.nnrp.telstra.net>
In article <6tc7lv$tqi$1@nnrp1.dejanews.com>,
nguyen.van@imvi.bls.com writes:
> chomp($DATE = <STDIN>);
> $DATE = shift;
Euhm, What is the purpose of these two lines? Have you read up on
shift to see what it does?
# perldoc -f shift
[snip]
If ARRAY is omitted, shifts the @ARGV array in the main program, and
the @_ array in subroutines.
[snip]
So... You read a line from STDIN, store the result in $DATE, and then
you proceed to overwrite that with whatever is in @ARGV (or @_). If
that is really what you want, then ignore this post.
> `browser_crno.ksh $DATE > $DOCS_DIR/browser_crno.html`;
>
> Note: I used backstick b/c I want a output.
Which you then neatly ignore. If you want the output, you should
capture it in an array or scalar.
# perldoc -f system
# perldoc perlop
/qx
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 12:22:06 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Perl & Java - differences and uses
Message-Id: <35FC7DCE.B013EC22@spider.herston.uq.edu.au>
George Reese wrote:
>
>snip<
> The point was that a computer should be able to understand our natural
> language and that somehow or another we should be forced to express
> our desires in natural language that everyone else can make sense of.
>
>snip<
George, your logic has been admirable so far, but this is a real
clanger. Why one earth would you suppose that the majority of problem
domains can even be described in natural language? There's nothing
natural about most of computer science. Using natural language for many
problems is like applying common sense to quantum physics. There's
little that's natural or common, in the sense of human experience, about
it.
--
Jaime Metcher
------------------------------
Date: Mon, 14 Sep 1998 00:14:24 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: problem with strict refs while using GIFgraph
Message-Id: <AdZK1.16$0u4.128914@nsw.nnrp.telstra.net>
In article <ipjiuiuxtu6.fsf@gsun208.pfizer.com>,
lysikb@gsun208.pfizer.com (Bruce Z. Lysik) writes:
> Howdy folks. While attempting to use GIFgraph to make a neat little
> chart, I've run into a problem with strict references: basically I
> can't make my refs strict enough to satisfy the compiler.
You don't have any references at all in the following code, while
GIFgraph most definitely expects a few.
> use GIFgraph::bars;
>
> open( FILE, "dfdata.log" );
>
> my(@data);
>
> chomp ( @data = <FILE> );
GIFgraph's documentation states quite clearly that the @data array
that you pass to the plot functions should be an array of references
to arrays. The 1st element (index 0) should be a reference to an array
of X values. The other ones should be the y values of each data set.
What you offer it here is a bunch of lines straight from your data
file. That just won't work. You will need to write a little function
that does the parsing of those lines, and store it in the required
structure. Perl will not magically be able to convert a string to an
array reference.
> The data file is kinda messy, so I'll leave it out. Basically
> it's a 3 line file. The first line contains the strings for the X
> axis. The next two lines are the two sets of data.
That's an odd way of storing your data, but ok: In this case something
like
while(<FILE>)
{
chomp;
my @f = split; # Assuming split on whitespace
push(@data, [@f]); # push a reference to a copy of @f on to @data
# push(@data, \@f); # This will probably also work.
}
I haven't tested the above, so you might need to tweak it a bit.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I think there is a world market for
Commercial Dynamics Pty. Ltd. | maybe five computers. --Thomas Watson,
NSW, Australia | chairman IBM, 1943
------------------------------
Date: 14 Sep 1998 00:55:06 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Question about the URI::URL module
Message-Id: <905734504.372266@elaine.drink.com>
In article <6thgum$nfs$1@ausnews.austin.ibm.com>,
Nitin Gupta <niting@raleigh.ibm.com> wrote:
>I am trying to convert relative url's to absolute one's and am using the
>URI::URL::abs() method for this. I have run into a wall trying to figure out
>that why, when my base url does not have a trailing slash ('/'), all the
>absolute referencing just goes haywire and works perfectly when I supply the
>trailing slash!!
>
>Let's say I have a page http://myserver.com/pages (note that this is a
>directory and the server will automatically supply the default (index.html)
>page) and this file has links to file_a.html and file_b.html
How do you expect perl to know this?
The behaviour you're describing is exactly what I'd expect. Without the
trailing /, the module has to presume that the item you've referenced
is a file, and that links within it are relative to the document root
in the example above.
------------------------------
Date: Mon, 14 Sep 1998 00:56:09 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: read a file through HTTP
Message-Id: <35fc67bb.1929130@news.btinternet.com>
On Sun, 13 Sep 1998 18:12:17 +0000, Jason Holland wrote :
>shane michael harwood wrote:
>>
>> is there a way for a CGI script to get the contents
>> of a file that isn't on the same server as the cgi script
>>
>> i want to do something like this.
>>
>> $file= $FORM{'filename'};
>> open(PIRFILE, $file);
>> $contents = <PIRFILE>;
>> close (PIRFILE);
>>
>> with $file equal to something like http://cs.uiowa.edu/sample.pir
>
>
>Hello,
>
>Unless you don't have access to the other machine running the HTTPD
>server, why not just use NFS or something similar to make the remote
>file system accessible to the local machine?
>
I think that given "http://cs.uiowa.edu/sample.pir" we can safely
assume an HTTP server and thus advocate the LWP module available from
CPAN.
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Mon, 14 Sep 1998 00:04:55 GMT
From: Tonya <tonya@jacksonville.crosswinds.net>
Subject: Registration Script
Message-Id: <35FC5DA7.2BE272CE@jacksonville.crosswinds.net>
Does anyone know where I can get a freeware registration cgi/perl
script.
This script would allow users to register their nick and a random
password would be
generated and then emailed to their email address. Users could change
their password
via a form. This would be use for members only areas of a website.
and example: http://lovecorner.hypermart.net
Thanks in advance!!
Tonya
------------------------------
Date: Mon, 14 Sep 1998 00:25:17 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Registration Script
Message-Id: <NnZK1.20$0u4.128914@nsw.nnrp.telstra.net>
In article <35FC5DA7.2BE272CE@jacksonville.crosswinds.net>,
Tonya <tonya@jacksonville.crosswinds.net> writes:
> Does anyone know where I can get a freeware registration cgi/perl
> script.
If you are looking for software, but don't have a question about perl,
this group is not the right place to ask. We discuss perl here, not
where to download software.
That said: Have a look at www.cgi-resources.com. Have a look around on
yahoo.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 00:50:31 GMT
From: Tonya <tonya@jacksonville.crosswinds.net>
Subject: Re: Registration Script
Message-Id: <35FC6854.23561B4A@jacksonville.crosswinds.net>
Chill out there man....easy...
Good Lord, I was just asking if anyone knew where I could find it...
because I've searched and searched for it....and with no avail, I haven't
been able to find it. itsn't it perl.misc?? MISC, usually mean anything and
everything...if I'm not mistaken....
BTW: I've looked at cgi-recource -- they don't have ANYTHING!!!!!
Martien Verbruggen wrote:
> In article <35FC5DA7.2BE272CE@jacksonville.crosswinds.net>,
> Tonya <tonya@jacksonville.crosswinds.net> writes:
> > Does anyone know where I can get a freeware registration cgi/perl
> > script.
>
> If you are looking for software, but don't have a question about perl,
> this group is not the right place to ask. We discuss perl here, not
> where to download software.
>
> That said: Have a look at www.cgi-resources.com. Have a look around on
> yahoo.
>
> Martien
> --
> Martien Verbruggen |
> Webmaster www.tradingpost.com.au | Begin at the beginning and go on till
> Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
> NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 02:40:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Registration Script
Message-Id: <9m%K1.274$Qx4.12182@nsw.nnrp.telstra.net>
In article <35FC6854.23561B4A@jacksonville.crosswinds.net>,
Tonya <tonya@jacksonville.crosswinds.net> writes:
> Chill out there man....easy...
You obviously haven't been here much. My response to an off-topic post
was quite calm. I even included a pointer to where you might be able
to find something like what you want. If that's not good enough, hey,
tough shit. You didn't pay me to find you what you want. You didn't
pay me to write what you want. You get what you bargain for.
> Good Lord, I was just asking if anyone knew where I could find it...
> because I've searched and searched for it....and with no avail, I haven't
> been able to find it. itsn't it perl.misc?? MISC, usually mean anything and
> everything...if I'm not mistaken....
Do you realise how many clueless posts we get here every single day,
asking for this or that? Do you realise how often we find out that the
clueless poster has not spent a single minute looking for what they
want themselves? If you can't even disassociate yourself from this for
a second, and insist on taking this personally, then that is your
problem, certainly not mine. You asked a question, you got an answer.
If you didn't like the answer, so what? There was nothing in your
original post to suggest at all that you did look for this anywhere.
Never mind
*Plonk*
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I took an IQ test and the results were
Commercial Dynamics Pty. Ltd. | negative.
NSW, Australia |
------------------------------
Date: Mon, 14 Sep 1998 02:05:13 GMT
From: pynq@midway.uchicago.edu (Jeremy Mathers)
Subject: Re: Seeking Perl program to transfer files between machines (sort of like TFTP)
Message-Id: <Ez94Gr.3B1@midway.uchicago.edu>
In article <Ez8owq.Eu0@undergrad.math.uwaterloo.ca>,
Jasmin F. Patry <jfpatry@undergrad.math.uwaterloo.ca> wrote:
>Jeremy Mathers <pynq@midway.uchicago.edu> wrote:
>>I frequently have the need to transfer files between two Unix machines which
>>are side by side - i.e., such that using FTP is too much bother.
>[...]
>>However, and this is the point, in the spirit of "Don't reinvent the wheel",
>>I'd like to know if there is already an off-the-shelf solution for this.
>
>Quoted from http://src.doc.ic.ac.uk/packages/mirror/ :
>
> Mirror was designed to duplicate a directory hierarchy between two
> machines. It avoids copying files unnecessarily by comparing the file
> time-stamps and file sizes before transferring. Mirror was writen by Lee
> McLoughlin <lmjm@icparc.ic.ac.uk>.
>
> The latest version is Mirror 2.9 which will run on Un*x, Wind*ws 95 and
> Wind*ws NT. Its sole requirement is Perl 4, or better still, Perl 5.
>
>I've used this quite successfully to transfer files between a staging and
>production web server on a regular basis. If your task requires duplicating
>one or more directory hierarchies (or if you can reformulate the task such that
>this description applies), then this may do the job for you.
Thanks for the tip. I checked it out, and it looks impressive (haven't
downloaded it yet) - but it isn't really what I am looking for. It is
close, in that primarily what I am doing is syncing up directories, but,
from looking at the description of how to set it up, it looks like it is
oriented towards a small number of known machines (like 2 or 3). I need
something I can install on many different machines - and I'd rather not have
to maintain config files all over the place.
That is, my application is more horizontal than vertical (breadth, not depth)...
The program I currently have works a lot like a Kermit server. That is, I do:
Xfer
on one end, and it says "Waiting...". On the other machine, I do:
Xfer othermachine file(s)
And the server side receives the file(s), preserving mode (Unix permissions)
and access time. Xfer is a short (43 line) Perl program.
************************************************************************
I just <LOVE> water sports!
Our teachers are complete pros!
Jamilia and I actually synchronized our strokes.
We did the whole length of the pool on our backs.
Girl Scout camp is the greatest.
- From the back of the box of Tagalongs (in 1994!)
- (C) 1992, Girl Scouts of the U.S.A.
- Originally seen in Ted Frank's .sig in AFU
- Later seen gracing the pages of Spy Magazine.
- pynq@quads.uchicago.edu, who is still costing the net
hundreds, if not thousands, of dollars, every time he posts -
************************************************************************
rwvpf wpnrrj ibf ijrfer
------------------------------
Date: Sun, 13 Sep 1998 21:13:31 -0400
From: "ERP Guru" <feedback@websummary.com>
Subject: Strange ! inserted in sendmail results <- HELP!!!
Message-Id: <35fc6d97.0@oit.umass.edu>
Hi All,
I am looking for any ideas on the cause of a problem I am having with a
script.
The script reads fields from a text file, places them in associative arrays,
then prints the output to sendmail (it emails the fields).
Here's the problem:
Everything works as it should except for one small problem. When one of the
fields is particularly long (say over 500 characters), the email result from
sendmail has a strange "! " (exclamation, space, newline) inserted in it at
a random point.
For instance, it is supposed to look like this in the email:
"This is a sample text output from sendmail. It was emailed to me. It is
very long and appears as it is suppossed to"
But here is what happens:
"This is a sample text output from sendmail. It was em!
ailed to me. See how it inserted the random character and newline in the
middle of the word email."
Any suggestions?
Thanks
Erik
ermoore@student.umass.edu
------------------------------
Date: Sun, 13 Sep 1998 17:59:00 -0700
From: "steven t henderson" <STEVENHENDERSON@prodigy.net>
Subject: this is a very stupid question....
Message-Id: <6thq1f$2trm$1@newssvr04-int.news.prodigy.com>
i am trying to do somthing that would appear to be *very* simple, but cannot
seem to get it working. i am simply trying to JUMP to a new URL from a CGI
script, but am getting the URL printed out in my browser instead.
here is what i execute (like from a login HTML page):
> #!/usr/bin/perl
> print "Location: /local.htm\n\n";
> 1;
which i execute and it promptly prints out the "Location..." line, but does
not jump to local.htm (which i have moved to every possible position and
think it will find if it wants to). so what am i missing here?
i am using IE4 and perl Version 5, build 110 on a Win98 machine using MS Web
server software.
thanks.
------------------------------
Date: Sun, 13 Sep 1998 19:01:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: this is a very stupid question....
Message-Id: <MPG.106618c9e9861e3698984f@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <6thq1f$2trm$1@newssvr04-int.news.prodigy.com> on Sun, 13 Sep
1998 17:59:00 -0700, steven t henderson <STEVENHENDERSON@prodigy.net>
says...
> i am trying to do somthing that would appear to be *very* simple, but cannot
> seem to get it working. i am simply trying to JUMP to a new URL from a CGI
> script, but am getting the URL printed out in my browser instead.
>
> here is what i execute (like from a login HTML page):
>
> > #!/usr/bin/perl
> > print "Location: /local.htm\n\n";
> > 1;
'this is a very stupid question...' is a very stupid subject, and many
people will simply not read the post.
'/local.htm' is not a URL. If you provide a URL
('http://my.server.com/local.htm') the program should do what you want.
I'm not sure what purpose you intend for the '1;' at the end of your
script. That is needed only to report successful execution of a 'use'd
or 'require'd file, not when the program exits.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 14 Sep 1998 00:56:07 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Using File::Find under -T switch
Message-Id: <35fc6704.1745955@news.btinternet.com>
On Sun, 13 Sep 1998 19:20:32 +0200, Ekenberg wrote :
>I'm running a script under the perl -T switch, and the script makes use of
>the File::Find module.
>
>This results in an error message:
>"Insecure dependency in chdir while running with -T switch at
>usr/lib/perl5/File/Find.pm line 109."
>
>How can I get around this problem?
>I really need to use the File::Find module...
>
It might be that the path you are passing to find() is tainted, I
think that perlsec has more to say on this.
/J\
--
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 14 Sep 1998 01:37:45 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: using loadable modules...
Message-Id: <6ths19$8l1$1@netnews.csie.NCTU.edu.tw>
hi there,
I encountered a problem while using modules.
My script is written for multi-platforms, and if I say:
if ($^O=~/win32/i) {
use xxx;
:
:
}
the module xxx is only available on win32 system.
However, if the script are tested on other platform,
the perl will say that the module xxx cannot be found
during compile time, though it is not necessary on other systems.
So can I tell perl not to check the used modules while
compile time to avoid this problem?
thanks.
------------------------------
Date: Sun, 13 Sep 1998 19:14:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: using loadable modules...
Message-Id: <MPG.10661bda645d8eed989850@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <6ths19$8l1$1@netnews.csie.NCTU.edu.tw> on 14 Sep 1998
01:37:45 GMT, GEMINI <dennis@info4.csie.nctu.edu.tw> says...
...
> if ($^O=~/win32/i) {
> use xxx;
> :
> :
> }
...
> So can I tell perl not to check the used modules while
> compile time to avoid this problem?
The simplest solution is to encase the entire construct in a
BEGIN { } block. Then the decision about the operating system will
control whether the module is included or not.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 13 Sep 1998 20:49:15 -0400
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: what good is flock $LOCK_NB?
Message-Id: <MPG.1066321961dec06a989694@news.south-carolina.net>
In article <35FC468D.30859AD@marlin.utmb.edu> on Sun, 13 Sep 1998
17:26:21 -0500, Mozilla/4.04 (szhou@marlin.utmb.edu) pounded in
the following text:
=> correct me if i'm wrong, but when you lock-nb a file handle, then
=> immediately use while($temp = <FILE>) to read the contents line-by-line,
=> is it possible for another process to write to the file at that time,
=> too? but of course this problem would be solved with lock-ex. but what
=> good is lock-nb?
=>
Hey Mozilla/4.04! (What a strange name...)
You probably should read the flock documentation again... All
LOCK_NB does is check to see if the file is locked. If LOCK_NB
is not specified, the function waits until the file is unlocked,
and then locks it and returns (more or less).
Also, locking is voluntary. You can have your script lock a
file, but I can come along and write a program to write to that
file without checking for a lock, and it will.
Hope This Helps!
--Matthew
------------------------------
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 3706
**************************************