[8770] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2387 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 22 13:31:55 1998

Date: Wed, 22 Apr 98 10:28:11 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 22 Apr 1998     Volume: 8 Number: 2387

Today's topics:
        Removing spaces from a variable, how? <ben@wallroyds.demon.co.uk>
    Re: Removing spaces from a variable, how? (Craig Berry)
    Re: RFC: Adding Commands in Filehandles... <repost> (Jonathan Stowe)
    Re: RFC: Adding Commands in Filehandles... <repost> (Tanstaafl)
    Re: RMS should be invited to O'Reilly's "Free Software  (Chris Nandor)
    Re: running system command (Martien Verbruggen)
        Sending a text file via perl <Glenn.J.Schworak@state.or.us>
    Re: Sending a text file via perl <robban@it-konsult.com>
    Re: Sendmail Attach <tchrist@mox.perl.com>
        SendMail on NT <coryj@***NOSPAM***i-check.net>
    Re: SendMail on NT <sowmaster@juicepigs.com>
    Re: SendMail on NT <elssa09@callisto.si.usherb.ca>
    Re: SendMail on NT (Martin Vorlaender)
    Re: sendmail <beske@worldnet.att.net>
    Re: sendmail (Craig Simpson)
    Re: sendmail <mikel@ap.net>
        Serial Dates <snx@snx.com>
    Re: Serial Dates <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Serial Dates (Mark-Jason Dominus)
        Setting environment variables <jespray@one.net>
        Setuid is dangned near impossible <kermit@ticnet.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 22 Apr 1998 06:24:22 +0100
From: "bjf" <ben@wallroyds.demon.co.uk>
Subject: Removing spaces from a variable, how?
Message-Id: <893222683.6503.0.nnrp-06.c2de5b4a@news.demon.co.uk>

Hiya!

How do you remove all spaces ... ie ... " " .... from a variable using
pattern-matching?

Thank you for reading this.

B.




------------------------------

Date: 22 Apr 1998 07:03:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Removing spaces from a variable, how?
Message-Id: <6hk4nq$fp7$1@marina.cinenet.net>

bjf (ben@wallroyds.demon.co.uk) wrote:
: How do you remove all spaces ... ie ... " " .... from a variable using
: pattern-matching?

This is actually a much better job for tr:

  $var =~ tr/ //d;

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Sun, 19 Apr 1998 21:58:56 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: RFC: Adding Commands in Filehandles... <repost>
Message-Id: <353a5c87.2170800@news.btinternet.com>

On Sun, 19 Apr 1998 11:03:22 GMT, Tanstaafl@geocities.com (Tanstaafl)
wrote:

<snip>

>	"Teach yourself CGI programming with Perl in a week." Not that
>I think I can learn it in a week, but I'm on Day 3 (Sixth chapter) and
>it's only been a month. This is suppossed to be my ump into Perl...
>

Eh,oh. 

Whilst i wouldnt want to cast any undue aspersions I would like to
point out that I for one have seen a number of dubious examples quoted
from this book.  I would also suggest that the enterprise as set out
in this title is perhaps a little, shall we say, over-reaching.
>

>
>	ISBN please... (What's this thing with Llama's???)

1-56592-042-2

/J\
Jonathan Stowe
See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm


------------------------------

Date: Mon, 20 Apr 1998 07:05:28 GMT
From: Tanstaafl@geocities.com (Tanstaafl)
Subject: Re: RFC: Adding Commands in Filehandles... <repost>
Message-Id: <353ef376.1873791@news.xs4all.nl>

With great joy and love, Gellyfish@btinternet.com (Jonathan Stowe)
wrote:

>Eh,oh.=20
>
>Whilst i wouldnt want to cast any undue aspersions I would like to
>point out that I for one have seen a number of dubious examples quoted
>from this book.  I would also suggest that the enterprise as set out
>in this title is perhaps a little, shall we say, over-reaching.

I know that, that's why I wrote:

	"Not that I think I can learn it in a week, but I'm on Day 3
(Sixth chapter) and it's only been a month. This is suppossed to be my
jump into Perl..."
blaze your trail!
--
David Dune

=46orgive my questions, I'm a newbie.
Unsolicited commercial email read for $500 per message.


------------------------------

Date: Mon, 20 Apr 1998 08:17:54 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <pudge-2004980818100001@ppp-21.ts-1.kin.idt.net>

In article <m3k98qmyvh.fsf@stoli.spirits.org.au>, nathanh@chirp.com.au wrote:

# Your other licenses allow free code to be hoarded. The GPL takes a
# firm *positive* stance against hoarding by requiring that GPL code
# must never be distributed non-freely.
# 
# None of the other licenses guarantee this, therefore all the other
# licenses are inferior.

Maybe that is exactly what makes GPL inferior.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


------------------------------

Date: 19 Apr 1998 23:34:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: running system command
Message-Id: <6he1ma$ilh$1@comdyn.comdyn.com.au>

> $cmd = "zip outfile infile";
> system $cmd;
> 
> with and without backticks, etc. Nothing I try creates the zip file,
> although the script runs. 

You mentioned that you run this as a CGI script: You should read the
(please don't be offended by the name) Idiot's guide to solving
perl/CGI problems: http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html

The clue most likely is that the the perl script is executed in a
totally different environment than yours. It's a different user, The
env variable are different, and the path will be different. There is
no guarantee at all that your script can find zip in the path
anywhere. There is no guarantee that zip can write the files it needs. 
Use system, use full paths, make sure the permissions are ok, and
CHECK the return value of system.

Martien

PS. Please bookmark http://language.perl.com/faq/index.html, and at
least have a look at what's there.

-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | I think I think, therefore I think I
Commercial Dynamics Pty. Ltd.       | am.
NSW, Australia                      | 


------------------------------

Date: Wed, 22 Apr 1998 00:55:23 GMT
From: Glenn Schworak <Glenn.J.Schworak@state.or.us>
Subject: Sending a text file via perl
Message-Id: <353D3FE8.94951DB@state.or.us>

I have this chunk of perl code that works great under Netscape but
InterNet Explorer 4.0 loses its mind when it starts to download.

This code will take the file name from the web page and then tack on the
content-type header to get the web browser to start downloading (rather
than displaying it).

Internet Explorer starts to download, then says "can't open bla bla
bla..." and if I click the box again, it creates some huge file that
eats my entire hard drive. The file I am testing with is only 2k in size
and is pure text no characters outside of the visible range except for
spaces. And as I mentioned, it works just fine when using Netscape. It
downloads properly.

Any ideas on how to get InterNet Explorer to work right? Maybe by
changing the header info?


---------------> Actual Code <----------------

use CGI;
$temp = new CGI;
@file_list = split(/\s+/,$temp->param('files'));   # get a list of all
files to be downloaded

foreach $file (@file_list)
{
    $file_name = $file;
    $file_name =~ s/\A\S*(\\|\/)//;     # Strip off any path reference

    print "Content-type := application/octet-stream\n";
    print "Content-disposition := filename=\"$file_name\"\n";
    print "\n";
    open (DOWNLOAD_FILE, $file);
    while (@line = <DOWNLOAD_FILE>) { print $line }
    close (DOWNLOAD_FILE);
    print $boundry;
}




------------------------------

Date: 22 Apr 1998 12:56:57 GMT
From: "Robert Friberg" <robban@it-konsult.com>
Subject: Re: Sending a text file via perl
Message-Id: <01bd6dee$176e71c0$c82da8c0@robban.ittek.org>



>     print "Content-type := application/octet-stream\n";
                         ^^^
                         |||
	Any decent browser should choke on this, remove the 
	equal sign and the first space! Same procedure on the
	next header. (No gaurantee that this is your only problem)

	If you have more questions on http-headers or the CGI-spec
	try the newsgroup comp.infosystems.www.authoring.cgi

/Robban	




------------------------------

Date: 21 Apr 1998 23:13:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Sendmail Attach
Message-Id: <6hj96m$2df$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Bob Trieger <sowmaster@juicepigs.com> writes:
:Buzzzz!  MIME could careless what operating system he is using.

The quick-to-buzzzz should be rather more careful about who cares--or
does not care as the case would appear to be--than you have been, for
They Who Buzz shall to a higher standard of orthographic rigor be held.

If you would with tender care look upon this simple pair:

    MIME could    care less about the operating system.
    MIME couldn't care less about the operating system.

As you can plainly see, these two sentences clearly have meanings
diametrically opposed to one another.  However, despite their direct
and obvious meanings, you for no reason beyond being perchance somewhat
quicker to type than to reason seem to have carelessly chosen the wrong
one--unless, of course, you should happen to be stating that MIME in
fact cares so very much about one's wretched operating system that it
could stand to care a tad less.  And while I don't think that's what
you meant, that is certainly what you said.

And speaking of carelessness, I think you need to inspect your space bar,
for it appears to be slacking off from its rightful duties when it comes
to the matter of separating "care" and "less" in your aforecited utterance.

--tom, who watches the watchers

-- 
	Tom Christiansen	tchrist@jhereg.perl.com

Fifty years of programming language research, and we end up with C++ ???
		--Richard A. O'Keefe


------------------------------

Date: Sun, 19 Apr 1998 17:54:25 -0700
From: "Cory Johnson" <coryj@***NOSPAM***i-check.net>
Subject: SendMail on NT
Message-Id: <6he6ce$fdr@dfw-ixnews12.ix.netcom.com>

I'm switching from a Unix system to a NT system and I have to convert all my
perl cgi scripts over.  I was wondering if there is a module I can use on NT
that would replace Unix's "sendmail".

Thank you
Cory Johnson




------------------------------

Date: Sun, 19 Apr 1998 21:10:39 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: SendMail on NT
Message-Id: <353AA08E.1903@juicepigs.com>

Cory Johnson wrote:
> 
> I'm switching from a Unix system to a NT system and I have to convert all my
> perl cgi scripts over.  I was wondering if there is a module I can use on NT
> that would replace Unix's "sendmail".

I suggest using the Net::SMTP module. It doesn't care what OS you are
using and it is included with the standard ports of perl.

HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


------------------------------

Date: Mon, 20 Apr 1998 02:47:34 GMT
From: ELSS Admin <elssa09@callisto.si.usherb.ca>
To: Cory Johnson <coryj@i-check.net>
Subject: Re: SendMail on NT
Message-Id: <33066D20.4BDC@callisto.si.usherb.ca>

No problem:

	But you'll need the libraries installed! Run it first to see if you
have them. Use the commented line to run the debug first.

	You can play with this script first. Last I checked, it worked. If you
have a question, drop me a line. I'm new to this, but it works.

Natalie
______________________________
#!perl -w
$email = "you\@your_server.com";

use Net::SMTP;

#$smtp = Net::SMTP->new('mail.your_server.com', Debug => 1);
$smtp = Net::SMTP->new('mail.your_server.com');

$smtp->mail($ENV{USER});

$smtp->to('$email');
$smtp->data();
$smtp->datasend("To: $email\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit;
exit;


------------------------------

Date: Mon, 20 Apr 1998 06:42:17 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: SendMail on NT
Message-Id: <353ad229.524144494f47414741@radiogaga.harz.de>

Bob Trieger (sowmaster@juicepigs.com) wrote:
: Cory Johnson wrote:
: > I'm switching from a Unix system to a NT system and I have to convert all my
: > perl cgi scripts over.  I was wondering if there is a module I can use on NT
: > that would replace Unix's "sendmail".

: I suggest using the Net::SMTP module. It doesn't care what OS you are
: using and it is included with the standard ports of perl.

Beware, however, that on non-Unix machines you need to set the 'Hello'
option explicitely, as the guess-taking algorithm does not work.
(Basically, Net::Domain::_hostname() is the culprit)

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


------------------------------

Date: Mon, 20 Apr 1998 12:47:27 -0400
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: sendmail
Message-Id: <6hfu89$br5@bgtnsc02.worldnet.att.net>

Try:

    open (SYSEMAIL, "|/usr/sbin/sendmail -oi -t")
                || die( "SENDMAIL connect failure");

        print SYSEMAIL "To: $to\n";
        print SYSEMAIL "From: $from\n";
        print SYSEMAIL "Reply-To: $replyto\n";
        print SYSEMAIL "Subject: $title\n";
        print SYSEMAIL "$msg\n";

        close( SYSEMAIL );



------------------------------

Date: Mon, 20 Apr 1998 17:24:45 GMT
From: craigs@3rdstone.net (Craig Simpson)
Subject: Re: sendmail
Message-Id: <353b844c.2360704@209.76.252.8>

On Mon, 20 Apr 1998 16:35:32 +0200, "Lukas Lundgren" <	> wrote:

>I am writing a script which sends a mail to me... But how do I change the
>"From" in the e-mail?
>
>/Lukas Lundgren
>
>


$sendmail='/usr/sbin/sendmail -t';

sub mailto {
open (MAIL, "|$sendmail")||die "couldn't open pipe to $sendmail";
print MAIL "To:craigs\@visualperspectives.com\n"; 
print MAIL "From: $STRING{'Email'}\n";
print MAIL "What ever"\n\n";
print MAIL "body\n";
close(MAIL);


That will do it



Craig







------------------------------

Date: Mon, 20 Apr 1998 21:12:32 -0700
From: "Mikel Cook" <mikel@ap.net>
Subject: Re: sendmail
Message-Id: <6hh699$n42$1@news.ap.net>

I think the basic idea is to set it as a constant.

Check out formmail.pl at www.scriptarchive.com/scripts  These are freebies
and examples of pretty good code.  They date from the "old days" of a year
or two ago and so don't use the modules available in Perl5.

I use that form to email handler and also wrote a script using MIME::Lite
that is usually distributed with Perl5.004

Mikel Cook
Just Another Perl Idiot (JAPI).


Lukas Lundgren wrote in message <6hfm90$frp$1@cubacola.tninet.se>...
>I am writing a script which sends a mail to me... But how do I change the
>"From" in the e-mail?
>
>/Lukas Lundgren
>
>




------------------------------

Date: Tue, 21 Apr 1998 00:28:53 -0400
From: Stacy Hunter <snx@snx.com>
Subject: Serial Dates
Message-Id: <353C205A.C56373B6@snx.com>

I am trying to get a serial date (4/20/98 = 34443) out of perl but
haven't had any luck.

Anyone have a way to do this?

- Stacy



------------------------------

Date: 21 Apr 1998 09:21:16 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Serial Dates
Message-Id: <7xu37nr66r.fsf@beavis.vcpc.univie.ac.at>

Re: Serial Dates, Stacy <snx@snx.com> said:

Stacy> I am trying to get a serial date (4/20/98 = 34443)
Stacy> out of perl but haven't had any luck.

I don't see the relationship between those numbers, nor do I
understand exactly what you mean by "serial date" (days
since epoch?), but you probably want to look at the modules:

    Date::Manip
and
    Date::DateCalc

tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.


------------------------------

Date: 21 Apr 1998 19:26:59 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Serial Dates
Message-Id: <6hja03$24o$1@monet.op.net>
Keywords: compare dyer offspring withal


In article <353C205A.C56373B6@snx.com>, Stacy Hunter  <snx@snx.com> wrote:
>I am trying to get a serial date (4/20/98 = 34443) out of perl but
>haven't had any luck.

Luck is irrelevant.

>Anyone have a way to do this?

I'm not sure what you want exactly, but perhaps 

	$date = int(time / (24*60*60)) - 24107;

is something like it.



------------------------------

Date: Wed, 22 Apr 1998 00:02:40 -0400
From: Jeff Spray <jespray@one.net>
Subject: Setting environment variables
Message-Id: <353D6BE0.9C29ADD6@one.net>

Hello list,
    I have a problem that I need to manipulate a current environment
variable and then set a new, previously unset variable and make it
permanent for all subseqent shells that start.  I can get them set, but
they are not permanent.  This must be accomplished on NT platforms
(corporate bought them, not me).  Any help would be appreciated.  TIA

--
Jeff Spray <jespray@one.net>
------------------------------------------------------------------------

Smith and Wesson - The original point and click interface..
------------------------------------------------------------------------





------------------------------

Date: Mon, 20 Apr 1998 19:35:28 -0500
From: "Kermit Tensmeyer" <kermit@ticnet.com>
Subject: Setuid is dangned near impossible
Message-Id: <6hgpk7$moq$1@news1-alterdial.uu.net>

I wanted to do something quick. And I can't...


  I wanted to put a perl wrapper around some specfic calls
to ssh and scp. I wanted to do it as a minimal priviledge user
and permit only very specfic functions.

 by using one specfic user, I can set up the facility to copy files
from one machine to another without compromising the rest of
the security.

 I tried to suid the perl script. and found the nice little warning.
 I tried the various options. UnDump does not work well.
 I wrote the wrapper program, and then set it to execute
perl with the target file (now set to 0644). The executible
was set to suid.

  however whenever any user (like root or admin or...)
 who had used ssh (current version) that users parameters
were used instead of the suid owner parameters.

 (yep when root ran the program, the ssh invocation
would ask for the _root_ password.)

 other users would be denied access because
perl would block because suid is denied.

  Isn't that the reason that the wrapper program has to
be used? so that the effective user is the user who
owns the executible..

  How do I get this to work?

 The alternative is to open up full accessiblity with
the rsh and ignore the effective user.

 it would be nice to use Perl to make thing work well
but Perl has made it so difficult to do even simple things
with this new changes. (perl5.0040063)

 Have I missed something?






--
Kermit Tensmeyer      kermit@ticnet.com
   Dallas, TX         Life is too short to worry much...




------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 2387
**************************************

home help back first fref pref prev next nref lref last post