[15898] in Perl-Users-Digest
Perl-Users Digest, Issue: 3311 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 10 14:05:28 2000
Date: Sat, 10 Jun 2000 11:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960660313-v9-i3311@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 10 Jun 2000 Volume: 9 Number: 3311
Today's topics:
ANSI Perl: No Way !!! <john@thinman.com>
Re: Capturing frames <abe@ztreet.demon.nl>
excluding certain domains in e-mails <dzapped@theramp.net>
Re: Find and replace! <abe@ztreet.demon.nl>
Help a newbie, do a good deed. Mail question.... <dilcher@cueva.com>
Hiding / Setting the text in the URL location bar of br bluecraft@hushmail.com
Re: Hiding / Setting the text in the URL location bar o <raphaelp@nr1webresource.com>
Re: Hiding / Setting the text in the URL location bar o <raphaelp@nr1webresource.com>
Re: Hiding / Setting the text in the URL location bar o <flavell@mail.cern.ch>
Re: Is it possible: Dumping Package Method Names (Neil Kandalgaonkar)
Re: Larry Rosler interview on perl.com! <dan@tuatha.sidhe.org>
Re: Larry Rosler interview on perl.com! <elaine@chaos.wustl.edu>
Re: Larry Rosler interview on perl.com! <dan@tuatha.sidhe.org>
Re: Moving from Unix to NT - sending mail <bill_border@agilent.com>
Re: Need a hand with this piece of code...... <care227@attglobal.net>
new CGI objects in same CGI script <ceebb@cee.hw.ac.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 10 Jun 2000 17:29:51 GMT
From: John from PUNY <john@thinman.com>
Subject: ANSI Perl: No Way !!!
Message-Id: <8httu4$21e$1@nnrp1.deja.com>
Perl is my only language, its a monoculture like a family,
dysfunctional at times, but show me a family isn't (at times).
In fact the whole public domain seems a little goofy at times but I
stick with it because I know the end results are going to be fantastic.
Perl is designed in a true democracy, chaotic at times. Even the group
decision to keep the Y2K "bug" intact is endearing.
It seems Larry Rosler wants to change all that.
I am cut+pasting from
http://www.perl.com/pub/2000/06/rosler.html?wwwrrr_20000606.txt
In his own words:
LR: I believe that [ Perl needs ANSI standardization ], in order to
increase its acceptability...
ME: Perl is already everywhere, it is the single most used language on
the web, Java lacks performance an always seems to be in court. A few
stuffed shirts seem to be in denial about perl but their days are
numbered anyway.
LR: I was experimenting with CGI programming using shell ... Soon I
discovered that Perl ... was much more expressive and much
ME: Duh !! Shell is nearly useless.
LR: ... 'official' Perl semantics has [ err, have ] never been
adequately characterized independent of the implementation, so is
subject to arbitrary change.
ME: Arbitrary ?? I can honestly say that I have never seen a single
perl feature that didn't make me proud of the perl way of making
decisions. Its a model for the whole human race :)
LR: Building on quicksand is acceptable for 'scripts' of limited
longevity
ME: Hugh ?? Knowing systems operations, I am guessing most scripts
will out live Bell Labs, even UN*X
LR: Ilya Zakharevitch is most outspoken in his view that Perl is not
(yet?) a 'programming' language!
ME: Applications building language !! Perl does not seek to replace C,
but work w/ it (and the others.) Its a philosophy _and_ a desert
topping.
LR: people should devote their attention to firming up the semantics
and making sure that the implementation conforms to those semantics,
rather than the other way around
ME: No more swiss-army-chainsaw, :`(
Joe Johnston: Or to Perl's charmingly permissive OO implementation.
ME: Gush !!
LR: I am less concerned about individual programmers [ and ] more
concerned about major corporations or government agencies
ME: Perl is a collage of individuals who wont be denied, even in the
workplace. It seems LR wants to hand it over to the suits.
The new economy smart enough to reject corporate welfare and bold
enough to take on the lazy big-caps. Perl is the language to do it.
LR: Samuel Johnson: "When a man knows he is to be hanged in a
fortnight, it concentrates his mind wonderfully."
ME: Better start thinking a little smarter because the small-caps are
the clear winners, the old economy is hanging by a thread and doesn't
even know it.
LR: Python is [in]sufficient to give it a critical mass and I don't
think significant inroads are being made.
ME: My sources tell me that Python is _the_ language to learn from. It
will never achieve chainsaw status, and thats probably a good thing.
Small is beautiful. Thanks for denigrating it, now I'm going to take
the plunge.
LR: I have never needed to write an object in any program. And, as I
said, to me OO is a big yawner.
ME: Hey, news flash: CPAN = OO modules !!
Joe Johnston: How much longer do you see the "Internet Goldrush"
continuing?
LR: Judging by the recent performance of the NASDAQ, it may be over
already.
ME: Well since then the gold rush has half returned. This statement is
typical of the cynicism and ignorance that caused the tumble in the
first place.
I support the small-caps but dont want work for them for the simple
reason that they will make me work.
Fact is that you can actually fall asleep in your big-cap cubicle for
years... I dont sleep, obviously, but I spend all my time fathoming how
perl is going to save our werld.
The economy today is global. The NASDAQ collapse was thought of as an
internet failure, but that was the media talking out their ass.
A quick lesson: There are several indexes which show the whole
picture. While the connection between the stocks and investment is
dubious at best, its the only game in the global village. We, the
privileged, vote for our economy by buy stocks in the sectors we
support, usually through funds.
DOW: The fat cats, receivers of corporate welfare
S&P 500: Generally midcaps, it spans the distance to the next layer, the
Russell 2000: Small, aggressive successful companies who pray each and
every day for lower interest rates
NASDAQ: Similar to the Russell 2000, in fact the charts are parallel.
The trend since y2k is clear. Smaller companies, despite high interest
rates, started eating the bigcaps for lunch. Technology is a key
booster, but other stuff is going on.
Leading up to March 10th peak the whole world was elated. To quote
some old cowboy, "you spit in the desert and a flower blooms."
In a way, these broken investments are the best because recovery is
pure growth, and growth is profit. For example, the application of
translation software to an array of B2B applications simply drops state
of the art business services on any broken nation instantly fixing it
making it a viable trading partner.
From y2k until the end of March, the naz and the dow were oscillating
against each other. Growth possibilities brought down the dow,
interest rate fears boosted the dow and killed the naz. Now both are
growing, but, face it, the big caps are doomed, though we may have to
topple the berlin wall here in US.
Clearly, the big-caps are not interested in seeing their coporate
welfare evaoprate, nor do they want to be gobbled alive by the up-and-
comings.
Greenspan exists to keep their machine running. His contradictory
statements would have made Nixon blush. His claims of controlling
inflation are pure lie, he only seeks to lower one number, OUR salaries.
That and only that number will determine interest rate hikes. The
problem is that we are worth the money, and always have been. And
perlers are worth even more.
LR: Each of us is working on the Perl Golf tournament
ME: There ya go !!
--
##############################################
# CXN, Inc. Contact: john@thinman.com #
# Proud Sponsor of Perl/Unix of NY #
# http://puny.vm.com #
##############################################
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 10 Jun 2000 19:58:07 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Capturing frames
Message-Id: <drt4ksctqtch4g7kihf4dv43cubrf1kjvq@4ax.com>
On 10 Jun 2000 12:47:39 +0100, Jonathan Stowe <gellyfish@gellyfish.com>
wrote:
> On Fri, 09 Jun 2000 17:22:33 +0200 Abe Timmerman wrote:
> > On Fri, 09 Jun 2000 14:19:22 GMT, newbie@db-networks.com wrote:
> >
> >> On 8 Jun 2000 23:58:34 GMT, ebohlman@netcom.com (Eric Bohlman) wrote:
> > ...
> >>
> >> |For a framed page, that will give you the content of the frameset
> >> |document. You'll have to parse that, using something like
> >> |HTML::TokeParser, to get the URLs to the individual content pages and
> >> |then retrieve each of them.
> >>
> >> When I type the address and error web page stating that they only
^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> support browsers with frames. There is nothing to parse. Is there
an
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> updated librairy of LWP::UserAgent or another one?
> >
> > Look at the 'lwpcook' man page for the way you could make the server
> > believe you are (your program is) Mozilla. (I wouldn't try 8 though,
> > this is probably IIS with that _very_ broken browscap.ini thing)
> >
>
> This has nothing to do with whether the server thinks the UserAgent can
> handle frames so fiddling with the UserAgent header will not have any
> effect on the result.
It does if some nitwit ASP or CGI writer makes it send an error-message.
A _server_ couldn't (shouldn't) care less what UserAgent requests that
page, or even what it does with it for that matter.
Your 'Gelzilla/666' would probably have got the same error message from
that page, regardless of the fact that it actualy _is_ frames-capable.
Why do you think MSIE still sends out 'Mozilla 4.0' as its main
UserAgent header?
> What a frames capable browser will do is retrieve
> the frameset page and then parse it to find the layout and the content
> of the consistuent frames and then fetch those pages - so any user agent
> written using LWP will have to do the same if it is to get all the
> content of a frameset.
Which is exactly what Eric Bohlman said (and why I left it in the quoted
text).
Then OP said that the page returned an error message instead of the
frameset document (s)he expected.
That lead me to believe that some greater evil was at work here.
OP confirmed in an e-mail message to me:
> I have it working, it's wonderful.
--
Good luck,
Abe
------------------------------
Date: Sat, 10 Jun 2000 12:13:34 -0500
From: Z-man <dzapped@theramp.net>
Subject: excluding certain domains in e-mails
Message-Id: <3942773E.404B2D49@theramp.net>
Hi all,
I have a registration script that requires an e-mail address what i'd
like to do is exclude certain domains from registering i.e.
someone@hotmail .com is this possable and if so how currently the
e-mail part reads this
&error("missing email address") if (!$in{'email'});
&error("invalid email address") if ($in{'email'} !~ /\@/);
any help appreciated
Denis
------------------------------
Date: Sat, 10 Jun 2000 17:56:12 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Find and replace!
Message-Id: <hnn4kske11v1s17344607u45qgfksik9th@4ax.com>
On Sat, 10 Jun 2000 19:21:24 +0800, "Swee Heng" <sweeheng@usa.net>
wrote:
> I tried this:
> ####
> my $name = 'Santa';
> my $email = 'santa@north.pole';
> my $site = 'www.green-elves.org';
> $message =<<EOF;
> Hi !!name/!! (!!email/!!),
> Thanks for visiting !!site/!!. Hope you enjoyed your stay.
> EOF
> $message =~ s/!!(.*?)\/!!/\$$1/g;
> print $message;
> ####
>
> This is what I got:
> ####
> Hi $name ($email),
> Thanks for visiting $site. Hope you enjoyed your stay.
> ####
And it's all you deserve, for not using '-w' and 'use strict;'
perl could have told you:
Can't use string ("name") as a SCALAR ref while "strict refs" in
use at symref03.pl line 11.
You are using 'symbolic references', which is not a good thing. (read
this group for about a week and you will know why).
This is what I make of your example. I used a hash to store the data,
and changed the s/// slightly, with different delimiters an a bit more
control over the allowed chars in the substitution template.
#!/usr/bin/perl -w
use strict;
my %data = (
name => 'Santa',
email => 'santa@north.pole',
site => 'www.green-elves.org',
);
my $message =<<EOF;
Hi !!name/!! (!!email/!!),
Thanks for visiting !!site/!!.
Hope you enjoyed your stay.
EOF
$message =~ s#!!(\w+?)/!!#$data{lc $1}#g;
print $message;
__END__
But perhaps you should have been using a hash all along, eh?
--
Good luck,
Abe
------------------------------
Date: 10 Jun 2000 11:46:02 -0500
From: "Ranyart Olias" <dilcher@cueva.com>
Subject: Help a newbie, do a good deed. Mail question....
Message-Id: <vgu05.18087$uO5.661418@sol.newscene.com>
I am trying to find a small snippet of code that can parse a text file,
(which happens to be a mail message body), and can extract the
plain text out (and discard any attachments, html, etc.).
For instance, I want to keep the section, below, beginning with
"Everything Andy posted" and ending with "Southeastern Cave
Conservancy", and discard all the rest.
Can anyone help?
------------------ message body ------------------------
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01BFD2CC.4A4EC1E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Everything Andy posted is true. I really wish he had not posted what he =
did about Byers. Any of you who are thinking about visiting the cave, =
please don't. Negotiations are very delicate. The owner of the entrance =
is obsessed about trespassers.
One incident right now could blow any chance of obtaining access to the =
natural entrance. Please stay away. Believe me, we are working on access =
right now.
Jim Wilbanks
Member, Board of Directors
Southeastern Cave Conservancy
------=_NextPart_000_000B_01BFD2CC.4A4EC1E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><STRONG>Everything Andy posted is true. =
I really=20
wish he had not posted what he did about Byers. Any of you who =
are=20
thinking about visiting the cave, please don't. Negotiations are very =
delicate.=20
The owner of the entrance is obsessed about=20
trespassers.</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>One incident right now could =
blow any=20
chance of obtaining access to the natural entrance. Please stay away. =
Believe=20
me, we are working on access right now.</STRONG></FONT></DIV>
<DIV><STRONG><FONT face=3DArial size=3D2>Jim Wilbanks<BR>Member, Board =
of=20
Directors<BR>Southeastern Cave =
Conservancy</FONT></STRONG></DIV></BODY></HTML>
------=_NextPart_000_000B_01BFD2CC.4A4EC1E0--
------------------------------
Date: Sat, 10 Jun 2000 16:44:12 GMT
From: bluecraft@hushmail.com
Subject: Hiding / Setting the text in the URL location bar of browser - how ?
Message-Id: <8htr8p$ch$1@nnrp1.deja.com>
Hi,
Can anyone tell me how to define the URL text in the location bar. If
for example I have a web form that sends input to a CGI, when it
returns it show the fields and data that were sent into the CGI, like:
http://www.mydomain.com/cgi-bin/search.pl?name=fred&password=1234
I want it on return to only show like:
http://www.mydomain.com/access
I remember a guy I knew (who got me into cgi years ago!) doing this
because he did not lik the 'messy' locations that showed up, now I want
to do the same - anyone have any thoughts of how to achieve this (apart
from using frames ... he didn't).
thanks,
J.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 10 Jun 2000 19:52:18 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Re: Hiding / Setting the text in the URL location bar of browser - how ?
Message-Id: <8htv75$i8t$1@news.online.de>
What about making a Frames-Page which is located at mydomain.com/access/ and
then have a CGI-Script generate 1 page of the frame? The other page is
hidden (eg it's 0 pixels high)... It should work, but I don't see the point
in doing so...
<bluecraft@hushmail.com> wrote in message news:8htr8p$ch$1@nnrp1.deja.com...
> Hi,
>
> Can anyone tell me how to define the URL text in the location bar. If
> for example I have a web form that sends input to a CGI, when it
> returns it show the fields and data that were sent into the CGI, like:
>
> http://www.mydomain.com/cgi-bin/search.pl?name=fred&password=1234
>
> I want it on return to only show like:
>
> http://www.mydomain.com/access
>
> I remember a guy I knew (who got me into cgi years ago!) doing this
> because he did not lik the 'messy' locations that showed up, now I want
> to do the same - anyone have any thoughts of how to achieve this (apart
> from using frames ... he didn't).
>
> thanks,
>
> J.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Sat, 10 Jun 2000 19:53:14 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Re: Hiding / Setting the text in the URL location bar of browser - how ?
Message-Id: <8htv8s$i9r$1@news.online.de>
ok, I missed the last section of your mail which said "apart from frames"...
Sorry! :-)
Raphael Pirker <raphaelp@nr1webresource.com> wrote in message
news:8htv75$i8t$1@news.online.de...
> What about making a Frames-Page which is located at mydomain.com/access/
and
> then have a CGI-Script generate 1 page of the frame? The other page is
> hidden (eg it's 0 pixels high)... It should work, but I don't see the
point
> in doing so...
>
> <bluecraft@hushmail.com> wrote in message
news:8htr8p$ch$1@nnrp1.deja.com...
> > Hi,
> >
> > Can anyone tell me how to define the URL text in the location bar. If
> > for example I have a web form that sends input to a CGI, when it
> > returns it show the fields and data that were sent into the CGI, like:
> >
> > http://www.mydomain.com/cgi-bin/search.pl?name=fred&password=1234
> >
> > I want it on return to only show like:
> >
> > http://www.mydomain.com/access
> >
> > I remember a guy I knew (who got me into cgi years ago!) doing this
> > because he did not lik the 'messy' locations that showed up, now I want
> > to do the same - anyone have any thoughts of how to achieve this (apart
> > from using frames ... he didn't).
> >
> > thanks,
> >
> > J.
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>
------------------------------
Date: Sat, 10 Jun 2000 19:12:38 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Hiding / Setting the text in the URL location bar of browser - how ?
Message-Id: <Pine.GHP.4.21.0006101905330.3434-100000@hpplus03.cern.ch>
On Sat, 10 Jun 2000 bluecraft@hushmail.com wrote:
> Can anyone tell me how to define the URL text in the location bar.
Can anyone tell me what relevance your question has to Perl?
Many browsers are designed to display the current URL.
> for example I have a web form that sends input to a CGI, when it
> returns it show the fields and data that were sent into the CGI, like:
>
> http://www.mydomain.com/cgi-bin/search.pl?name=fred&password=1234
That's the URL of a GET. The browser is displaying it. It can be
bookmarked, passed to another in email, etc.
> I want it on return to only show like:
>
> http://www.mydomain.com/access
It's no use just "want"ing. The whole point of that field is to
display the URL, not to display some fantasy of your own.
So if you want that to be the URL, then configure your server
accordingly. You'll need to review the difference between GET and
POST, of course (any reasonable elementary FORMs tutorial should do
that). The result can't be bookmarked, and would be inconvenient to
pass to another in email etc.
Whether GET or POST is the appropriate choice depends on a number of
other factors, any of which could be more relevant than your
dissatisfaction with the user seeing what they are getting.
f'ups set to more appropriate group.
------------------------------
Date: 10 Jun 2000 16:43:27 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Is it possible: Dumping Package Method Names
Message-Id: <8htr7f$r5v$1@newsflash.concordia.ca>
In article <Pine.GSO.4.10.10006100743100.10286-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
>On 10 Jun 2000, Josiah Bryan wrote:
>
>> I need to kow if there is a way to dump the
>> method names of a class?
>
>In general, no, since a class may AUTOLOAD any number of new methods upon
>demand. But OO-believers will tell you that everything you need to know
>should be in the documentation, else the class is still being written. :-)
If the module uses Exporter, examining @EXPORT, @EXPORT_OK, and %EXPORT_TAGS
should give you a list of all public methods, whether autoloaded or not.
(I think?)
Of course, if you wanted to get *all* methods, both public and private,
(you nasty peeping perl voyeur), you could do something idiotic like this:
#!/usr/bin/perl -w
# use strict; # yeah RIGHT
use CGI::Pretty;
my @pack = ('CGI::Pretty');
my %method;
for my $p (@pack) {
# hash slice assign to populate hash
@method{
# dump entire symbol space, grep for that which package can()
( grep $p->can($_), keys %{"${p}::"} ),
# standard Exporter stuff
@{"${p}::EXPORT"},
@{"${p}::EXPORT_OK"},
( grep !/^:/, map { @{$_} } values %{"${p}::EXPORT_TAGS"} )
} = ();
# do it all again for packages from which we inherit
push @pack, @{"${p}::ISA"};
};
print map { "$_\n" } sort keys %method;
I used CGI::Pretty because it's standard with perl and inherits from CGI.
This is just dumping all the package symbols, including methods and other
stuff, and filtering out that which the package can() do.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Sat, 10 Jun 2000 15:06:05 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Larry Rosler interview on perl.com!
Message-Id: <xPs05.110116$hT2.431098@news1.rdc1.ct.home.com>
lvirden@cas.org wrote:
> What perl implementations exist with differing behaviors? I thought that
> there was a single perl source tree which was then compiled on each platform.
> If that is the case, then the base perl code is the 'standard'. Why
> would someone want to spend several years of buracratic rigamarole to get
> an official 'stamp' confirming that the creator's text book on the workings
> of perl was in fact the standard?
Every major and minor version of perl behaves differently from every other
major and minor version of perl. (Wouldn't be much point in them
otherwise... :) Generally the big things don't change the way they act,
but there is wobble in a variety of the language features as well. I won't
argue for an ANSI standard per se, but a formal definition of the language
would make it less likely that you'd see that.
Dan
------------------------------
Date: Sat, 10 Jun 2000 17:18:24 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Larry Rosler interview on perl.com!
Message-Id: <B567F09F.5E5E%elaine@chaos.wustl.edu>
in article IMs05.110114$hT2.431098@news1.rdc1.ct.home.com, Dan Sugalski at
dan@tuatha.sidhe.org quoth:
> 5.005 introduced lock(). Broke some stuff, including some of the examples
> in the "Writing Apache Modules in Perl and C" book from O'Reilly.
This was due to OnePerl so I'm curious how, since it preceded the publishing
of that particular book by almost a year, it broke some of the examples.
e.
------------------------------
Date: Sat, 10 Jun 2000 17:40:18 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Larry Rosler interview on perl.com!
Message-Id: <64v05.110121$hT2.431406@news1.rdc1.ct.home.com>
Elaine Ashton <elaine@chaos.wustl.edu> wrote:
> in article IMs05.110114$hT2.431098@news1.rdc1.ct.home.com, Dan Sugalski at
> dan@tuatha.sidhe.org quoth:
>
>> 5.005 introduced lock(). Broke some stuff, including some of the examples
>> in the "Writing Apache Modules in Perl and C" book from O'Reilly.
> This was due to OnePerl so I'm curious how, since it preceded the publishing
> of that particular book by almost a year, it broke some of the examples.
There's an example in the book that has a sub named lock. Unfortunately
it's called before it's used, so perl calls the lock op instead. (lock,
being a weak opcode, will be used up until perl sees a definition of a sub
named lock, at which point it uses that instead) Found this one when doing
the port of mod_perl to VMS--threw the folks testing it for quite a loop.
Renaming the sub and its invocations fixed the problem. I don't know that
I ever filed a formal bug report or checked for errata with O'Reilly--I'll
have to go do that.
Why wasn't it noticed? Got me. The code still works, and maybe Lincoln was
pulling the examples from a system running perl 5.004 or something. Might
be that the code was reordered for publication and actually works in it
original form.
Dan
------------------------------
Date: Sat, 10 Jun 2000 09:48:06 -0600
From: "Bill Border" <bill_border@agilent.com>
Subject: Re: Moving from Unix to NT - sending mail
Message-Id: <8ht388$e25$1@nonews.col.hp.com>
I found a program called socketmail.pl which I ported
to work at our site:
Bill
#!/usr/local/bin/perl
####################################################################
#
# socketmail.pl
#
####################################################################
#
# Usage:
#
# socketmail.pl <Sender> <Recipient> <Subject> <Text>
#
# Where:
# <Sender> EMail address of sender
# <Recipient> Address of reciever
# -or-
# 'address1@my.com address2@my.com'
# <Subject> Message Subject (May be multiple words if quoted)
# <Text> Message Text (May be multiple words if quoted)
# -or-
# @Filename To Use File Contents
#
####################################################################
#
# Credits:
# This smtp socket script was created by Johnny Hughes 4/25/98 #
# http://ntperling.hypermart.net #
# Modified for Agilent by Bill Border 25Apr00
#
####################################################################
$P = "socketmail.pl";
#$emailfrom = 'abc@123.net';
#$recipient = 'def@123.net';
#$subject = 'This is a test mail';
#$message = 'This is a test message...did I get it';
$emailfrom = @ARGV[0];
$recipient = @ARGV[1];
$subject = @ARGV[2];
$messagein = @ARGV[3];
if (substr($messagein,0,1) eq "@")
{
$filename = substr($messagein,1);
print "$P | Message will be contents of $filename\n";
$message = `cat $filename`;
}
else
{
$message = $messagein;
}
$smtp_server = "curley.cos.agilent.com";
print "$P | emailfrom=$emailfrom\n";
print "$P | recipient=$recipient\n";
print "$P | subject=$subject\n";
print "$P | message=$messagein\n";
# See if there are multiple recipients
@words = split(" ",$recipient);
print "$P | Number of recipients: $#words+1\n";
&email;
sub email {
($x,$x,$x,$x, $here) = gethostbyname($null);
($x,$x,$x,$x, $there) = gethostbyname($smtp_server);
$thisserver = pack('S n a4 x8',2,0,$here);
$remoteserver = pack('S n a4 x8',2,25,$there);
#NOTE, if Solaris, uncomment the line below and delete the one below
it...leave alone for NT
#(!(socket(S,2,2,6))) && (&error("Connect error!"));
(!(socket(S,2,1,6))) && (&error("Connect error! socket"));
(!(bind(S,$thisserver))) && (&error("Connect error! bind"));
(!(connect(S,$remoteserver))) && (&error("!! connection to $smtp_server has
failed!"));
select(S);
$| = 1;
select(STDOUT);
$DATA_IN = <S>;
($DATA_IN !~ /^220/) && (&error("data in Connect error - 220"));
print S "HELO $ENV{COMPUTERNAME}.$ENV{USERDOMAIN}\r\n";
$DATA_IN = <S>;
($DATA_IN !~ /^250/) && (&error("data in Connect error - 250"));
print S "MAIL FROM:<$emailfrom>\n";
$DATA_IN = <S>;
($DATA_IN !~ /^250/) && (&error("'From' address not valid"));
foreach $rec (@words)
{
print S "RCPT TO:<$rec>\n";
print "$P | Sending to recipient: $rec\n";
$DATA_IN = <S>;
($DATA_IN !~ /^250/) && (&error("'Recipient' address not valid"));
}
print S "DATA\n";
$DATA_IN = <S>;
($DATA_IN !~ /^354/) && (&error("Message send failed - 354"));
# Send text of message
print S <<MESSAGES;
From: $emailfrom
To: $recipient
Subject: $subject
$message
.
MESSAGES
$DATA_IN = <S>;
($DATA_IN !~ /^250/) && (&error("Message send failed - try again - 250"));
print S "QUIT\n";
print "$P | Email sucessfully sent\n";
}
sub error
{
print "$P | ERROR Encountered: $_[0]\n\n";
exit 1;
}
Tom Bates wrote in message <73l4kssspu1rjfoofob22pl6sjjj3qv6rq@4ax.com>...
>I've used BLAT with great success.
>
>Tom
>
>On Wed, 07 Jun 2000 21:18:51 GMT, newsmay2000@ordinate.co.uk (Ben
>Hambidge) wrote:
>
>>I have to move my CGI script from a Unix web server to a WinNT server.
>>I send mail by piping to /usr/lib/sendmail using
>>open(MAIL,"|/usr/lib/sendmail $recipient");
>>
>>What do I need to do to acheive the same effect in Windows?
>
------------------------------
Date: Sat, 10 Jun 2000 12:35:12 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Need a hand with this piece of code......
Message-Id: <39426E40.A07AB13D@attglobal.net>
root@rady.zzn.com wrote:
>
> foreach $match (@matches){
> ($category,$item,$mfg) = split(/\|/, $match);
> print Tr(td[$category, $item]);
> }
>
> Can anyone suggest a way I can create a hyperlink in line 3 so the
> value of $item is returned to the browser as a link pointing to an URL?
>
Maybe it would be easier if we knew what $item might contain?
------------------------------
Date: Sat, 10 Jun 2000 17:19:20 GMT
From: Brian Alexander Booden <ceebb@cee.hw.ac.uk>
Subject: new CGI objects in same CGI script
Message-Id: <Pine.SUN.3.95.1000610181405.4413B-100000@brahma>
I am trying to create a new CGI object in a Perl script. Currently, my script generates an HTML table of results from a Perl array called @results. However, after i get this table of results, i want the user to be able to send results to themselves by e
mail. my question is how do i set up a button (or can i) so thati can call a function in the same CGI script (say the function is called sendit)? Bearing in mind that i need all of the Perl arrays i have created so far, so calling another script althoug
h easier, wouldnt solve my problem.
Im quite new to Perl, so any help would be appeciated.
Cheers,
Brian Booden
ceebb@cee.hw.ac.uk
------------------------------
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 3311
**************************************