[13113] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 523 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 14 09:11:15 1999

Date: Sat, 14 Aug 1999 06:05:09 -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           Sat, 14 Aug 1999     Volume: 9 Number: 523

Today's topics:
        .htpasswd / .htaccess question <cal@spacemoose.com>
    Re: Calculation problems in Perl (Bart Lateur)
        detecting if the same script is already running ? marcza@my-deja.com
    Re: I guess this is a Misc question: Cgi-bin <newsgroup@bigwig.net>
    Re: Looking for a solution to the problem localtime and <tchrist@mox.perl.com>
        My program is not exiting why?? <harish@blr.sni.de>
    Re: Nastiness contrary to the spirit of perl? <schmickl@magnet.at>
    Re: Newbie Qu. on Databases <carvdawg@patriot.net>
        Perl penetration into Fortune 500? (brian d foy)
    Re: perl script for changing all upper case letters to  <wedeking@msa.attmil.ne.jp>
    Re: perl script for changing all upper case letters to  <tchrist@mox.perl.com>
    Re: Perl/TK issues <schmickl@magnet.at>
        Sendmail parameter FAQ marcza@my-deja.com
    Re: Sesssion ID <tchrist@mox.perl.com>
    Re: Sesssion ID (Benjamin Franz)
    Re: Spawning OS Command from Perl <carvdawg@patriot.net>
    Re: Spawning OS Command from Perl (Bart Lateur)
    Re: Why use Perl when we've got Python?! <amaranda@nospam.com>
    Re: Why use Perl when we've got Python?! (Dave)
    Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Sat, 14 Aug 1999 19:58:46 +0900
From: Cal Bond <cal@spacemoose.com>
Subject: .htpasswd / .htaccess question
Message-Id: <37B54BE6.4D24@spacemoose.com>

Hi-
I've been scouring faqs looking for info on how to create/access a
 .htpasswd and .htaccess files.  Basically the password protection script
I've downloaded needs me to create these, but I have no idea how.  From
a menu option that says 'create .htaccess' it gives me some lines of
code and says 'use this as your .htaccess file', but when I save it as
that in Notepad it's just a text file.  I realize this is a very basic
question, but even if you could just point me to a faq somewhere that
has this info I'd greatly appreciate it.

Callan Bond


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

Date: Sat, 14 Aug 1999 09:13:18 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Calculation problems in Perl
Message-Id: <37b5329b.4592938@news.skynet.be>

"Alex Croton" <alex[at]suffix.demon.co.uk> wrote:

>but I'm still interested in why I was getting the problem.

Floating point rounding. There's no way you can store the value 0.01 in
a floating point *exactly*.

Only integer multiples of (1 divided by a power of two) get stroed
exactly. So 17/128 can be stored exactly, while 1/100 cannot.

	Bart.


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

Date: Sat, 14 Aug 1999 12:45:14 GMT
From: marcza@my-deja.com
Subject: detecting if the same script is already running ?
Message-Id: <7p3ocp$jpr$1@nnrp1.deja.com>

Assume a script with the follwing structure is running (sleeping):
 ...
while(1) {
  ....
  sleep(86400);
  ....  }
 ...

Now someone is either starting this script or a second instance of it
(again).
How do I check if another instance of this same script is already
running (or currently in sleep mode) ? ->In this case the script should
exit.

Thanx

Marcus


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


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

Date: Sat, 14 Aug 1999 10:46:43 +0100
From: "Ben Quick" <newsgroup@bigwig.net>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <37b55a4d.0@news2.cluster1.telinco.net>

>> >-snip-
>> >
>> >There's another faq just for the group, but it should be referenced by
>> >that page (one of the things I'm going to suggest).
>>
>> A point to note. As a generalization, most people will not visit a page
to
>> read a faq
>
>The faq is posted here, I'm just saying that the perl faq should have a
>reference to it (there's a number of ways that'd be possible, but the
>easiest is if it gets crossposted to news.answers and forwarded to the
>faq archives).


Sorry, my misunderstanding. I thought you meant something like
If you want the faq goto http://etc

>-snip-
>> >It also implies that the way to find out that a question is off topic is
>> >to post it and then see from the responses.
>>
>> But the responses should in turn tell the poster what to do in future
>
>A flame for being OT does tell you what to do, indirectly -- be sure
>your post is on topic next time.


Yes, but *why* flame. Be polite

>> >You should be fairly sure that the question is on topic before asking it
>> >-- and if you know it isn't or that it may not be, then be prepared to
>> >accept the flames that will garner you in good grace.
>>
>> Why should anyone get flamed for a misunderstanding\lack of knowledge
>
>Because a poster is responsible for learning what is acceptable before
>posting.  A newsgroup is a community, before posting/joining a person
>has an obligation to learn what the it's customs/rules are.


The best form of learning is doing

>-snip-
>>
>> >but /they/ didn't have an obligation to give you a polite answer.
>>
>> Can't agree with that. Just because someone get's something wrong doesn't
>> mean that you should be abusive towards them. Ok, so you don't /have/ to
be
>> polite, but when has being polite harmed anyone?
>
>When the someone takes it as sign of weakness and attacks?


A flame is a put-down
A put-down is an insult
Why be insulting?

>And of course there's always the "He was rude first" defense -- posting
>OT is rude, so they feel justified in being rude back.


I can see you'll never understand what I'm getting at. I disagree, but it
stops here


>--
>John Moreno




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

Date: 14 Aug 1999 06:38:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <37b5633d@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    lr@hpl.hp.com (Larry Rosler) writes:
:> Funny, I always thought we were in the 20th century already,
:> and that in a few years, we'd be in the 21st century. :-)
:
:Thank you for this new definition of 'a few':  about 0.4, for most 
:people; about 1.4, for the 'few' who understand the issues.  :-)

It was a meta-few.  :-)

--tom
-- 
    Because . doesn't match \n.  [\0-\377] is the most efficient way to match
    everything currently.  Maybe \e should match everything.  And \E would
    of course match nothing.   :-) --Larry Wall in <9847@jpl-devvax.JPL.NASA.GOV>


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

Date: Sat, 14 Aug 1999 15:04:50 +0530
From: "harish" <harish@blr.sni.de>
Subject: My program is not exiting why??
Message-Id: <7p3cgl$l8f$1@med-iss3.erlm.siemens.de>

Hello,
    I am trying to implement a POP3 mail reader in perl. Program is not
exiting. Can any one help me
Regards
Harish

#!/usr/bin/perl -w

use IO::Socket;
$host = shift(@ARGV);
$EOL = "\015\012";
$BLANK = $EOL x 2;
$remote = IO::Socket::INET->new( Proto     => "tcp",
                                     PeerAddr  => $host,
                                     PeerPort  => "pop3",
                                    );
unless ($remote) { die "cannot connect to pop3 daemon on $host" }
$remote->autoflush(1);
print $remote "user harish" . $BLANK;
print $remote "pass hello123" . $BLANK;
print $remote "retr 1" . $BLANK;
print $remote "retr 2" . $BLANK;
print $remote "stat" . $BLANK;
while(<$remote>)
{
 print;
}
close $remote;




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

Date: Sat, 14 Aug 1999 12:57:31 +0200
From: Thomas Schmickl <schmickl@magnet.at>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37B54B9B.719CD01@magnet.at>

>

As a conclusion of this thread and many other like this I have seen befor in this group,
I wuld suggest to spilt this newsgroup into:

comp.lang.perl.misc.gods (for those who think they are better than us)
comp.lang.perl.misc.belivers (for those who should joint the "perl.gods.thank.hymn"-contest)
comp.lang.perl.misc.users (this is the group where I and the other 99 percent
non_arrogant, friendly, polite and non-agressive posters will look up)

Ciao, thomas.

----------------------------------------------------
Thomas Schmickl,
Department for zoology
Karl Franzens University Graz, Austria.
----------------------------------------------------
Visit the GPL e:doc-project on http://members.magnet.at/hfbuch/edoc
or mail me at schmick@magnet.at
----------------------------------------------------




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

Date: Sat, 14 Aug 1999 05:58:13 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Newbie Qu. on Databases
Message-Id: <37B53DB5.85EDAD98@patriot.net>


http://www.roth.net

I would recommend...

1.  Reading Dave's documentation of Win32::ODBC
2.  Possibly purchasing Dave's book
3.  Subscribing to the ODBC newsgroup at news.roth.net...they aren't nearly
     as a bunch of @$$holes as you might find on other newsgroups.



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

Date: Sat, 14 Aug 1999 06:28:25 -0400
From: brian@pm.org (brian d foy)
Subject: Perl penetration into Fortune 500?
Message-Id: <brian-ya02408000R1408990628250001@news.panix.com>

Perl Mongers is putting together a survey to measure Perl's
penetration into the Fortune 500 companies.  to make that survey
as effective as it can be, we need as much information as we can
get beforehand.

if anyone has worked with any of the Fortune 500 companies, has
friends who do, or otherwise know that these companies are using
Perl, we'd like to know.  it would greatly increase the usefulness
of our survey to know a specific name to send it to, and if we have
an idea how Perl is being used, we can ask better questions.

any help is appreciated.  there is a list of Fortune 500 companies
(as of today) at http://www.pm.org/fortune500.txt.  please send
responses to fortune500@perlmongers.org.

thanks :)

[ btw - it was about three lines of Perl to extract the Fortune 500
list from www.pathfinder.com which has it broken up into 10 
different files ]

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Sat, 14 Aug 1999 18:24:39 +0900
From: "Dan and/or Shelly" <wedeking@msa.attmil.ne.jp>
Subject: Re: perl script for changing all upper case letters to lower case with first word of sentence capitolized
Message-Id: <7p3cn5$pqk$1@news.misawa.attmil.ne.jp>

On page 71 of "Programming Perl" they have a script that can count sentences
in a document by recognizing sentences ending in [.!?].  If anyone knows how
to modify this script to not only count the sentences but to put them into
an array, lc all the sentences, then do ucfirst to each sentence, then print
them back out again, let me know.  Here's
the script I found in the book:
$/ = ""; # paragraph mode
while ($paragraph = <>) {
    while ($paragraph =~ /[a-z]['")]*[.!?]+['")]*\s/g) {
        $sentences++
    }
}
print "$sentences/n";




Dan and/or Shelly wrote in message
<7p25kl$n36$1@news.misawa.attmil.ne.jp>...
>Does anyone have a perl script that will convert text that is in all
>uppercase to lowercase but still leave the first word of a sentence in
upper
>case?
>
>Dan
>
>




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

Date: 14 Aug 1999 06:58:58 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl script for changing all upper case letters to lower case with first word of sentence capitolized
Message-Id: <37b56812@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "Dan and/or Shelly" <wedeking@msa.attmil.ne.jp> writes:
:I wrote the below script to try to do what the subject of this post says.
:Does anyone have any better ideas?  

Here's one approach from the Ram:6.  That's the notation I
employ to indicate the Sixth Chapter of the Perl Cookbook.
That's a book published by one Mr. Tim O'Reilly and Co. which
was written by Nathan "Pater Novus" Torkington and yours truly,
irrespectively but not disrespectively.  You can get it's code gratis
from ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/ via ftp,
should you be so inclined.  Are you sure that sentences can end only in
full stops?  I think you can use hook and bangs, too!  The double-spacing
is important, of course, because otherwise an English parser is required.
You don't have one of those, do you?  I know I don't.

This is what was provided:

    # Extracting Sentences (customary two spaces required)
    { local $/ = "";
      while (<>) {
        s/\n/ /g;
        s/ {3,}/  /g;
        push @sentences, m/(\S.*?[!?.])(?=  |\Z)/g;
      }
    }

Using that, here's a filter derived from that:

    $/ = '';
    while (<>) { 
	s/\n/ /g; 
	s/ {3,}/  /g;
	@sentences = map { ucfirst(lc()) } m/(\S.*?[!?.])(?=  |\Z)/g;
	$paragraph = join(" " x 2, @sentences);
	print "$paragraph\n\n";
    }  

Which if piped through the standard fmt program, either from
the command line or via the introduction of a statement like

    open(STDOUT, "|fmt");

at the top, will produce the following:

    Here's one approach from the ram:6.  That's the notation i employ
    to indicate the sixth chapter of the perl cookbook. that's a book
    published by one mr. tim o'reilly and co. which was written by
    nathan "pater novus" torkington and yours truly, irrespectively
    but not disrespectively.  You can get it's code gratis from
    ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/ via ftp,
    should you be so inclined.  Are you sure that sentences can end
    only in full stops?  I think you can use hook and bangs, too!
    The double-spacing is important, of course, because otherwise an
    english parser is required. you don't have one of those, do you?
    I know i don't.

As you see, much is still to be desired. Here's a different
stab at it.  The tabs in the data segment are too easy to miss.

    #!/usr/bin/perl

    $HOME = $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7] || '/';
    $CAP = "$HOME/etc/caps";

    dbmopen(CAP, $CAP, undef) && $dbm++;

    while (<DATA>) {
	chop;
	# allow and blank lines comments in data file
	s/#.*//;
	next if /^\s*$/;

	# one or two tab-separated fields
	($lhs, $rhs) = split(/\t+/);

	# if no rhs, is capitalized lhs
	($rhs = $lhs) =~ s/(\w+)/\u$1/g 	unless $rhs;

	# be kind to typos
	$lhs =~ s/^\s+//g; $rhs =~ s/^\s+//g;
	$lhs =~ s/\s+$//g; $rhs =~ s/\s+$//g;

	warn "dup: $lhs $rhs $CAP{$lhs}\n" if defined($CAP{$lhs}) && $debug;

	# save in parallel arrays for later sorting
	push(@lhs, $lhs);
	push(@rhs, $rhs);
    } 

    # this sorting puts "tom christiansen" before "tom"
    for $i ( sort {index($lhs[$b],$lhs[$a]) >= 0} 0..$#lhs) {
	# preserve the lhs's whitespace
	$lhs[$i] =~ s/\s+/(\\s+)/g;
	$reg = 0;
	$rhs[$i] =~ s/\s+/'$' . ++$reg/ge;

	# save code for later eval; lhs's at word boundaries only
	$code .= "s/\\b$lhs[$i]\\b/$rhs[$i]/g;\n"
    }

    print "CODE: $code\n" if $debug;

    # read all input into pattern space
    $/ = undef; # $_ = <>;

    while (<>) {

	tr/A-Z/a-z/	if $squish;

	# find initial letters in sentences, which may have smileys
	s/([.!?](\s*:-\))?)(\n\s*|\s{2,})([a-z])/$1$3\u$4/g;

	# process special case words
	eval $code; die $@ if $@;

	# in case we missed the first word
	s/^(\s*[a-z])/\U$1/;  

	s/(\w+)/$CAP{$1} || $1/ge;

	print;

    }


    __END__
    colorado springs	Colorado Springs
    convex computer corporation	CONVEX Computer Corporation
    i
    unix	UNIX
    tom christiansen	Tom Christiansen
    larry wall	Larry Wall
    dfw	DFW
    grand junction
    long beach
    san diego
    cos	COS
    co	CO
    ca	CA
    tx	TX
    snmp	SNMP
    www	WWW
    faq	FAQ
    star trek
    pc	PC
    bsd BSD
    sysv SysV
    ibm	IBM
    united states

That should give you something to go on.

--tom

--tom
-- 
"I've decided I don't want to be a manager.  Every time you try to be responsive to your employees, they 
say you're being reactive and not proactive.  And when you try to be proactive, they accuse you 
of being capricious and arbitrary.  So I don't wanna be a manager...  " --Larry Wall


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

Date: Sat, 14 Aug 1999 12:51:53 +0200
From: Thomas Schmickl <schmickl@magnet.at>
Subject: Re: Perl/TK issues
Message-Id: <37B54A49.A6D9B3AC@magnet.at>

Donovan Rebbechi schrieb:

> I am wondering if anyone has written a substantial ( say over 1000 lines )
> perl-Tk program. I am interested in seeing the code for some larger
> perl-Tk programs ( because I'm wondering if perl-Tk is suitable
> for sizeable programs -- but then I'd rather die than use Tcl ... )
>
> I am currently coding something which is about 1000 lines at this
> stage, and the naming conventions make it difficult to write
> clean code ( eg in tcl, you have a naming scheme that reflects
> the widget heirarchy, in perl you don't. )
>
> My reason for wanting to build the widget heirarchy into variables is
> because passing widgets to subroutines is very tedious otherwise,
> and you also run out of names for all those widgets (-; My current
> attempt at an answer has been to use anonymous hashrefs to build
> a data structure mirroring the structure of a  widget tree. This
> helps, but is still a tad cumbersome.
>
> I am posting to ask if other people have written long perl-Tk
> programs ( I'd be interested to see how others have handled this if
> they have ) and also to seek advice about what to keep in mind
> when building a (moderately) complex GUI with perl/Tk. I've looked
> at all the ORA books that talk about perl-Tk (panther,
> ram, learning perl/Tk ) but they tend to stick
> with  very simple examples.
>
> Cheers,
> --
> Donovan

Have a look at my project-page mentioned below.

ciao, thomas.

----------------------------------------------------
Thomas Schmickl,
Department for zoology
Karl Franzens University Graz, Austria.
----------------------------------------------------
Visit the GPL e:doc-project on http://members.magnet.at/hfbuch/edoc
or mail me at schmick@magnet.at
----------------------------------------------------




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

Date: Sat, 14 Aug 1999 12:52:27 GMT
From: marcza@my-deja.com
Subject: Sendmail parameter FAQ
Message-Id: <7p3oq9$k2u$1@nnrp1.deja.com>

Sendmail has several parameters e.g.
open(MAIL, "|/usr/lib/sendmail -oi -t -odq");

Is there anywhere in the web a short introduction
about all possible parameters ?

Thanks

Marcus


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


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

Date: 14 Aug 1999 06:41:58 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Sesssion ID
Message-Id: <37b56416@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
: Benjamin Franz <snowhare@long-lake.nihongo.org> wrote [some benchmarks]
:> As you can see, none of (Tom, Aggie and Uri's) proposals are faster than the
:> _original_ code. I (of course ;) ) was able to improve on it slightly.
:
:It looks to me like you improved it partly by cheating.  :)  Why is it that
:every function except yours takes four lines to get to gmtime(), including
:extra variables and a shift, while your function only uses one line, hmm?

Good catch!

--tom
-- 
pos += screamnext[pos]  /* does this goof up anywhere? */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: Sat, 14 Aug 1999 12:42:36 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Sesssion ID
Message-Id: <0vdt3.750$bZ1.69390@typhoon01.swbell.net>

In article <1dwi2p5.6tcknz1arbpczN@p97.tc2.state.ma.tiac.com>,
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:
>
>> Benchmark: timing 100000 iterations of benjamin2, fl_aggie, original,
>>            tomc, uri1, uri2...
>>  benjamin2: 10 wallclock secs ( 8.20 usr +  0.00 sys =  8.20 CPU)
>>   fl_aggie: 11 wallclock secs (10.45 usr +  0.03 sys = 10.48 CPU)
>>   original: 11 wallclock secs ( 9.64 usr +  0.00 sys =  9.64 CPU)
>>       tomc: 13 wallclock secs (12.25 usr +  0.00 sys = 12.25 CPU)
>>       uri1: 14 wallclock secs (13.48 usr +  0.00 sys = 13.48 CPU)
>>       uri2: 14 wallclock secs (12.36 usr +  0.01 sys = 12.37 CPU)
>> 
>> As you can see, none of (Tom, Aggie and Uri's) proposals are faster than the
>> _original_ code. I (of course ;) ) was able to improve on it slightly.
>
>It looks to me like you improved it partly by cheating.  :)  Why is it that
>every function except yours takes four lines to get to gmtime(), including
>extra variables and a shift, while your function only uses one line, hmm?

Because everyone else chose to take the four lines out of context and
replace them while ignoring the rest of the code. They didn't actually
write entire sub-routines. So I *inserted* their changes precisely where
they had *extracted* the original code fragment from. And because I was 
making a joke of sorts. That was also why I benchmarked a routine that
gets executed *ONCE* per CGI call 100000 times. Indicating that the time
spent on this call varies between 0.0014 and 0.0008 seconds. Clearly
a huge source of wasted cycles in the program (remember that the 
*original* 'criticism' was that it could be made more _efficient_.)

'Biida' and the winking smiley were the tip offs. (Fans of Japanese anime
will recognize 'Biida').

>Additionally, you have so much junk in each function that the code you
>intended to benchmark -- simply padding some numbers -- is swamped by code
>that should have been factored out -- declaring variables, calling gmtime,
>and creating and indexing constant lists.

Ah. But I wasn't benchmarking padding number lists. I was benchmarking
creating dates for Netscape cookies.

>And, finally, your function does not do the same thing as the other
>functions; the other functions pad four variables, whereas yours just
>creates a string.  In this case, the string is all that's needed, but I
>believe the other Perlers were operating under the assumption that each of
>the four variables must be padded in place, so it's no surprise your
>function, operating under a different assumption, is faster.

Actually, *they* pulled the four lines out of context of the 
routine.

The purpose of the routine is to return a date for use in a
Netscape cookie. As is obvious in the original code. Everyone
else seems to have lost sight of that goal in favor of worrying 
about how to pad a list of numbers to 2 digits. Which *wasn't* 
the goal - merely a sub-task. Which is also why complaints about 
'scalablity' etc are badly mis-placed. The routine doesn't
need to scale to long lists of numbers. It will *never* need to.

-- 
Benjamin Franz


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

Date: Sat, 14 Aug 1999 06:11:46 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Spawning OS Command from Perl
Message-Id: <37B540E2.71EE1397@patriot.net>

>
> > @args=('notepad',' c:\perl\a.txt');
> > system(@args);
> >
>
> Is the executable you want to run notepad or is it notepad.exe?

I've tried the command on the same setup that Kiran uses...NTServer 4.0,

and I have SP5+.

Not only does notepad NOT open, even when using 'notepad.exe', but
for every attempt, a copy of notepad is running in the task manager.  So

for half a dozen attempts, there are just as many copies of notepad
running
even though I closed out the DOS window I was running the commands in
as well as the editor.

C



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

Date: Sat, 14 Aug 1999 10:08:00 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Spawning OS Command from Perl
Message-Id: <37b63f6b.858807@news.skynet.be>

kiran dronamraju wrote:

>Trying to execute the following code with failure. Please help
>
>@args=('notepad',' c:\perl\a.txt');
>system(@args);
>
>Doesnt work. It works fine on an NTWorkstation and Windows95.
>thank you.

I think it is because you're bypassing the shell. That way, I *think*
system() doesn't even look at PATH. So that it will only work if
"notepad" is in your current directory.

Try supplying the full path to notepad, or make system() use the shell:

	system("notepad c:\\perl\\a.txt");

   HTH,
   Bart.


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

Date: Sat, 14 Aug 1999 12:06:11 +0100
From: Alex Maranda <amaranda@nospam.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B54DA3.4210DC10@nospam.com>

Sam Holden wrote: 
> >
> >>You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
> >>Python. This is Officially Okay in Perl culture.
> >
> >You cannot write Perl that resemble Python.  You are required to
> >use curly braces as block delimiters.
> 
> In fact you are not. You are wrong yet again. Actually thinking about how
> perl works for a minute would show you that perl is in fact flexible.
> it is not a lie when people say perl doesn't force you to write a
> particular way.
> 
> Here is some code from Damian Conway from the 'Impythonating PERL' thread
> in march.
> 
> package impythonate;
> use Text::Tabs;
> my ($active, @bracket) = (0, ('{', ';', '}') );
> sub import
> {
>   return 1 if ($active++);
>   open CODE, $0 or die "couldn't translate $0";
>   my ($code, $transcode, $lastindent) = (join('',<CODE>), '');
>   $code =~ s/\\\n/ /g;
>   foreach (split /\n/, $code)
>   {
>   my ($indent,$notempty) = /\A([ \t]*)(\S?)/;
>   $indent = length(expand($indent));
>   $transcode .= $bracket[1+($lastindent<=>$indent)]
>     if $notempty && defined $lastindent;
>   $transcode .= "$_\n";
>   $lastindent = $indent if $notempty;
>   }
>   eval $transcode and exit or die $@;
> }
> 1;
> 
> And here is his sample code that is now valid perl (although anyone who uses
> it for real code should be killed) :
Why? You don't happen to hate Pythoneers or Python itself, do you? I've
actually appreciated the argument from your second post, when you taxed
the other guy for needlessly questioning your Python knowledge out of
context.
I am completely ignorant with Perl and I can barely read what's above
(by interpolating my knowledge of shell, C, and Tcl).

> 
> #Now newlines replace colons and indentation replaces brackets:
> 
> use impythonate; # STILL NEED THAT ONE SEMICOLON, DAMMIT!
> 
> for $i (1..10)  # COMMENTS ARE OKAY
>   print "$i: "
>   my $isq =  \
>   $i **2 # LINE CONTINUATIONS WORK AS IN PYTHON
>   print " $isq\n"
> 
> print "done\n"
I know Python fairly well (but I'm no expert) and I can easily read this
piece of Perl. Getting back to the killing part, which kind of disturbs
me when reading comp.lang.python:
- was that necessary to make a point?
- if yes, what was the point?
- if the point (just guessing) was that Perl code should never look like
Python, isn't that against of 'there should be more ways of doing it?'

I fail to see the interesting part in this whole thread, which disturbs
the habitat of comp.lang.python. I think John Stevens was mistaken to
bring the discussion over to this newsgroup in the first place. We don't
have strong feelings about Perl, and don't have plans for world
domination or anything.

A couple of days ago I read a bit in Bugzilla's README which amused me:
"A computer which doesn't have Perl installed is a very sad computer
indeed". Your post is frightening (unless it was a Perl-style joke).

Regards (I guess),
Alex


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

Date: Sat, 14 Aug 1999 11:39:14 GMT
From: dave@see.sig.for.address (Dave)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b6500c.2143627@read.news.global.net.uk>

On 13 Aug 1999 20:13:52 -0700, John Stevens
<jstevens@bamboo.verinet.com> wrote:
> [blah blah blah]

John, please refrain from cross-posting all your messages to
comp.lang.python. If there is anything worse than getting a long and
pointless flame war, it is getting half a flame war. By cross posting
you are clearly trying to drag the readers of c.l.py into the
argument, which is pure trolling.  If you continue you will merely
succeed in pissing off two newsgroups instead of one.

The 'my language is better than yours' debates are always pointless
and counterproductive, and perl vs. python has been done countless
times before. Life is too short, live and let live [insert other
cliches to taste].

Incidentally you are wrong about perl arrays and python lists being
different data structures - internally they are both implemented as C
arrays, only the names are different. 

  Dave Kirby

--------------------------------------------------
All great ideas start as heresy and end as dogma.

dkirby@   <-figure this out, spambots!
bigfoot.   My opinions are my own,
com        but I'm willing to share.


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

Date: 14 Aug 1999 06:33:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b56201@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Russ Allbery <rra@stanford.edu> writes:
:> What's a "scripting" language, for goodness sake?
:
:It's a programming language with high-level constructs for glue
:applications, a programming language that can easily embed other languages
:and be embedded in other applications, which can easily talk to processes,
:pipes, and network sockets, and which has dynamically resizeable data
:structures including strings.
:
:Those are the characteristics that seem common across all of Tcl, Perl,
:Python, and the other languages normally called scripting languages, but
:have no native support in C and C++.

I wonder whether "native support" should include standard libraries?  The
STL folks certainly cluck proudly about their dynamic structures for C++.
And I'm not sure about *easily* talking to processes, pipes, and network
sockets versus merely talking to them.  But you bring up an interesting
point right there: The thing communicated with is an independent active
agent, not merely a passive file or device.  This reminds me more of
the traditional chat script (per uucp or the newer dip stuff), expect
scripts, or job control scripts (even if they're not called JCL :-).

But I certainly wouldn't relish embedding dynamically compiled C code 
into a larger application.  I'll certainly give you that much. :-)

--tom
-- 
    All language designers are arrogant.  Goes with the territory... :-)
	    --Larry Wall in <1991Jul13.010945.19157@netlabs.com


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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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