[12865] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 275 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 27 19:17:21 1999

Date: Tue, 27 Jul 1999 16:10:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Jul 1999     Volume: 9 Number: 275

Today's topics:
    Re: Scrollback perldoc in DOS-window? <dparrott@ford.com>
        Selecting files by permisions <leejk@cat.com>
        Sending HTML emails from perl script <mike@euromortgage.cc>
    Re: Simple form problem <sariq@texas.net>
        splice easy question tasher1234@my-deja.com
        strange looking hash (Corey Saltiel)
    Re: strange looking hash (Larry Rosler)
        Trouble with sort mike_lottridge@mentorg.com
    Re: Using perl to ftp non interactively <sariq@texas.net>
    Re: Which group is appropriate? (Bart Lateur)
    Re: Which group is appropriate? (I R A Darth Aggie)
    Re: Which group is appropriate? (I R A Darth Aggie)
    Re: Which group is appropriate? (Mike Bristow)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Jul 1999 10:31:22 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
Subject: Re: Scrollback perldoc in DOS-window?
Message-Id: <379DC2BA.EDA59954@ford.com>

starthoughts@my-deja.com wrote:
> 
> In article <7n7dgn$elf8@news.cyber.net.pk>,
>   "Faisal Nasim" <swiftkid@bigfoot.com> wrote:
> >> Or: How am I supposed to read pods when the pipe
> >> "|more" does NOT work with perldoc.bat -f ?
> >
> > Or see HTML documents :)
> 

I've heard this about Win95 twice in the last 48
hours... I'm beginning to wonder if I'm goofy or
what. I SWEAR that this used to work just fine on
my Win95 boxes... What the dickens is the difference
'twixt your box and mine???

>  Yes, I could spend a lot of time researching and
> GREPPING through the docs, but WHY can't someone just
> FIX the perldoc.bat file?  It works just fine for all
> the FULL page perldocs.  I am new to Perl and don't
> have the skills yet to understand WHY this can't be
> done.  Perhaps I'll write a better perldoc.bat file
> myself SOME DAY... BUT def. not any time soon.  (SEE
> the lines below!)
> 

Now that sounds like a great contribution! When can
we expect it?  ;^)

> > open OUTPUT , ">myoutput"; #I don't use die() on Win :)

uhhh... why don't you use 'die()' on Windows? (I'm
probably missing something here... be nice...)

-- 

-----------------------------------------------------------------------
Dennis M. Parrott        |            Unix:  dparrott@ford.com
PCSE Webmaster           |           PROFS:  DPARROTT
Ford Motor Company       |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA   | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933  Fax: 313-248-1234  Pager: 313-851-2958


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

Date: Tue, 27 Jul 1999 17:24:04 -0400
From: "Keith Lee" <leejk@cat.com>
Subject: Selecting files by permisions
Message-Id: <7nl825$dgi$1@ns1.cat.com>

Hello,
    I have been working on a little script to change the permissions of all
new files in a directory to 0644. This directory has over 5000 files in it,
so I would like to skip over files that are already set to 0644. I can't
seem to be able to compare the files permissions though. The code I have so
far does them all no matter if they are already set to 0644. I have tried
using -R -W -r in place of the stat function below, but I don't think you
can combine these together. Can anyone suggest a better approach to this?

Thanks
Keith

$counter = 0;
foreach $file(@file_list) {
 next if ($file =~ /^\./);
 next if -d $file;
   unless ((stat($file))[2] eq 0644) {
     chmod 0644, $file;
     print "$file\n";
     $counter = $counter + 1;
   }
}
print "$counter file(s) have been modified.\n";




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

Date: Tue, 27 Jul 1999 17:30:39 +0100
From: "Michael Dransfield" <mike@euromortgage.cc>
Subject: Sending HTML emails from perl script
Message-Id: <379dde1c@news.jakinternet.co.uk>

I have a script which returns the contents of a script.  It is difficult to
read however in its current format.  I would like to send it in HTML format
with a table.

I have amended the script so that it adds
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR>
<STYLE></STYLE>
</HEAD><HTML><BODY><TABLE>

(This is exactly what is returned by the form) I added the \'s

at the start of the email and then the required <TD> and <TR> HTML tags
between each bit of information.

What am I doing wrong??  Is this possible - or am I barking up the wrong
tree??

Mike





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

Date: Tue, 27 Jul 1999 16:52:19 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Simple form problem
Message-Id: <379E2A13.48B9C7CB@texas.net>

The Barry Family wrote:
> 
> I am using the POST method.
> When I say to submit, I want it to list each variable and what was typed
> in it.

How in heaven can we possibly tell you what's wrong without seeing what
you've already tried?

Post the code that you're having problems with, and you might get some
helpful responses.  The example should be as short as possible, while
still demonstrating the problem.

- Tom


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

Date: Tue, 27 Jul 1999 21:23:12 GMT
From: tasher1234@my-deja.com
Subject: splice easy question
Message-Id: <7nl7vo$o5n$1@nnrp1.deja.com>

This is an upload file and it adds okay and does delete some of the
file.  But, the delete$i numbers are off.
The pertinent code is this:
	open(FILE,"$cwd/$ttype.txt");
	undef $/;
	@lines=split "==cut==\n",<FILE>;
	close FILE;

	if ($auth and $cmd=~/delete.(\d)/){
		splice @lines,0,1;
	}

	open(FILE,">$cwd/$ttype.txt");
	print FILE join"==cut==\n",@lines;
	close FILE;

$i=0;
 for (@lines) {
  $i++;
  #s/\n/<br>\n/g;
  $Response->Write(" <tr>\n");

  if ($auth){
     $Response->Write(<<END_5);
  <td><font face=arial size=1>
 <a
href="javascript:document.forms[0].cmd.value='delete.$i';document.forms
[0].submit()"

  onmouseover="status='delete item'"
  onmouseout="blur();status='';">X</a>

Before, I had splice @lines,$1,-1,1; and that was sticking a 1 in the
text file and not deleting anything.  Now it deletes the line, but if
you add 2 or more lines like this:
test2
test
where you added test first and test2 second and if you click on the X
next to test it will say in the status line:  delete.2 and it will
delete test2 instead of just test.
Thanks for any help.
Terry Asher


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 27 Jul 1999 21:36:08 GMT
From: corey@helfrich.com (Corey Saltiel)
Subject: strange looking hash
Message-Id: <slrn7ps9hr.mh.corey@scanner.helfrich.com>


Hey there, 


The following construct has got me pretty confused:

$msgnum = 1;
$string = "lame";
$msg{$msgnum, "Date"} = $string;  # <---  ?!
print "$msg{$msgnum, "Date"}";

 ...what the?
How the heck does this work? 


My first guess was that it was analogous to this:

$msg{$msgnum}{'Date'} = $string;

 ... but that doesn't seem to be the case after testing.


Anyhow, I'm just editing a little script my boss wrote.
He's much newer to perl than I am - yet I have never seen
any hash construct like he managed to put together, nor
can I decipher how the thing works.

Enlightenment is appreciated.


Beers!

Corey



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

Date: Tue, 27 Jul 1999 15:07:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: strange looking hash
Message-Id: <MPG.1207cd94b7a5c320989d58@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <slrn7ps9hr.mh.corey@scanner.helfrich.com> on Tue, 27 Jul 
1999 21:36:08 GMT, Corey Saltiel <corey@helfrich.com> says...
> The following construct has got me pretty confused:
> 
> $msgnum = 1;
> $string = "lame";
> $msg{$msgnum, "Date"} = $string;  # <---  ?!
> print "$msg{$msgnum, "Date"}";
> 
> ...what the?
> How the heck does this work? 
 ...
> Enlightenment is appreciated.

Enlightenment will be found in this section of perlvar:

$SUBSCRIPT_SEPARATOR
$SUBSEP
$;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 27 Jul 1999 22:46:36 GMT
From: mike_lottridge@mentorg.com
Subject: Trouble with sort
Message-Id: <7nlcsb$ric$1@nnrp1.deja.com>

I'm having trouble with sort and a custom sorting routine. It looks
like my sort routine is being called with the same data over and over.
I assume it's some sort of reference problem. I looked through the FAQ,
I know this isn't the most efficient method, but I don't anticipate
needed to sort a large amount of data. I'm using ActiveState Build 518.

Here's the code:
------------------
use Date::Manip;

sub DateSort {
   print "DateSort:\n$a\n$b\n";

   my $date1=&ParseDate($a);
   my $date2=&ParseDate($b);
   print "Comparing $date1 to $date2 \n";

   if ($date1 lt $date2) {
   	return -1; # date1 is earlier
   }
   elsif ($date1 gt $date2) {
    	return 1;# date2 is earlier
   }
   else {
	return 0;
   }# the two dates are identical)

}

$TZ="pst";

@dates=("01/12/99", "06/12/98", "01/01/00", "04/01/90");
@sorted_dates=sort DateSort @dates;
for(@sorted_dates){
	print $_,"\n";
}
------------
And here's the output I get
------------
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
DateSort:
06/12/98
01/12/99
Comparing 1998061200:00:00 to 1999011200:00:00
04/01/90
01/01/00
06/12/98
01/12/99



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 27 Jul 1999 16:29:04 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Using perl to ftp non interactively
Message-Id: <379E24A0.E292351A@texas.net>

Keith wrote:
> 
> Can anyone tell me if there is a way to use ftp in a perl script.

Net::FTP

- Tom


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

Date: Tue, 27 Jul 1999 21:20:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Which group is appropriate?
Message-Id: <37a22214.14104135@news.skynet.be>

Tad McClellan wrote:

>   Your ISP is giving you a clue that the *don't maintain* their
>   newserver when they include newsgroups that were removed
>   *several years* ago.

I've written to my ISP about that. Their reply was that they had deleted
it several times already, but it got recreated automatically, as soon as
posts for this newsgroup arrive.

I think that's a good thing. It shows that no manual intervention is
necessary for my ISP to add new newsgroups.

	Bart.


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

Date: 27 Jul 1999 21:44:02 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Which group is appropriate?
Message-Id: <slrn7psa57.ck3.fl_aggie@thepentagon.com>

On Tue, 27 Jul 1999 13:28:15 -0700, Larry Rosler <lr@hpl.hp.com>, in
<MPG.1207b639594fff19989d55@nntp.hpl.hp.com> wrote:
+ In article <slrn7ps2jj.c49.fl_aggie@thepentagon.com> on 27 Jul 1999 
+ 19:35:11 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> says...
+ ...
+ > One could make the argument that perl's open() is broken, and it should
+ > halt with an error message, ala c/c++/fortran, warp the local time-space
+ > continuum and chide you until you fix it.
+ 
+ I won't comment on the B&D characteristics of the other two languages, 
+ but the swipe at C is unwarranted.

I apologize, and retract the statement about C. I'll hazard a guess
that C++ will behave similarly.

Fortran will bomb instantly and spectacularly if it can't open the
file. This I know from experience.

James


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

Date: 27 Jul 1999 21:47:41 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Which group is appropriate?
Message-Id: <slrn7psac2.ck3.fl_aggie@thepentagon.com>

On Tue, 27 Jul 1999 21:20:40 GMT, Bart Lateur <bart.lateur@skynet.be>, in
<37a22214.14104135@news.skynet.be> wrote:

+ I've written to my ISP about that. Their reply was that they had deleted
+ it several times already, but it got recreated automatically, as soon as
+ posts for this newsgroup arrive.

+ I think that's a good thing. It shows that no manual intervention is
+ necessary for my ISP to add new newsgroups.

It isn't a good thing for them to readily make new groups in the Big 8
without a proper newgroup from the "canonical" authority.

James - used to be tale, but I don't know if that's true these days...


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

Date: Tue, 27 Jul 1999 21:59:04 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Which group is appropriate?
Message-Id: <slrn7psat8.2tb.mike@lindt.fat.dotat.at>

On Tue, 27 Jul 1999 21:20:40 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
[on clp]
>I've written to my ISP about that. Their reply was that they had deleted
>it several times already, but it got recreated automatically, as soon as
>posts for this newsgroup arrive.

They demonstrate their cluelessness.

>I think that's a good thing. It shows that no manual intervention is
>necessary for my ISP to add new newsgroups.

It isn't.  PGP signed control messages are good.

-- 
Mike Bristow, Geek-At-Large.                GK/RT0038
one tequila - two tequila - three tequila - FLOOR !!!



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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". 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 V9 Issue 275
*************************************


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