[7396] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1021 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 13 15:07:13 1997

Date: Sat, 13 Sep 97 12:02: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           Sat, 13 Sep 1997     Volume: 8 Number: 1021

Today's topics:
     [Q] How to remove spaces in filenames w/perl? <jeffp@mindstep.net>
     Re: [Q] How to remove spaces in filenames w/perl? <merlyn@stonehenge.com>
     Re: Behaviour of chomp( "$/" ) <rootbeer@teleport.com>
     Re: can Perl create secure shell sessions? <rootbeer@teleport.com>
     Re: can Perl create secure shell sessions? <ptrainor@aura.title14.com>
     Re: can Perl create secure shell sessions? <rootbeer@teleport.com>
     Re: Forking problem <rootbeer@teleport.com>
     Re: HELP! Please perl gurus! What is crashing the serve <rootbeer@teleport.com>
     Re: is it possible to rename multiple files? <rootbeer@teleport.com>
     Re: is there a better way to do this subroutine? (Tushar Samant)
     manage tree like structure... (Alex Krohn)
     Re: PGP & CGI PERL SCRIPT <rootbeer@teleport.com>
     Re: Re: Free Perl CGI Script michael.nilsson@maze.se
     Re: Reading Binary Files <rootbeer@teleport.com>
     Re: some simple help <rootbeer@teleport.com>
     Re: some simple help <rootbeer@teleport.com>
     Re: Strange behavior with undefined subroutine <rootbeer@teleport.com>
     Re: tar on NT (Jim Michael)
     Re: unpack and install Perl <rootbeer@teleport.com>
     Re: Using Perl to access pages for Java applet <rootbeer@teleport.com>
     Re: What am I doing wrong? <rootbeer@teleport.com>
     Re: Why can't I talk directly to the mail daemon? <rootbeer@teleport.com>
     Re: Win 95 Perl & Tk (Gurusamy Sarathy)
     Re: Writing format to string <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 13 Sep 1997 11:35:29 -0700
From: Jeff Phillips <jeffp@mindstep.net>
Subject: [Q] How to remove spaces in filenames w/perl?
Message-Id: <341ADCF1.773C@mindstep.net>


I have a directory full of subdirectories, which contain files with
spaces in the names. 

All I wish to do is remove the spaces from the names.

Example:

/usr/jeff/Annual Report.doc

needs to be 

/usr/jeff/AnnualReport.doc

If I can do this with perl, I'd save about a billion hours renaming
3000+ files in 200 directories.

Thanks so much!

Jeff
-- 
====================
Jeff Phillips   
Mindstep Corporation
jeffp@mindstep.net
--------------------


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

Date: 13 Sep 1997 11:16:38 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Jeff Phillips <jeffp@mindstep.net>
Subject: Re: [Q] How to remove spaces in filenames w/perl?
Message-Id: <8c202t5bax.fsf@gadget.cscaper.com>

>>>>> "Jeff" == Jeff Phillips <jeffp@mindstep.net> writes:

Jeff> I have a directory full of subdirectories, which contain files with
Jeff> spaces in the names. 

Jeff> All I wish to do is remove the spaces from the names.

Jeff> Example:

Jeff> /usr/jeff/Annual Report.doc

Jeff> needs to be 

Jeff> /usr/jeff/AnnualReport.doc

Jeff> If I can do this with perl, I'd save about a billion hours renaming
Jeff> 3000+ files in 200 directories.

find2perl to the rescue:

    find2perl /usr/jeff -name '* *' -print \
       -eval '$old = $_; s/ //g; rename $old, $_ unless -e $_' | perl

Shall I bill you for the billion hours now, or later? :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 352 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Sat, 13 Sep 1997 09:07:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Fred@no.spam.leeds.ac.uk
Subject: Re: Behaviour of chomp( "$/" )
Message-Id: <Pine.GSO.3.96.970913090212.12359c-100000@julie.teleport.com>

On Sat, 13 Sep 1997 Fred@no.spam.leeds.ac.uk wrote:

>         if( /^$/$/ );

> (All perl typed anew rather than pasted).

I can tell. :-)  

Are you trying to use $/ in a pattern match? You'll need to use a
different delimiter than / to make that work. But you probably want to use
the string equality operator ('eq') or maybe index() instead of a pattern
match.

If it's still a difficulty, see if you can make a small script which shows
the problem behavior. Then paste it instead of retyping it. :-)  Thanks! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:46:39 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Pat Trainor <ptrainor@aura.title14.com>
Subject: Re: can Perl create secure shell sessions?
Message-Id: <Pine.GSO.3.96.970913084426.12359a-100000@julie.teleport.com>

On Fri, 12 Sep 1997, Pat Trainor wrote:

> 	How can I run a perl script to create a secure shell for user at
> logon, and basically exec it so that a ^C or such will cause logoff, and
> not dump them into the parent shell? 

Write a Perl shell which only allows what you want. :-)  Either set the
terminal to not send signals on control-C, or set the corresponding signal
handler to IGNORE. Use 'use strict', -w, and -T. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 12:20:14 -0400
From: Pat Trainor <ptrainor@aura.title14.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: can Perl create secure shell sessions?
Message-Id: <Pine.LNX.3.95.970913121947.2608C-100000@aura>


	Any ready-made examples out there? (lazy...!)

On Sat, 13 Sep 1997, Tom Phoenix wrote:

> Date: Sat, 13 Sep 1997 08:46:39 -0700 (PDT)
> From: Tom Phoenix <rootbeer@teleport.com>
> To: Pat Trainor <ptrainor@aura.title14.com>
> Newsgroups: comp.lang.perl.misc
> Subject: Re: can Perl create secure shell sessions?
> 
> On Fri, 12 Sep 1997, Pat Trainor wrote:
> 
> > 	How can I run a perl script to create a secure shell for user at
> > logon, and basically exec it so that a ^C or such will cause logoff, and
> > not dump them into the parent shell? 
> 
> Write a Perl shell which only allows what you want. :-)  Either set the
> terminal to not send signals on control-C, or set the corresponding signal
> handler to IGNORE. Use 'use strict', -w, and -T. Hope this helps!
> 
> -- 
> Tom Phoenix           http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
> Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
>               Ask me about Perl trainings!
> 


pat 	
:)
  	
#        ptrainor@aura.title14.com (PT46) ptrainor@bbnplanet.net
#  Perl, PHP/FI, *NIX, HTML, CGI, SQL, RDBMS, NT*, Security, Admin, ... 
# "I've got LOTS of experience doing practically nothing!" -Heffer Wolfe



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

Date: Sat, 13 Sep 1997 10:24:13 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Pat Trainor <ptrainor@aura.title14.com>
Subject: Re: can Perl create secure shell sessions?
Message-Id: <Pine.GSO.3.96.970913094317.12359h-100000@julie.teleport.com>

On Sat, 13 Sep 1997, Pat Trainor wrote:

> 	Any ready-made examples out there? (lazy...!)

Well, I'm not promising that this is bulletproof (or even useful), but try
it and see what you think. Be sure to launch it as the user's shell (or
equivalent) so that exit logs them off (or whatever you need). Enjoy!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!

    #!/usr/bin/perl -wT
    BEGIN { $SIG{INT} = 'IGNORE' }
    use strict;

    sub do_rename {
	die "Wrong number of args to rename" unless @_ == 2;
	my($from, $to) = @_;
	die "Bad format for new filename"
	    unless $to =~ /\.readme$/;
	die "Bad format for old filename"
	    unless $from =~ /\.README$/;
	die "New filename already exists"
	    if -e $to;
	rename $from, $to or die "Rename failed: $!";
    }

    my $commands;		# Separate from next line
    $commands = {
	'exit'	=> sub { exit 0 },
	echo	=> sub { print "@_\n" },
	'rename'	=> \&do_rename,
	info	=> sub { print "Commands: @{[ sort keys %$commands ]}\n" },
    };

    while () {					# Infinite loop
	eval {					# Trap errors & die
	    print "Perl shell> ";
	    return unless defined(my $request = <STDIN>);
	    my @fields = split ' ', $request;
	    my $command = shift @fields;
	    return unless defined $command;
	    my $op = $commands->{$command};
	    if (defined $op) {
		&$op(@fields);
	    } elsif ( exists $commands->{lc $command} ) {
		die "Unrecognized command '$command' (try lower case)"
	    } else {
		die "Unrecognized command '$command' (try 'info')"
	    }
	};
	next unless $@;
	my $error = $@;
	$error =~ s/\Z\n?/\n/;		# unchomp
	print $error;
    }
__END__



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

Date: Sat, 13 Sep 1997 08:15:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter.J.Scott-remove-to-email@jpl.nasa.gov
Subject: Re: Forking problem
Message-Id: <Pine.GSO.3.96.970913081430.12359U-100000@julie.teleport.com>

On 12 Sep 1997, Peter Scott wrote:

> This is bizarre.  I have a program which forks children that appear to 
> be executing *after* they have exited and signalled the parent!

> foreach (1..6) {
>   if ($pid = fork) {

>   }
>   else {
>     exit &bar;			# child
>   }

You aren't checking for failed forks. Try that, and your problems should
go away. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:43:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Hazzard <hazzard@usa.net>
Subject: Re: HELP! Please perl gurus! What is crashing the server in a simple script?
Message-Id: <Pine.GSO.3.96.970913084300.12359Z-100000@julie.teleport.com>

On Sat, 13 Sep 1997, Jason Hazzard wrote:

> Now the problem is that there are different scripts using tie() on the
> same DBM file.  They usually will work ok, but It seems that if the
> server gets a bit of multiple usage, the whole server will go down for
> 20 mins or so before you can even access a web page! 

Sounds as if you want to lock either the DBM file or an auxiliary file, to
prevent multiple processes from trying to update the file at once. Good
luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:08:18 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Roberts <dtrobert@ladc.lockheed.com>
Subject: Re: is it possible to rename multiple files?
Message-Id: <Pine.GSO.3.96.970913075927.12359R-100000@julie.teleport.com>

On Fri, 12 Sep 1997, David Roberts wrote:

> Subject: is it possible to rename multiple files?

Of course!

> i've looked through Oreilly's book and it shows how to do a mulitple
> rename on files. 

Which book is that? O'Reilly publishes at least two... :-)

> say, for example, that i wanted to strip off the .bak from a bunch of
> files, it says: 
> 
> rename 's/\.bak$//' *.bak

Ah, you're using the Classic Camel, page 312.

> i tried calling this at the command prompt with 
> 
> /usr/bin/perl -e 'rename 's/\.bak$//' *.bak'

That's not how it works. It's not a Perl builtin you're using there, but
the program listed on page 313. That code is also available at this URL.

    http://www.perl.com/CPAN/scripts/nutshell/ch6/rename

Once installed, you can then give a 'rename' command at the shell prompt. 
Fixing up that code's shortcomings is left as an exercise. :-)  Good luck
with it!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 13 Sep 1997 11:49:05 -0500
From: scribble@shoga.wwa.com (Tushar Samant)
Subject: Re: is there a better way to do this subroutine?
Message-Id: <5veg61$d0a@shoga.wwa.com>

rbush@up.net writes:
>Since you dont understand perl i shall tell you what it does.

No, he doesn't understand YOU. Given your horrendous code, it's not
surprising; I am surprised someone risked their neurons by actually
reading it. By the way, all of us average programmers know that code
by itself has (a syntactic structure and) a function, but no meaning
until coupled with the assumptions in the coder's head and the rest
of the universe. When you understand that, you will start progressing
towards averageness. Good luck .. 



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

Date: Sat, 13 Sep 1997 00:24:41 GMT
From: alex@gossamer-threads.com (Alex Krohn)
Subject: manage tree like structure...
Message-Id: <3419dc91.280384579@news.supernews.com>

Does anybody know of a good module/way to manage a tree like
structure? Each node can contain leaves and/or branches, I would like
to be able to add/remove leaves and branches and write/read to file.

The structure is very similar to say Yahoo where the links are leaves
and categories are branches.

Any help would really be appreciated!

Thanks,

Alex


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

Date: Sat, 13 Sep 1997 08:26:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: giulia hill <ghill@library.berkeley.edu>
Subject: Re: PGP & CGI PERL SCRIPT
Message-Id: <Pine.GSO.3.96.970913081726.12359V-100000@julie.teleport.com>

On Fri, 12 Sep 1997, giulia hill wrote:

> push(@INC,'/usr/local/etc/httpd/cgi-bin');
> require('cgi-lib.pl');

You're really doing this the hard way. Get CGI.pm instead.

> &ReadParse;
>  
> open (LOG,">$logFile");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check of the return value after opening a
file.

> print LOG "pgp = $pgp; in(TESTIN) = $in{'TESTIN'}; encry = $encrypt\n";
> open (FILE, ">$tmpFile");
> print FILE "$in{'TESTIN'}\n";
> close FILE;

Unless you do something especially tricky in the code which you haven't
posted, I take it that you don't mind that that tempfile might be easily
read by anyone using your machine.  :-)  You also might have to worry that
it could be erased or replaced by another user, among other reasons to be
cautious. If you're needing PGP, you should probably be using 'use
strict', -w, and -T. But you should also not be sending secret data in
clear over the web.... :-) 

> $command = "$pgp -fea $userId < $tmpFile > $encrypt";

Why do you do that when you're about to do this?

> print LOG $command;
> open(PGP,"$pgp -fea $userId < $testFile > $encrypt 2> $stdERR|");

That is, you're doing a different command than the one you just logged. 
And why run the pgp binary like this, when you could use a module to do
what you need?

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 12:40:45 -0600
From: michael.nilsson@maze.se
Subject: Re: Re: Free Perl CGI Script
Message-Id: <874171137.18817@dejanews.com>

Hello Brian!
It's always nice to get some feedback.

 I totally agree with you checking HTTP_REFERER is not security, what I
try to do by checking HTTP_REFERER is allow forms to be located only on
servers which are  in this field.

If you take a closer look at my source you will find out that checking
the log in name and password provides the protection and when you log in
correctly an HTML file is printed to your browser.
The protected HTML file should have the file access permissions set to
only allow the owner to read it.


I am aware of the potentially problem if some one that uses a proxy does
a failed log ins and block out the proxy address.
This will not be a problem unless you have different users or just one
valid user within the same proxy.

You wrote
 >give me telnet and I can defeat it

I am really interested to now how, I've tried to hack this in all the
ways I can think of like using telnet and try to access the script or the
other files in this package.
My conclusion is that the only way to access the files is to log in as
the owner of the files.

Maybe I've missed something important here, if so please let me now.

The reason that I wrote this little script is that I tried to protect a
directory by setting up a .htacces and a .htpasswd file it, took  me
about 3 minutes to log in to another UNIX account by telnet and read this
files.
Next step is to run a Unix password checker/cracker on the .htpasswd
file, isn't this to easy ?

So when I finished protect.pl I thought that it might be some people out
there with the same problem like being hosted on a UNIX with
Apache/1.2b10 :)

Michael Nilsson
michael.nilsson@maze.se

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Sat, 13 Sep 1997 07:58:26 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: The Flash <l42452@alfa.ist.utl.pt>
Subject: Re: Reading Binary Files
Message-Id: <Pine.GSO.3.96.970913075759.12359Q-100000@julie.teleport.com>

On 12 Sep 1997, The Flash wrote:

> 	I would like to know how can I read information from a binary
> file. 

Use binmode(). Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 09:08:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: D'Andre Ladson <dandre@efficient.com>
Subject: Re: some simple help
Message-Id: <Pine.GSO.3.96.970913090729.12359d-100000@julie.teleport.com>

On 12 Sep 1997, D'Andre Ladson wrote:

> I have a script that works fine form the command line but
> fails when posted from the WWW.  The error I received is that
> the HOME: Undefined variable.

Check out the perlvar(1) manpage. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 09:15:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Martin Str|mberg <ams@ludd.luth.se>
Subject: Re: some simple help
Message-Id: <Pine.GSO.3.96.970913091326.12359f-100000@julie.teleport.com>

On 13 Sep 1997, Martin Str|mberg wrote:

> Indeed: try $ENV{'HOME'} = /user/home.

And, if that code works, be sure to file a bug report. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 09:00:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Schoenfeld <chris@ixlabs.com>
Subject: Re: Strange behavior with undefined subroutine
Message-Id: <Pine.GSO.3.96.970913085826.12359b-100000@julie.teleport.com>

On Fri, 12 Sep 1997, Chris Schoenfeld wrote about calling copy() without
first use'ing File::Copy: 

> I was running perl5.004_03 -w and use strict;
> so what do you think happened?
> Nothing!
> No warnings, no errors, and, of course, the function did not copy.

That's quite odd. Could you make a small script which shows this behavior
and use perlbug to file a bug report? Thanks! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 15:00:37 GMT
From: genepool@netcom.com (Jim Michael)
Subject: Re: tar on NT
Message-Id: <genepoolEGGCD1.1r9@netcom.com>

Raymond K. Bush (rbush@up.net) wrote:
: Larry Nguyen wrote:
: > is there a Win NT or DOS version of tar executable some where that I can
: > download? I'm trying to unpack and install the latest.tar.gz and I got
: > the gzip.tar file which I need a tar executable to un-tar it.

: you probly want a nt/dos port, go here:
: http://www.perl.com/CPAN-local/ports/winNT/

Sources are often tar'd &| gzipped, the latest Winzip32 will handle those.

Cheers,

Jim


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

Date: Sat, 13 Sep 1997 07:55:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Larry Nguyen <Larry_P_Nguyen@qmail2.sp.trw.com>
Subject: Re: unpack and install Perl
Message-Id: <Pine.GSO.3.96.970913075450.12359P-100000@julie.teleport.com>

On Thu, 11 Sep 1997, Larry Nguyen wrote:

> What format is the perl's code (ie. latest.tar.gz) packed in?
> How do I unpack it?

    http://www.perl.com/CPAN/ENDINGS

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:13:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Paul Holden <paulh@irsoft.demon.co.uk>
Subject: Re: Using Perl to access pages for Java applet
Message-Id: <Pine.GSO.3.96.970913081231.12359T-100000@julie.teleport.com>

On Fri, 12 Sep 1997, Paul Holden wrote:

> Subject: Using Perl to access pages for Java applet

> I can't think how to get the script to open a page on some other server.

Use LWP, from CPAN. Hope this helps!

    http://www.perl.com/CPAN/
    http://www.perl.org/CPAN/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:32:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Kenneth Vogt <KenVogt@rkymtnhi.com>
Subject: Re: What am I doing wrong?
Message-Id: <Pine.GSO.3.96.970913082948.12359X-100000@julie.teleport.com>

On Fri, 12 Sep 1997, Kenneth Vogt wrote:

> Subject: What am I doing wrong?

Besides posting a non-Perl question to a Perl newsgroup? :-)  (It's not a
Perl question since the answer would be the same if you were using any
other language to write your script, but you may not have realized that.) 

> I have a script that is working fine.  It creates an HTML file on the
> fly.  Then I put the following code as the first print statement that
> outputs the HTML code:
> 
> print qq!Set-Cookie: cart_id=6269836.8264;\n!;
> print ..the rest of my code...
> 
> What now happens is that the page *displays* "Set-Cookie: 
> cart_id=6269836.8264;" instead of actually setting the cookie.  What am
> I doing wrong? 

Printing the headers in the wrong order, probably. Check that the output
of your script has the proper header format, as defined in the http spec. 
Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Sat, 13 Sep 1997 08:41:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Brian Kendig <bskendig@netcom.com>
Subject: Re: Why can't I talk directly to the mail daemon?
Message-Id: <Pine.GSO.3.96.970913083559.12359Y-100000@julie.teleport.com>

On Sat, 13 Sep 1997, Brian Kendig wrote:

>   open(MAIL, "|telnet localhost 25") || die "Couldn't telnet: $!\n:;

That error message is, strictly speaking, misleading. It'll be printed
only if you can't _fork_. If, after the fork, you can't run the telnet
program, the die message won't be reached, alas. And if you don't have
warnings turned on (you don't) you won't even get a warning about the
failure to execute.

>   $| = 1;

That only affects the currently selected filehandle, which is not MAIL.

>   print MAIL "MAIL FROM: foo\@bar\n";
>   print MAIL "RCPT TO: bskendig\@netcom.com\n";

This would be easier to read and maintain if you were to use a
here-document. 

>   close (MAIL);

And if you really care that it worked :-)  you should check the return
value of close.

    close MAIL or warn "telnet returned status $?";

Of course, you could instead send mail with a module's help... :-)  Good
luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 13 Sep 1997 16:26:53 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Win 95 Perl & Tk
Message-Id: <5veesd$mov@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <5vd4qf$nlr@q.seanet.com>, Allen Evenson <ase@seanet.com> wrote:
>Harold Corbin wrote in article <340F31AC.7D86@erols.com>...
>>I haven't run much yet, just the widget demo and there is only one way
>>to describe it - WOW,  WOW!!!!!!!  Thank You Gurusamy Sarathy and
>>everyone who helped make this available.
>
>I second this emotion! I have also had success downloading and installing
>the port on my Win95 box.

Glad to hear it works, thanks.

>The only trouble i've had to date, is with argv globbing that used to work
>with a
>previosly installed activeware port.
>
>my old script (a grading program) used to work untouched with the following
>invocation:
>'perl -w grader key *.grd'
>
>with the new port i received "*.grd" not found, until I READ THE
>DOCUMENTION!
>I needed to  'use File::DosGlob 'glob';  # override CORE::glob'
>and modify my script to glob each argv element [...]

There's of course a more transparent way to get @ARGV globbing
(one that doesn't involve hacking every source file).

Set PERL5OPT in your environment to "-MWild" (or append, if you already
have something in PERL5OPT), and make sure you put Wild.pm below in
your perl's "lib" directory:

  # Wild.pm - emulate shell @ARGV expansion on shells that don't
  use File::DosGlob;
  @ARGV = map { my @g = File::DosGlob::glob($_) if /[*?]/; @g?@g:$_ } @ARGV;
  1;

Unlike compiling the @ARGV expansion into the binary (which has
compatibility and reliability problems too), this is a fully
*optional* solution.

 - Sarathy.
   gsar@umich.edu


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

Date: Sat, 13 Sep 1997 08:11:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ben Raia <br2a+@andrew.cmu.edu>
Subject: Re: Writing format to string
Message-Id: <Pine.GSO.3.96.970913080902.12359S-100000@julie.teleport.com>

On Fri, 12 Sep 1997, Ben Raia wrote:

> I have a very large format report, the output of which I would like to
> "write" into a string to use elsewhere in my program, rather than out to
> a filehandle.  Is there any way to either
> 
> 1) directly write the format to a string, or 

Yes, with formline().

> 2) somehow get a filehandle that points to a string rather than a stream
> and just write to that filehandle in the normal way? 

Yes, with tied filehandles (although I don't know whether this is possible
with the current implementation of tied filehandles). But formline would
probably be easier.

> Or is there another way I can do this that I haven't thought of,

sprintf()

> given the restriction that I would like to avoid recreating my format
> output in a different way. 

Oh, darn. :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

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 1021
**************************************

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