[13193] in Perl-Users-Digest
Perl-Users Digest, Issue: 603 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 20 16:07:33 1999
Date: Fri, 20 Aug 1999 13:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Aug 1999 Volume: 9 Number: 603
Today's topics:
Re: $8.99 NT/UNIX HOST, 100 megs, UNLIM HITS! CHEAP! Ju <cassell@mail.cor.epa.gov>
Re: ? perl4 != perl5 ? <cassell@mail.cor.epa.gov>
[Q] Server-Side Page with Embed/XS (Zeqing Xia)
Alt format for man pages? deane_barker@my-deja.com
Alt Format for Man Pages? deane_barker@my-deja.com
Re: directory reading <cassell@mail.cor.epa.gov>
Error message <habfan2@my-deja.com>
Re: exponentiation please explain what it means <cassell@mail.cor.epa.gov>
Finding URLs <samay1NOqbSPAM@hotmail.com>
Functions within functions in a class <brchan@nortelnetworks.com>
How do I create a log consisting of warnings? <poohba@io.com>
Re: How do I create a log consisting of warnings? (Brian Pontz)
How Perl handles time steveeq1@earthlink.net
Re: Matching E-mail <tmcgee@bondmarkets.com>
Re: merging complex hashes? <d-edwards@uchicago.edu>
Re: new to perl and a bit stupid <paul.glidden@unisys.com>
Re: new to perl and a bit stupid <ychampou@newbridge.com>
NT Internet Explorer5.0 for perl script <mzchen@bellatlantic.net>
Re: Perl Image Processing Problems!! <kenhirsch@myself.com>
Re: premature end of script headers <habfan2@my-deja.com>
Re: printf problem - Left-Justifying Floats (M.J.T. Guy)
Re: processing html on the fly part 2 <flavell@mail.cern.ch>
Re: processing html on the fly part 2 <smile777@hotmail.com>
Re: processing html on the fly part 2 (Larry Rosler)
Re: reference to object method (M.J.T. Guy)
Re: Referring to "my" variables <makkulka@cisco.com>
Re: Referring to "my" variables (Larry Rosler)
Re: Referring to "my" variables <makkulka@cisco.com>
Re: Referring to %22my%22 variables ("willow")
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Aug 1999 12:12:45 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: $8.99 NT/UNIX HOST, 100 megs, UNLIM HITS! CHEAP! Just found it!
Message-Id: <37BDA8AD.CFA410E5@mail.cor.epa.gov>
Philip 'Yes, that's my address' Newton wrote:
>
> designdood@my-deja.com wrote:
> >
> > fronpage 2k also, and FULL ASP and database!
>
> Yes, I'm sure these (first two) feature alone will win over most of the
> comp.lang.perl.misc regulars to this site.
I hope you also noticed that FrontPage not only produces
lousy HTML, but cannot spell its own name either. Spell
checker, anyone?
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 20 Aug 1999 12:18:09 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: ? perl4 != perl5 ?
Message-Id: <37BDA9F1.1699EF14@mail.cor.epa.gov>
kilimount wrote:
>
> For many reasons I have to run old scripts made for perl4 under perl5,
> and it's returning me tons of errors (else than \ before @). If anyone
> has a fast solution or could tell me the differences between perl4 and
> 5, that'd of a great help to me.
Well, it sounds like you have email addresses that you need to
backwhack. In perl4 you could stick a @ in double quotes and
get away with it. In perl5 you need \@ in there so the @ doesn't
get interpolated.
The perltrap manpage has a list of the perl4->perl5 gotchas.
This looks like Number One (with a bullet :-).
Be sure to run your code with -w .
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 20 Aug 1999 12:58:18 -0500
From: zqx@siesta.cs.wustl.edu (Zeqing Xia)
Subject: [Q] Server-Side Page with Embed/XS
Message-Id: <7pk4vq$p88@siesta.cs.wustl.edu>
I'm working on a project that has a need for ASP-style HTML
generation from some set of customizable templates.
The platform is CORBA based, multi-threaded, with Netscape
server as the web server.
Current implementation uses server-side Javascript, with much
of the HTML generated in C++ from a CORBA service invoked by
the webserver. The HTML generation process will also need to
call other CORBA services to do the transaction and get
information.
However this mechanism is not flexible enough because of the
limited functionality in manipulating template strings in C++.
It is obvious that Perl can come into the play for more
sophisticated page generation work, similar to ASP. For example,
a page template like:
<html>
...
<perlx>
do_this();
</perlx>
...
where <perlx>..</perlx> is a piece of code generating a snippet
of HTML.
So the calling sequence will be:
webserver => corba_svc => embedded perl interpretor => perl code
=> XS wrapper => other corba_svc/functions in C++
The question I have is: has anyone done stuff similar to this
before? What do you see the potential problem in this scheme?
One thing I'm a little concerned with is debuggability. While
everything in C++ is very rigid, debugging is easy. But in this
scheme it would be much more difficult.
Thanks very much for any suggestions.
Zeqing Xia
------------------------------
Date: Fri, 20 Aug 1999 19:15:08 GMT
From: deane_barker@my-deja.com
Subject: Alt format for man pages?
Message-Id: <7pk9fg$8f8$1@nnrp1.deja.com>
Is there anyway I can get the PERL man pages in
some kind of word-processing format, like .DOC or
.WPD, or even .RTF?
I'm trying to print them out in HTML, but there
just too much information to make it manageable.
Thanks.
Deane
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 20 Aug 1999 19:17:50 GMT
From: deane_barker@my-deja.com
Subject: Alt Format for Man Pages?
Message-Id: <7pk9kh$8ig$1@nnrp1.deja.com>
Is there an alternate format for the man pages? I want to print them
out, but just printing straight from Netscape isn't working -- way too
much information. I'm on page 40-something and I'm just two sections
into PERLFAQ.
Is there perhaps a .DOC, .WPD, or .RTF version somewhere?
Deane
deane_barker@hotmail.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 20 Aug 1999 11:53:46 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: directory reading
Message-Id: <37BDA43A.376AD4D1@mail.cor.epa.gov>
Neko wrote:
>
> On Fri, 20 Aug 1999 02:24:21 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
> wrote:
>
> >In article <37BC8863.96CE4A05@cisco.com>,
> > Makarand Kulkarni <makkulka@cisco.com> writes:
> >> Yes. Make it a side effect of using map.
> >> map { $hash {$directory. $_} = -s $_ }grep(!/^\./,readdir(ZIPDIR));
> >
> >Or if you don't like map in a void context, and side effects which are
> >not immediately clear:
> >
> >my %files = map { ("$directory/$_", -s $_) } grep { !/^\./ } readdir DIR;
> ^
> "$directory/$_"
>
> my %files = map { $_, -s } map "$directory/$_", grep !/^\./, readdir DIR;
And also, as may not have been pointed out yet, the original
grep !/^\./
may not be what the poster wanted. This gets rid of all
files/directories starting with a period, as well as what
she may have intended: . and ..
So she may have actually wanted: grep !/^\.\.?/
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 20 Aug 1999 19:29:00 GMT
From: Teacher Guy <habfan2@my-deja.com>
Subject: Error message
Message-Id: <7pka9c$92u$1@nnrp1.deja.com>
Hello! I have an error message that reads, "Premature end of script
headers". I have +100 lines of code and one dumb error. Can someone
help.
Thanks.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 20 Aug 1999 11:51:13 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: exponentiation please explain what it means
Message-Id: <37BDA3A1.794896A8@mail.cor.epa.gov>
Ben Horowitz wrote:
Given your question, I don't think that 'exponentiation' is
the word you were looking for. 'Interpolation' maybe?
> and whats the diffrence between chop ,and chop,and when do you use 1
> punctuation mark and 2,thanks
Do you mean single quotes and double quotes?
If you do, then you'll want to read the perlop section on
"Quote and Quote-like Operators" which explains about this.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 20 Aug 1999 10:42:08 -0700
From: Samay <samay1NOqbSPAM@hotmail.com>
Subject: Finding URLs
Message-Id: <000b8d9b.593f771f@usw-ex0102-010.remarq.com>
Hi,
I am looking for search engine or program, which can give
me all the URLs with searching with regex..
ex..
I want all the url that says http://*/sports or
http://*.*sports*.com/
How I should start?
and How I can proceed?
Thanks
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Fri, 20 Aug 1999 15:44:11 -0400
From: Bryan Chan <brchan@nortelnetworks.com>
Subject: Functions within functions in a class
Message-Id: <37BDB00B.95388AEE@nortelnetworks.com>
Hi
I created two instances (let's say ABA and CDC) of the following class
and gave each object a different $_foo value. Then I called the bar
function with each class, but when the CDC called gooie and printed out
the value of $blah, it gave the value of $_foo in ABA. Why does
CDC::gooie use the $blah from ABA rather than the $bar from CDC? What
follows is the code for the class, and the code for my test program.
Bryan Chan
*************************** package Blah.pm starts here**************
package Blah;
use strict;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $this = {};
$this->{FOO};
bless($this, $class);
return $this;
}
sub _foo {
my $this = shift;
if (@_) {
$this->{FOO} = shift;
}
return $this->{FOO};
}
sub bar {
my $this = shift;
my $blah = $this->_foo;
print "my blah = $blah \n";
sub gooie {
print "my blah = $blah \n";
}
&gooie;
}
1;
__END__
******************** test program starts here **********************
use Blah;
$aba = Blah->new();
$cdc = Blah->new();
$aba->_foo('aba foo');
$cdc->_foo('cdc foo');
print "Object ABA calling BAR:\n";
$aba->bar;
print "\n\nObject CDC calling BAR:\n";
$cdc->bar;
------------------------------
Date: Fri, 20 Aug 1999 13:43:10 -0500
From: Poohba <poohba@io.com>
Subject: How do I create a log consisting of warnings?
Message-Id: <Pine.LNX.4.10.9908201341540.14689-100000@eris.io.com>
When I run my script I get a bunch of warnings. How do I get those
warning to print to a file so that I can read them later?
* Web Page Designs *
/ poohba@io.com | www.io.com/~poohba\
---------------------------------------
\ For info about me send message with /
* subject "send file help" *
------------------------------
Date: Fri, 20 Aug 1999 20:13:58 GMT
From: pontz@channel1.com (Brian Pontz)
Subject: Re: How do I create a log consisting of warnings?
Message-Id: <37bdb551.183805339@news2.channel1.com>
I'm no expert but I would prob do a sub with warnings like
open(FILE "$file") || &Error("Couldnt open $file:$!");
sub Error {
my($mesg)=@_;
open (ERROR, ">>$errorfile") || die;
print ERROR "$mesg\n";
close(ERROR);
exit 0;
}
Brian Pontz
>When I run my script I get a bunch of warnings. How do I get those
>warning to print to a file so that I can read them later?
------------------------------
Date: Fri, 20 Aug 1999 18:56:46 GMT
From: steveeq1@earthlink.net
Subject: How Perl handles time
Message-Id: <7pk8d7$7ip$1@nnrp1.deja.com>
I know how to break down a moment time into variables with Perl:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
Simple stuff. However, does anyone know how to do the opposite? That
is, take a date (Say, "03/01/99) and convert it to the long integer
(935175372)?
Reason I need to do this is because I need to compare dates in perl and
comparing the long integers seems to be the best way to do it.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 20 Aug 1999 15:45:40 -0400
From: Tom McGee <tmcgee@bondmarkets.com>
Subject: Re: Matching E-mail
Message-Id: <37BDB064.4852@bondmarkets.com>
http://www.perl.com/CPAN-local/authors/Tom_Christiansen/scripts/ckaddr.gz
Tom Briles wrote:
>
> Winter wrote:
> >
> > Hi,
> >
> > Can anyone write a regular expression to detect email address? I have a line
> > of string $str may or may not contain email adress..
> >
> > Thanks in advance for you help, if you can help, please send it to
> > ty.wong@utoronto.ca
>
> Gosh...this question sure gets asked alot.
>
> It would be nice if some Perl gods got together and created a list of
> all the frequently asked Perl questions of which they could think.
> Then, they could provide the answers, and include the questions and the
> answers with the Perl distribution.
>
> Unfortunately, such amazingly useful information would most assuredly be
> very expensive...even 'priceless'.
>
> - Tom
------------------------------
Date: Fri, 20 Aug 1999 18:23:28 GMT
From: Darrin Edwards <d-edwards@uchicago.edu>
Subject: Re: merging complex hashes?
Message-Id: <tgwvuq9uqn.fsf@noise.bsd.uchicago.edu>
Stephen Riehm <sr@pc-plus.de> writes:
> I have the sick desire to merge two complex hashes -
[snip]
> ie:
> $persobj = $newobj; # no good, data in $persobj gets deleted
> %$persobj = ( %$persobj, %$newobj ); # better, but only merges the keys
> of the
> # top level hash.
>
> I've written a routine to do a deep-merge, but it has problems, and I
> was
> wondering if anyone has already written a module to do this?
_The Perl Cookbook_ suggests the dclone function in the Storable
module available from CPAN for a similar problem.
Darrin
------------------------------
Date: Fri, 20 Aug 1999 14:07:54 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: new to perl and a bit stupid
Message-Id: <7pk8sj$r8o$1@eanews1.unisys.com>
perl does have a getline function though.
open FILEHANDLE , "filename" || die;
while ($var = <FILEHANDLE>)
{
code to parse out lines here
}
using this you can get one line at a time, then do with each what you must.
Use pattern matching to determine criteria and you will be good to go
ceara_rea@hotmail.com wrote in message <7pjgph$km2$1@nnrp1.deja.com>...
>this is probably a very dumb question, but I've never used perl before
>and I'm trying to write a script in it.........
>I'm trying to extract some data from a file which is split up into
>several sections, I'm only interested in data contained in one
>particular section which has the form:-
>
>SECTION HEADER
>lots of text lines
>that i want to do
>something with
>^$ (blank line marking end of section)
>
>If I was writing this in awk I'd start at pattern /SECTION HEADER/ and
>use the 'getline' function in a loop to get all the text lines until I
>hit a blankline. Alas sob, sob there's no getline in perl so I'm stuck.
>I've done a2p and this gives me a subroutine for getline (which
>incidentally when I put it into my script doesn't work) but I'm not sure
>that this is the best way to do it, I have an inkling that maybe I
>should be putting the text lines of this section into an array and then
>reading each $line of the array? but I haven't got a clue how to
>construct it.
>I'd greatly appreciate any help, and if somebody could spoon feed me the
>code that would be even better.
>Many thanks
>Ceara
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
------------------------------
Date: Fri, 20 Aug 1999 15:12:54 -0400
From: Yanick Champoux <ychampou@newbridge.com>
To: ceara_rea@hotmail.com
Subject: Re: new to perl and a bit stupid
Message-Id: <37BDA8B6.7F4E0D43@newbridge.com>
Hullo,
ceara_rea@hotmail.com wrote:
> I'm trying to extract some data from a file which is split up into
> several sections, I'm only interested in data contained in one
> particular section which has the form:-
>
> SECTION HEADER
> lots of text lines
> that i want to do
> something with
> ^$ (blank line marking end of section)
I think one of the best ways to do it would be:
#! /usr/bin/perl
while( <DATA> )
{
print if /BEGIN_HERE/.../^$/;
}
__DATA__
Some stuff.
And then more.
And more.
And more.
BEGIN_HERE
Now *this* is what we want.
We want this line too.
And this one.
But we should not see this one.
__END__
The key function here is the '..' operator (for more information on this
cool guy, look in perldoc perlop). But as this little program use many
Perl magic and you are a beginner, many you will feel better with this
longer, but easier to understand, version:
#! /usr/bin/perl
# I suppose that we read from stdin.
# We read until we find the spot.
$line = <STDIN> until $line =~ /BEGIN_HERE/;
# Let's print until we find an empty line.
print $line until ( $line = <STDIN> ) =~ /^$/;
__END__
Of course, there's many other ways to do it, but these two should work
fine...
Joy,
Yanick
--------------------------------------------------
|||| ||||| Yanick Champoux
||||\\|||| Analyst, Advanced Technology Support
||||\\\||| Newbridge Networks Corporation
||||\\\\|| More Info? http://www.newbridge.com
|||| \\\\| E-mail: ychampou@newbridge.com
||| ```` Phone: (613) 599-3600 x5423
--------------------------------------------------
------------------------------
Date: Fri, 20 Aug 1999 20:06:53 GMT
From: "mc" <mzchen@bellatlantic.net>
Subject: NT Internet Explorer5.0 for perl script
Message-Id: <xziv3.276$ct6.82275@typhoon2.gnilink.net>
I have a small Perl script and screen output followed.
On the screen output, 1st and 3rd line are shown as well. Does
anyone know what may be the cause?
Perl script:
1st line: #!e:/Perl/bin/perl ( Do I need to put this line here for
NT?)
2nd line: print "Content-type: text/html\n\n";
print << 'end-of-header';
<HTML>
<BODY>
<H1>Hello<BR>
</H1>
</BODY>
</HTML>
end-of-header
----------------------
NT Internet Explorer5.0 screen output:
1st line: #!e:/Perl/bin/perl print "Content-type: text/html\n\n"; print
<< 'end-of-header';
2nd line: Hello
3rd line: end-of-header
-----------------------
Thanks in advance.
mc
------------------------------
Date: Fri, 20 Aug 1999 13:10:42 -0400
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: Perl Image Processing Problems!!
Message-Id: <7pk292$rp2$1@birch.prod.itd.earthlink.net>
David Rugendyke wrote:
> Hi,
>
>
> and if a score rank say 60% then only 60% of that image would be
> displayed and so on for each result. If anyone could please show me how
> i can do this as i dont have any experience in perl image processing i
> would be extremely gratefull. Thanks,
If you just need a single color bar, you can stretch an image with the
HEIGHT and WIDTH attributes. See, e. g., http://isd.usc.edu/~karl/BarChart/
------------------------------
Date: Fri, 20 Aug 1999 19:37:46 GMT
From: Teacher Guy <habfan2@my-deja.com>
Subject: Re: premature end of script headers
Message-Id: <7pkaq8$9h9$1@nnrp1.deja.com>
How did you solve for this problem?
Kiley
In article <37BB5F61.8A93BA8B@blackhole-designs.com>,
Jimmy Humphrey <jimmy@blackhole-designs.com> wrote:
> Nevermind guys, I saw that I did not put a "use POSIX 'strgtime' (or
> whatever it is)
>
> Jimmy
>
> Jimmy Humphrey wrote:
>
> > Hi,
> >
> > I'm getting the following error in my perl/cgi script in my log
files.
> >
> > [Wed Aug 18 09:34:23 1999] [error] [client 24.93.92.238] Premature
end
> > of script
> > headers: /home/sailing/public_html/cgi-bin/signup.pl
> >
> > Could anybody tell me why this might be happening. You can view my
> > code at http://www.sailingpoint.com/signup.txt
> >
> > I'm using perl 5.005_02 on SunOS 5.7. And, everything with my html
> > form is correct btw.
> >
> >
> > Jimmy
> >
> >
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 20 Aug 1999 17:23:10 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: printf problem - Left-Justifying Floats
Message-Id: <7pk2tu$rdo$1@pegasus.csx.cam.ac.uk>
In article <7os205$9r9$1@nnrp1.deja.com>, <pgolds@my-deja.com> wrote:
>
>The following code:
>perl -e 'printf "|%-10.4f|\n",0;'
>
>results in:
>| 0.0000|
>
>Is this a known bug? Does anybody have a fix? We
>are using Perl version 5.004_01.
The fix is to upgrade to a recent version of Perl. This has been mended
since perl5.004_04.
Mike Guy
------------------------------
Date: Fri, 20 Aug 1999 19:21:52 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: processing html on the fly part 2
Message-Id: <Pine.HPP.3.95a.990820190907.20918N-100000@hpplus03.cern.ch>
On Fri, 20 Aug 1999, Jeff wrote:
(reformatted for usenet)
> When I run a perl script from my cgi-bin that processes an HTML page
> and then spits the page out to the browser, the web browser treats the
> cgi-bin as the starting directory to find images and reference all the
> paths in the web page.
Of course. If you're writing CGI scripts, then this elementary fact
should be well known to you.
> I want the web browser to look in another directory, say
> http_docs, and use that as the base path. How can I accomplish this in
> perl?
The same way that you accomplish it in any other programming language.
Read up on how the WWW works.
> I know you can use <base href="blah...."> in the HTML but I want to do
> this within the perl environment.
Perl isn't running on the browser in this scenario, so this is a
meaningless requirement.
I feel sure that this will all become obvious when you review how
relative URLs are resolved at the client. There is no way that making
changes in the programming language that runs on the server can somehow
magically change what happens at the client. The network in between
operates by agreed protocols, not by telepathy. When you understand
that you'll wonder how you could have supposed that javascript (which in
many cases on the WWW will be switched off or filtered out anyway) was
relevant to this.
> Javascript doesn't use the <base> tag
> and you have to set a javascript variable in addition to the <base> if
> you go this route.
Problem solving consists of taking an apparently complex problem apart
into manageable parts, and understanding how each part works and how
they interact with each other. We know nothing about you and how you
work, but based entirely on your posting here, you would appear to
expect to throw some Perl, some HTML, some javascript, a server and a
browser into a shaker, give it a good toss, and hope thet something
useful comes out. If not, then you just need to give it a better toss.
Sorry, that does not seem to me to be a productive way to proceed.
good luck
------------------------------
Date: Fri, 20 Aug 1999 14:42:46 -0400
From: Jeff <smile777@hotmail.com>
To: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: processing html on the fly part 2
Message-Id: <37BDA1A5.771F9248@hotmail.com>
Alan,
Thank you for your response. You did enlighten my eyes to one fact in
particular, once the perl script spits out the new HTML path the server is
the vehicle that tells the browser where the base path of this page is.
However, is there a way to tell the server to pretend as though this
document were served from "usr/www/" when in reality it might have been
served from "usr/cgi". In this manner the browser will look at another
directory, not the actual directory the page was served. My goal is to have
all this interaction taken care of before the browser even receives the
page.
Jeff
Alan J. Flavell wrote:
> On Fri, 20 Aug 1999, Jeff wrote:
>
> (reformatted for usenet)
>
> > When I run a perl script from my cgi-bin that processes an HTML page
> > and then spits the page out to the browser, the web browser treats the
> > cgi-bin as the starting directory to find images and reference all the
> > paths in the web page.
>
> Of course. If you're writing CGI scripts, then this elementary fact
> should be well known to you.
>
> > I want the web browser to look in another directory, say
> > http_docs, and use that as the base path. How can I accomplish this in
> > perl?
>
> The same way that you accomplish it in any other programming language.
> Read up on how the WWW works.
>
> > I know you can use <base href="blah...."> in the HTML but I want to do
> > this within the perl environment.
>
> Perl isn't running on the browser in this scenario, so this is a
> meaningless requirement.
>
> I feel sure that this will all become obvious when you review how
> relative URLs are resolved at the client. There is no way that making
> changes in the programming language that runs on the server can somehow
> magically change what happens at the client. The network in between
> operates by agreed protocols, not by telepathy. When you understand
> that you'll wonder how you could have supposed that javascript (which in
> many cases on the WWW will be switched off or filtered out anyway) was
> relevant to this.
>
> > Javascript doesn't use the <base> tag
> > and you have to set a javascript variable in addition to the <base> if
> > you go this route.
>
> Problem solving consists of taking an apparently complex problem apart
> into manageable parts, and understanding how each part works and how
> they interact with each other. We know nothing about you and how you
> work, but based entirely on your posting here, you would appear to
> expect to throw some Perl, some HTML, some javascript, a server and a
> browser into a shaker, give it a good toss, and hope thet something
> useful comes out. If not, then you just need to give it a better toss.
> Sorry, that does not seem to me to be a productive way to proceed.
>
> good luck
------------------------------
Date: Fri, 20 Aug 1999 11:48:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: processing html on the fly part 2
Message-Id: <MPG.122742db20e4304989e81@nntp.hpl.hp.com>
In article <Pine.HPP.3.95a.990820190907.20918N-100000@hpplus03.cern.ch>
on Fri, 20 Aug 1999 19:21:52 +0200, Alan J. Flavell
<flavell@mail.cern.ch> says...
> On Fri, 20 Aug 1999, Jeff wrote:
> > When I run a perl script from my cgi-bin that processes an HTML page
> > and then spits the page out to the browser, the web browser treats the
> > cgi-bin as the starting directory to find images and reference all the
> > paths in the web page.
>
> Of course. If you're writing CGI scripts, then this elementary fact
> should be well known to you.
It's not well known to me. What is well known is that one ought not
make any assumption about what the current directory is when the CGI
program starts. Either the current directory must be set explicitly in
the program, or all file references should be absolute. Environment
variables such as $ENV{DOCUMENT_ROOT} or $ENV(PATH_TRANSLATED} may
faclitate this.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Aug 1999 17:42:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: reference to object method
Message-Id: <7pk425$s8n$1@pegasus.csx.cam.ac.uk>
Damian Conway <damian@cs.monash.edu.au> wrote:
>
>Note that you can also use symbolic references and write:
>
> my $ref = "Bar::FooOnYou";
> $var->$ref("Howdy\n");
Err... that's not a symbolic reference. It's just a method name, and
method names are always "symbolic".
Mike Guy
------------------------------
Date: Fri, 20 Aug 1999 11:03:36 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Referring to "my" variables
Message-Id: <37BD9878.39E4CEFB@cisco.com>
[ Larry Rosler wrote:
> Why return refs, when simply returning the (scalar) values would do it
> more simply? Taking refs of scalars is seldom warranted.
Because the Post specifically asked --
"After the subroutines execute, I would like to compare the values of **my**
$sum
from each subroutine. How can I reference those?"
The my is like in declaring using my inside the sub.
--
------------------------------
Date: Fri, 20 Aug 1999 11:42:48 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Referring to "my" variables
Message-Id: <MPG.12274188a55e22a8989e80@nntp.hpl.hp.com>
In article <37BD9878.39E4CEFB@cisco.com> on Fri, 20 Aug 1999 11:03:36 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ Larry Rosler wrote:
> > Why return refs, when simply returning the (scalar) values would do it
> > more simply? Taking refs of scalars is seldom warranted.
>
> Because the Post specifically asked --
> "After the subroutines execute, I would like to compare the values of **my**
> $sum
> from each subroutine. How can I reference those?"
> The my is like in declaring using my inside the sub.
I meant, return the *value* of $sum from each of the subroutines, not a
reference to $sum.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 20 Aug 1999 12:04:15 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Referring to "my" variables
Message-Id: <37BDA6AF.93D5FAA2@cisco.com>
[ Larry Rosler wrote:
> I meant, return the *value* of $sum from each of the subroutines, not a
> reference to $sum.
I understand what you are saying -- but I am trying to explain why I was
suggesting returning a ref to $sum. You can go ahead and give a list
or ways to do it the better way -- but that still does not answer the post.
--
------------------------------
Date: Fri, 20 Aug 1999 09:25:24 -0800
From: chettah@msn.com ("willow")
Subject: Re: Referring to %22my%22 variables
Message-Id: <P7gv3.4784$001.2346857@WReNphoon3>
In response to Eric, yes, that is line 36.
I am not using a hash, and {capin}, etc, were my attempt at referencing the
$sum from each subroutine. I also tried the name of the subroutine in
brackets but I got the same error.
Still confused, but still trying.
Tara
-**** Posted from RemarQ, http://www.remarq.com/?a ****-
Search and Read Usenet Discussions in your Browser - FREE -
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 603
*************************************