[11673] in Perl-Users-Digest
Perl-Users Digest, Issue: 5273 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 31 23:07:29 1999
Date: Wed, 31 Mar 99 20:00:16 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 31 Mar 1999 Volume: 8 Number: 5273
Today's topics:
Re: <STDIN> <cassell@mail.cor.epa.gov>
Almost a disaster <bullock@toolcity.net>
Re: CGI help. <cassell@mail.cor.epa.gov>
create html <jearanai@science.gmu.edu>
Re: dumping db header row before display <cassell@mail.cor.epa.gov>
Re: Help...me about array... (Sam Holden)
More: Opening >2Gb files on AIX <rong@prth.tensor.pgs.com>
newb quest about perl builds for win32 -- how to start? (Davekonz)
Re: newb quest about perl builds for win32 -- how to st <gregm@well.com>
Re: newb quest about perl builds for win32 -- how to st (Bob Trieger)
Re: Newbie questions... <cassell@mail.cor.epa.gov>
Re: Perl calling MS Word <charles_radley@mentorg.com>
Re: Perlshop <cassell@mail.cor.epa.gov>
Re: problems with 'require'. (Tramm Hudson)
Re: problems with 'require'. (Sam Holden)
quick question... <jearanai@science.gmu.edu>
Re: random elements from an array <cassell@mail.cor.epa.gov>
Re: Regex with lookahead help <cassell@mail.cor.epa.gov>
Re: Regex with lookahead help (Sam Holden)
Re: Send Mail <aperrin@mcmahon.qal.berkeley.edu>
Subst some strings with '$xxx chanwit@my-dejanews.com
Re: two questions need help (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 31 Mar 1999 17:41:39 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: <STDIN>
Message-Id: <3702CED3.96458FD8@mail.cor.epa.gov>
Bob Trieger wrote:
> "Elliot Slater" <eslater@frinc.com> wrote:
> <>Am I able to assign a value to <STDIN> as I would any other variable?
>
> Any other variable? <STDIN> in a filehandle, not a variable. BIG difference.
Actually, the problem is even worse than that. <STDIN> is
the line input *operator* evaluating a filehandle. And <> is
one of the many operators you cannot assign to. Not that you
would ever want to write to STDIN anyway. That's what
print STDOUT "blah blah blah \n";
is for.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 31 Mar 1999 22:40:07 -0500
From: Ben Bullock <bullock@toolcity.net>
Subject: Almost a disaster
Message-Id: <3702EA97.E4C6FCAB@toolcity.net>
As part of a script to automate adding users to a system running
Solaris 2.5.1, I had a couple of lines of code that essentially looked
like this:
$home_dir="/home/username";
system("chmod 711 $home_dir");
When this script executed, it not only changed permissions on the new
user's home directory to 711, but it also changed the permissions to
711 on "/". And that caused some problems, like the inability for
normal users to look at man pages, run simple commands like 'pwd',
etc. After the permissions on / were changed back to the original
755, everything was normal.
I know I could have used something like this for changing permissions:
@filelist="/home/username";
chmod(0711, @filelist);
but why did the original script give such an unexpected result? BTW,
the perl interpreter is an older version, 5.003 IIRC.
Thanks for any light you can shed on this question.
-Ben Bullock
------------------------------
Date: Wed, 31 Mar 1999 17:33:04 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: CGI help.
Message-Id: <3702CCD0.3AC0121E@mail.cor.epa.gov>
mircea@earthlink.net wrote:
> I created a script in CGI and a form in html. The server gave me an "absolut
> path" which is home2/yourdomainname/webdocs and also they gave me a "send
> mail dir" which is usr/sbin/sendmail and they told me that these should be
> placed in my html form. I don't know where exactly I should place them and
> what the tags will be. They should send the form to the cgi script in cgi-bin
> folder.
> If this is not the apropriate forum discussion, please kindly direct me there.
Okay, since you asked so nicely, this is definitely not a Perl problem, even if
you're doing some coding in Perl. But try the nice folks at
comp.infosystems.www.authoring.cgi and maybe you'll get more help.
> Thank you very much, Mitch
You're welcome,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 02:51:48 GMT
From: apple <jearanai@science.gmu.edu>
Subject: create html
Message-Id: <7dun01$3g1$1@nnrp1.dejanews.com>
Can I create a html file from my perl file without usong CGI?
--apple
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 31 Mar 1999 17:29:15 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: dumping db header row before display
Message-Id: <3702CBEB.F7426C8C@mail.cor.epa.gov>
Larry Rosler wrote:
> [snip]
> next if $. == 1;
>
> because you want to continue processing the rest of the input, not
> abandon it.
>
> David L. Cassell proposed this:
>
> >> print "html_chazerai" if $. > 1;
> >> The $. variable tracks the record number for you.
>
> My problem with these approaches is that it adds processing inside the
> loop, no matter how trivial. The simple "read and discard the first
> line before entering the loop" seems cleaner logically.
Yep. Good point. I thought Sam Holden's solution was better
than mine also. At least you're not correcting my spelling
of 'chazerai'. We wouldn't want to give Dav the wrong impression
about us. :-)
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Apr 1999 01:08:24 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help...me about array...
Message-Id: <slrn7g5ho8.5ah.sholden@pgrad.cs.usyd.edu.au>
On Thu, 01 Apr 1999 00:17:03 GMT, apple <jearanai@science.gmu.edu> wrote:
>I am really new for perl. When I read the data from a catalog file. How can I
>get the name of my catagory in the array format like : name(1)=apple,
>name(2)=cheery,name(3)=orange...( I ever use in C )
>Now I can only read it in the string format which have $name.
>-------perl----------------
>sub catagory
>{
>open (WORDSLIST,"catalog")||
> die "catn't open catalog: $!";
> while (defined ($name=<WORDSLIST>))
> {
> chomp($name);
> print "$name\n";
> }
>close (WORDSLIST) ||
> die "couldn't close catalog: $!";
>}
instead of the while use something like :
@name = <WORDSLIST>;
chomp @names;
or instead of the print use
push @name, $name;
The array will start at $name[0] though not $name[1].
You really should read perlsyn and perlop (and the rest of the
documentation that comes with perl).
--
Sam
Many modern computer languages aspire to be minimalistic. They either
succeed in being minimalistic, in which case they're relatively useless,
or they don't succeed in being truly minimalistic, in which case you can
actually solve real problems with them. --Larry Wall
------------------------------
Date: Thu, 1 Apr 1999 10:20:54 +0800
From: Ron Grunwald <rong@prth.tensor.pgs.com>
Subject: More: Opening >2Gb files on AIX
Message-Id: <Pine.SOL.3.96.990401101449.10484C-100000@swan>
Hi Clinton and all others,
On Wed, 31 Mar 1999, Clinton Pierce wrote:
> >I've recently come across a problem where my Perl script attempts
> >to open a file of around 2.2Gb in size. It couldn't do it.
> >Files below 2Gb in size do open successfully. I've used the open ()
> >and sysopen () Perl functions for this.
> >
> >The operating system that the script runs on is AIX 4.2.1, which
> >does support file sizes of > 2Gb. The Perl release that I'm using
> >is 5.004.
>I had a similar problem a while ago. I got rid of it by re-compiling and
>re-linking perl under AIX 4.2. It's not perl's fault, it was probably
>compiled when the underlying OS/Libraries only supported <2GB.
>
>It's time to get a newer version of Perl anyways. :-)
We recently compiled the development release of Perl (5.005pl54) under
AIX, and it was definitely AIX 4.2. I ran the script with that version
of Perl, but the file still couldn't be opened.
The $OS_ERROR gives the message:
The user ID or group ID is to large to fit in the provided structure.
The compiler that was used to build Perl was IBM's xlC release 3.1.4.
Clinton, do you remember whether you had to specify a special switch
for the xlC compiler to include large file structures ?
Again, any suggestions are most welcome.
Regards, Ron.
--------------------------------------------------------------------------
Ron Grunwald | Usual E-mail rong@prth.pgs.com
UNIX Programming Section | Alternate E-mail r.grunwald@usa.net
PGS Tensor Pty. Ltd. | Work Tel. 011 618 9320 9029
Petroleum Exploration and | IBM Centre, Perth
Seismic Processing. | Western Australia
--------------------------------------------------------------------------
------------------------------
Date: 1 Apr 1999 01:22:23 GMT
From: davekonz@aol.com (Davekonz)
Subject: newb quest about perl builds for win32 -- how to start?
Message-Id: <19990331202223.15318.00000518@ng-cc1.aol.com>
First off I've never used perl before on any platoform...
Now for da question:
I've just downloaded & installed build 509 for win32 from www.activestate.com,
ie: a free ware version for windows, cool.
However when I go to Start->Programs->ActivePerl folder that got installed the
only item in there is "Onilne Documentation"
So da questions are:
a) does that sound right?
b) how to I run something like hello world ?
Shouldn't there be an interpreter that I need to start or something?
Told ya I ver a new b :)
Thanks
Dave Konz
------------------------------
Date: Wed, 31 Mar 1999 18:14:29 -0800
From: Greg McCann <gregm@well.com>
Subject: Re: newb quest about perl builds for win32 -- how to start?
Message-Id: <3702D685.500347CF@well.com>
I installed mine from the O'Reilly Win32 Perl Resource Kit, so my setup won't be
exactly the same as yours but look and see if you have a C:\Perl subdirectory that
you didn't have before. And if you're lucky, the installation will have also added
a couple of perl directories to your path.
You will generally run perl from the command prompt so I wouldn't expect to see any
more than you have in your Start/Run/ActivePerl menu.
Someone more familiar with this particular installation may correct me if I'm
wrong.
Greg
Davekonz wrote:
> First off I've never used perl before on any platoform...
>
> Now for da question:
>
> I've just downloaded & installed build 509 for win32 from www.activestate.com,
> ie: a free ware version for windows, cool.
>
> However when I go to Start->Programs->ActivePerl folder that got installed the
> only item in there is "Onilne Documentation"
>
> So da questions are:
>
> a) does that sound right?
> b) how to I run something like hello world ?
>
> Shouldn't there be an interpreter that I need to start or something?
>
> Told ya I ver a new b :)
>
> Thanks
> Dave Konz
--
======================
Gregory McCann
http://www.calypteanna.com
"Be kind, for everyone you meet is fighting a great battle." Saint Philo of
Alexandria
------------------------------
Date: Thu, 01 Apr 1999 02:35:14 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: newb quest about perl builds for win32 -- how to start?
Message-Id: <7dulur$7g3$1@ash.prod.itd.earthlink.net>
davekonz@aol.com (Davekonz) wrote:
\>First off I've never used perl before on any platoform...
\>
\>Now for da question:
\>
\>I've just downloaded & installed build 509 for win32 from www.activestate.com,
\>ie: a free ware version for windows, cool.
\>
\>However when I go to Start->Programs->ActivePerl folder that got installed the
\>only item in there is "Onilne Documentation"
\>
\>So da questions are:
\>
\>a) does that sound right?
\>b) how to I run something like hello world ?
Did you consider reading that "Onilne Documentation"?
My money says that you'll probably find your answers there.
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: Wed, 31 Mar 1999 17:22:47 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Newbie questions...
Message-Id: <3702CA67.B1E3AE70@mail.cor.epa.gov>
F. wrote:
> Hello Hendrik,
>
> I presume you are using NTServer as a host for your pages because you want
> to use Access.
> ASP (Active Server Pages) is better than Perl if you are using Access.
Errm, ASP and Perl are not equivalent. ASP is not *better* [or worse]
than Perl. It is in a different functional space. If you're using ASP, you
can use PerlScript or VBScript or JavaScript or... Base testing reported
in the last week or two on the win32-perl-users listserv suggests that
PerlScript may be the way to go. But check out their benchmarks and decide
for yourself. YMMV.
> The Internet Information Server has ASP.
And will run PerlScript. Or JavaScript. Or whatever. [Once it is set up
properly.]
> You can find good documentation about ASP here:
> http://www.15seconds.com/
> http://www.activeserverpages.com/learn/
>
> If you're sure that you want to use Perl then you can find all the answers
> here:
> http://www.perl.com
Then be sure to look at the list of CGI-related URLs given in the Perl
FAQ.
> Grtz,
>
> Frank.
>
> Henrik Widenfors wrote in message <3701F14A.D88@student.hk-r.se>...
> >Hi
> >
> >Notice: I4ve never done Perl or CGI programming before.
> >
> >1. I4m supposed to do a homepage with a form that a visitor can fill in.
> >Then a e-mail is supposed to be sent to a sertain e-mail adress
> >containing what the visitor just wrote (name, address and comments etc).
> >How can this be done? I know that I must (or?) use a CGI script. But how
> >do I make my owne CGI-script? Do I have to use Perl? What is the most
> >common to use in this situation? What would YOU suggest?
> >
> >
> >2. How can I make a HTML page access a Database (for example : MS Access
> >or FileMakerPro) located on the same server as the HTML page? Can YOU
> >give a basic explaination.
> >Here what I think about it so far (please correct me) : I use a
> >HTML-page and in this page I call my CGI-script. From the CGI-script I
> >access the Database. Can the CGI-script forwad data loacated in the
> >Database to the HTML-page? What4s the difficulties in building a
> >application like this? Where do YOU think I have to spend the most time?
> >
> >
> >Any suggestions and answer would be greatly appretiated. Thanks
> >
> >Please email to : pt98hwi@student.hk-r.se aswell
> >
> >
> >/ Henrik Widenfors
HTH,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 31 Mar 1999 16:50:37 -0800
From: Charles Radley <charles_radley@mentorg.com>
To: Bob Daly <bdaly@averstar.com>
Subject: Re: Perl calling MS Word
Message-Id: <3702C2DD.69EA4711@mentorg.com>
Common problem is assuming that it is in the path. Perl does not use
the system path.
Try giving the FULL path to the executable in the system call.
Do a right mouse click on your MSWord icon and check the properties for
the full path.
Remember that the backslash character \ must be escaped, i.e. \\
e.g. C:\\ProgramFiles\\MSOffice\\word.exe
Both exec and system should work fine.
Bob Daly wrote:
>
> Does anyone know how to call Word in Perl? I've tried the exec and
> system commands but nothing seems to work. Also, can commands within
> Word be executed, i.e. mail merge?
>
> Thanks,
>
> Bob Daly
------------------------------
Date: Wed, 31 Mar 1999 17:26:26 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Perlshop
Message-Id: <3702CB42.5A2287ED@mail.cor.epa.gov>
Nico Oosterwijk wrote:
> Is there anyone out there who can help me with the perlshop.cgi file from
> Arpanet? I'm new to perl and need help to resolve an error message.
> tia,,
>
> Nico Oosterwijk
Are you sure it's a Perl error message? All the Perl error messages are
given (with detailed explanations) in the perldiag manpage. So either
type 'perldoc perldiag' at a command prompt to scan through it, or use
the html version of the docs and click on 'perldiag'.
We could be of more help if you told us what the error message *was*,
you know. It might not be Perl at all. It might be the server, or a
cgi problem, in which case this really isn't the newsgroup to go to
for help...
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 31 Mar 1999 17:49:04 -0700
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: problems with 'require'.
Message-Id: <7dufq0$92m@boofura.swcp.com>
[cc'd to cited author]
Aaron Tavistock <APTavistock@lbl.gov> wrote:
> I improperly assumed that require was essentially a stream based eval.
> :) Which is how I came to a brute force solution that works as well.
>
> open (CONF, './test.conf);
> eval (join ("\n", <CONF>));
> close (CONF);
Wow. While, yes that does work, you should check out perldoc -f do
which tells you that
do 'test.conf'
is equivilant to
scalar eval `cat test.conf`
Tramm
--
o hudson@swcp.com tbhudso@cs.sandia.gov O___|
/|\ http://www.swcp.com/~hudson/ H 505.266.59.96 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.284.24.32 \ \/\_\
0 U \_ |
------------------------------
Date: 1 Apr 1999 03:05:11 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: problems with 'require'.
Message-Id: <slrn7g5oj7.93a.sholden@pgrad.cs.usyd.edu.au>
On 31 Mar 1999 17:49:04 -0700, Tramm Hudson <hudson@swcp.com> wrote:
>[cc'd to cited author]
>
>Aaron Tavistock <APTavistock@lbl.gov> wrote:
>> I improperly assumed that require was essentially a stream based eval.
>> :) Which is how I came to a brute force solution that works as well.
>>
>> open (CONF, './test.conf);
>> eval (join ("\n", <CONF>));
>> close (CONF);
>
>
>Wow. While, yes that does work, you should check out perldoc -f do
>which tells you that
>
> do 'test.conf'
>
>is equivilant to
>
> scalar eval `cat test.conf`
There are a couple exceptions listed in the docs however. One of which
makes it unsuitable for this case :
It is also different in how code evaluated with
C<do FILENAME> doesn't see lexicals in the enclosing
scope like C<eval STRING> does.
--
Sam
Basically, avoid comments. If your code needs a comment to be
understood, it would be better to rewrite it so it's easier to
understand. --Rob Pike
------------------------------
Date: Thu, 01 Apr 1999 03:24:43 GMT
From: apple <jearanai@science.gmu.edu>
Subject: quick question...
Message-Id: <7duoti$50k$1@nnrp1.dejanews.com>
How can I create a HTML file by using Perl in case of I don't want to use CGI?
--apple
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 31 Mar 1999 17:08:13 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: random elements from an array
Message-Id: <3702C6FD.688CBF3A@mail.cor.epa.gov>
David Alan Black wrote:
>
> Hello -
>
> "TinP" <tgj@snip..net> writes:
>
> >How can you take a random element of an array yet not randomly choose it
> >again?
>
> >I want to simulate some cardgames and I set up an array called @cards
> >("Ad","2d","3d", etc for 52 elements
> >(to let you know: Ad = Ace of Diamonds 2d = 2 of Diamonds......)
>
> >What I want to do is grab a random element but not repeat it. I can do that
> >but I would like to know how I can "Deal a hand" without repeating an
> >element I already chose.
>
> One way would be to randomize the whole deck, and then deal from it.
> Here's an implementation of that approach:
>
> #!/usr/local/bin/perl -w
>
> use strict;
>
> # Regular deck:
> my @cards = map{my $s=$_;map{"$_$s"}('A',2..10,qw(J Q K))}qw(d c q s);
>
> # Create a list of numbers 0..51, in random order.
> my @ord = (0..51);
> my @mixed;
> while (@ord) { push @mixed, splice (@ord, int(rand(@ord)), 1) }
>
> # Shuffle the deck.
> my @shuf = @cards[@mixed];
>
> # Deal a hand, removing the cards from the deck (no danger of repeating)
> my @hand = splice (@shuf, 0, 5);
> print join "\n", @hand, "";
> __END__
>
> (You could modify that to just choose a hand randomly from the ordered
> deck, of course.)
>
> David Black
> dblack@pilot.njin.net
Isn't this quadratic in N ? There's a better algorithm in the
FAQ (as of 5.005). The Yates-Fisher algorithm. And since it has
two statisticians in the name, it *must* be good. :-)
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 31 Mar 1999 17:02:10 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Regex with lookahead help
Message-Id: <3702C592.E99BA086@mail.cor.epa.gov>
Arthur Newhall wrote:
> Hi all,
>
> I am having trouble creating a regex to do this
> "match everything up to the first % that isn't preceded by a \"
>
> I seem to be able to do this with a loop, split,... but I would
> rather use a regular expression.
>
> This is my problem and what I have come up with so far:
>
> $a = 'aa\%bbb%ccc';
>
> ($good) = $a =~ /^(.*)(?!\\)%/;
> print "found: $good \n\n";
>
> It works correctly for such things as:
>
> aaa%bbb --> aaa
>
> %aaa --> nul
>
> aaa\%bbb%ccc --> aaa\%bbb
>
> However, it doesn't work correctly for:
>
> aaa%bbb%ccc --> aaa%bbb
Wait. Shouldn't this be "aaa%bbb%ccc --> aaa" ?
You want to match up to the first '%', right?
Or do I have this totally wrong?
> aaa\%bbb --> aaa\
>
> It seems like this should be an easy problem to solve but I am
> running into a brick wall. Any suggestions on how to do this
> would be greatly appreciated!
It may be that you're trying a little too hard. You don't
need to incorporate negative or positive lookahead. You don't
even want to look 'ahead' of the '%'. You just want to check
the character you just walked over. So something like this:
/^(.*?[^\\])%/
should do it. Start at the beginning, swallow everything
non-greedily up to the '%', making sure that the previous
character does *not* match '\'.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Apr 1999 03:09:18 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Regex with lookahead help
Message-Id: <slrn7g5oqu.93a.sholden@pgrad.cs.usyd.edu.au>
David L. Cassell <cassell@mail.cor.epa.gov> wrote:
>Arthur Newhall wrote:
<snip matching up to first non backslashed % stuff>
>
>It may be that you're trying a little too hard. You don't
>need to incorporate negative or positive lookahead. You don't
>even want to look 'ahead' of the '%'. You just want to check
>the character you just walked over. So something like this:
>
> /^(.*?[^\\])%/
>
>should do it. Start at the beginning, swallow everything
>non-greedily up to the '%', making sure that the previous
>character does *not* match '\'.
What do you think would happen if % was the first character on the line...
Look behind provides a reasonably readable solution (it gets a little
harder when you include the posibility for \\ being a single \ but that
wasn't mentioned anyway.
--
Sam
You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
Python. This is Officially Okay in Perl culture.
--Larry Wall
------------------------------
Date: Wed, 31 Mar 1999 17:07:27 -0800
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: Greg Griffiths <greg2@surfaid.org>
Subject: Re: Send Mail
Message-Id: <3702C6CF.E13D474C@mcmahon.qal.berkeley.edu>
[posted & sent via e-mail]
You're correct that it's because sendmail is (usually) run under unix, and
unless you've done something very unusual you don't have a /usr/lib/sendmail
running on your Windows machine. In general I think the Right Way to solve your
problem is to use the Mail::Internet module from CPAN; however, I have a
sneaking suspicion that this qualifies as a "fancy Perl module." I can think of
two other options if either works; I suspect there are more.
1.) Get some tool like NetMail95 (see
http://www.geocities.com/SiliconValley/Lakes/2382/netmail.html ) which will send
e-mail from DOS/Windows given a specific file format; your script can then just
system() to it to send your maill. However, if your system won't allow fancy
perl modules it probably won't allow netmail. So, the only other thing I can
think of is a real pain...
2.) Essentially rewrite Mail::Internet inside your own code. This will have to
include using raw socket code to contact your mail server; it will be difficult
and far too much work (in my opinion); however, it will meet your requirements
of (1) getting the job done; and (2) not installing anything "else" where "else"
refers to anything not either your Perl script or the Perl binary.
Hope this helps-
Andy Perrin
Greg Griffiths wrote:
> Dear All,
> everytime I try and use the sendmail prog that is listed in the PERL
> faq's :
>
> $mailprog = '/usr/lib/sendmail -oi -t -odq';
> open (MAIL, "|$mailprog") || die "Can't open $mailprog!\n";
> print MAIL "To: $To ($ToEmail)\n";
> print MAIL "Reply-to: CILP Staff Member ($FromEmail)\n";
> print MAIL "Subject: $Subject\n\n";
> print MAIL "$From on behalf of The Christian Internet Links Project
> sends you this Message \n";
> print MAIL "$Message \n";
> print MAIL "Christian Internet Links Project \n";
> print MAIL "http://www.aber.ac.uk/~scty12/links/";
> close (MAIL);
>
> I get the message
>
> Bad Command or File Name
>
> Any idea why, I assume that it is because the command is a Unix command
> and I'm using the Win32 PERL, is there an alternative without using any
> fancy Perl modules as my server won't llow any extras ?
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Thu, 01 Apr 1999 03:30:23 GMT
From: chanwit@my-dejanews.com
Subject: Subst some strings with '$xxx
Message-Id: <7dup8g$5dv$1@nnrp1.dejanews.com>
Hi,
How to subst some strings with '$xxx'?
I've tried $str =~ s/mystr/\$xxx/g
but it does not work.
Any idea?
Best regards,
Chanwit Kaewkasi
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 1 Apr 1999 01:13:00 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: two questions need help
Message-Id: <slrn7g5i0s.5ah.sholden@pgrad.cs.usyd.edu.au>
On Thu, 01 Apr 1999 00:18:31 GMT, Bob Trieger <sowmaster@juicepigs.com> wrote:
>fanxin@my-dejanews.com wrote:
>/>Hi all experts: there has two questions: 1. i have downloaded almost all
>/>mailing list cgi script on the net. all of them are almost same. a loop
>/>invokes sendmail once by once. the mail is send by openning a pipe from the
>/>script to sendmail. BUT! this doesn't work when the list is very long.
>/>eg.5000 the loop will only go about 25-30 times when it needs to go 5000
>/>times. if the list is reduced to 100. the program works fine. is there
>/>anything wrong with the system? there has no process at all when the loop
>/>hasn't finished. so how to write a mailing list cgi program for huge list,
>/>like 10000 emails.
>
>I hope you never figure it out. There is no legitimate reason in the world to
>send over 5000 e-mails.
I can think of a few off the top of my head.
A mail from say Bill Gates to all his employees ranting about some corporate
policy.
A mail from AOL to all their subscribers informing them about some scheduled
outage.
The mailing list for a very large discussion list.
A large university faculty sending enrollment information email to all
it's students.
--
Sam
You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
Python. This is Officially Okay in Perl culture.
--Larry Wall
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5273
**************************************