[28186] in Perl-Users-Digest
Perl-Users Digest, Issue: 9550 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 2 18:05:56 2006
Date: Wed, 2 Aug 2006 15:05:08 -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 Wed, 2 Aug 2006 Volume: 10 Number: 9550
Today's topics:
Re: executing perl script without .pl extension <mgarrish@gmail.com>
Re: executing perl script without .pl extension <veatchla@yahoo.com>
How probably not to hand over a variable from one perl <youcontrol@hispeed.ch>
Re: How probably not to hand over a variable from one p usenet@DavidFilmer.com
Re: How probably not to hand over a variable from one p usenet@DavidFilmer.com
Re: How probably not to hand over a variable from one p <1usa@llenroc.ude.invalid>
Re: how to "anonymize" Perl script before publishing it <tzz@lifelogs.com>
Re: how to "anonymize" Perl script before publishing it usenet@DavidFilmer.com
Re: How to "convert" a string into a variable name? <youcontrol@hispeed.ch>
Re: perl editor <bik.mido@tiscalinet.it>
Re: perl editor <abigail@abigail.be>
Re: perl editor <abigail@abigail.be>
Re: perl editor <bik.mido@tiscalinet.it>
Re: perl editor tinnews@isbd.co.uk
Re: perl editor <abigail@abigail.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Aug 2006 13:42:29 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: executing perl script without .pl extension
Message-Id: <1154551349.082033.262730@m73g2000cwd.googlegroups.com>
Paul Lalli wrote:
> tweaky@gmail.com wrote:
> > Hey all, I'm doing some testing w/ a WinXP setup (don't ask) and IIS
> > 5.1. Going to test Twiki on it, but I'm having a small issue. I'd like
> > to run the perl scripts without having to type in the .pl.
> >
> > Example:
> >
> > http://www.test.com/script (where script is a perl file at the root of
> > the public web directory).
> >
> > I could've sworn I did this on a test environment last week (same
> > setup), but I can't remember how.
> >
> > Any suggestions?
>
> It looks as though you have a webserver configuration issue, not a Perl
> issue. That is, your question has nothing to do with the actual Perl
> language. The files that you want to access by munging their filenames
> just happen to contain Perl code.
Filtering sounds so much nicer. Can't be done in IIS without an ISAPI
filter to my knowledge, though (but this is the wrong place to be
asking).
I always enjoy the "I don't know what I'm talking about but I'll
pretend it was working last week" approach to questions, though. : )
Matt
------------------------------
Date: 2 Aug 2006 14:07:57 -0700
From: "l v" <veatchla@yahoo.com>
Subject: Re: executing perl script without .pl extension
Message-Id: <1154552877.616079.197000@m79g2000cwm.googlegroups.com>
Matt Garrish wrote:
> Paul Lalli wrote:
>
>
>>tweaky@gmail.com wrote:
>>
>>>Hey all, I'm doing some testing w/ a WinXP setup (don't ask) and IIS
>>>5.1. Going to test Twiki on it, but I'm having a small issue. I'd like
>>>to run the perl scripts without having to type in the .pl.
>>>
>>>Example:
>>>
>>>http://www.test.com/script (where script is a perl file at the root of
>>>the public web directory).
>>>
>>>I could've sworn I did this on a test environment last week (same
>>>setup), but I can't remember how.
>>>
>>>Any suggestions?
>>
>>It looks as though you have a webserver configuration issue, not a Perl
>>issue. That is, your question has nothing to do with the actual Perl
>>language. The files that you want to access by munging their filenames
>>just happen to contain Perl code.
>
>
> Filtering sounds so much nicer. Can't be done in IIS without an ISAPI
> filter to my knowledge, though (but this is the wrong place to be
> asking).
>
> I always enjoy the "I don't know what I'm talking about but I'll
> pretend it was working last week" approach to questions, though. : )
>
> Matt
>
The ISAPI filter can be the Perl script. But I agree, there are better
newgroups to post in order to get the best way to do it.
--
Len
------------------------------
Date: Wed, 2 Aug 2006 22:33:21 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: How probably not to hand over a variable from one perl script to another
Message-Id: <44d10c12@news1.ethz.ch>
Hi,
I guess there are better ways to hand over a variable from one perl
script to another. Knowing very little about Perl I came up with this
solution:
$variable = 1;
open TEMP, ">temp.txt";
truncate TEMP, 1;
print TEMP "$variable\n";
close TEMP;
system "runit.pl";
>>>pico runit.pl
#! /usr/bin/perl
@ARGV = qw# temp.txt #;
while (defined($line = <>)) {
$cta += 1;
@inval{$cta} = $line;
}
chomp($variable = $inval{1});
Cheers,
Markus
------------------------------
Date: 2 Aug 2006 13:48:55 -0700
From: usenet@DavidFilmer.com
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <1154551735.916170.107620@s13g2000cwa.googlegroups.com>
Markus H=E4nchen wrote:
> I guess there are better ways to hand over a variable
You could say that. If that was how Perl passed variables, I'd be using
Python.
Read up on how @ARGV works.
--=20
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 2 Aug 2006 13:50:41 -0700
From: usenet@DavidFilmer.com
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <1154551841.434979.103580@m79g2000cwm.googlegroups.com>
use...@DavidFilmer.com wrote:
> Read up on how @ARGV works.
Oops - meant to give you a reference:
perldoc perlvar
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Wed, 02 Aug 2006 21:13:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How probably not to hand over a variable from one perl script to another
Message-Id: <Xns9813AF567B2B3asu1cornelledu@127.0.0.1>
Markus Hδnchen <youcontrol@hispeed.ch> wrote in news:44d10c12
@news1.ethz.ch:
> I guess there are better ways to hand over a variable from one perl
> script to another. Knowing very little about Perl I came up with this
> solution:
Don't take this the wrong way, but when you find yourself doing stuff like
this, you've gotta stop and hit the manuals/books.
use strict;
use warnings;
missing.
> $variable = 1;
my $temp_file = 'temp.txt';
my $variable = 1;
> open TEMP, ">temp.txt";
open my $temp_fh, '>', $temp_file
or die "Cannot open '$temp_file' for writing: $!";
The three-argument form is not necessary in this case, but it is a good
habit for you to get into early on. Read also:
perldoc perlopentut
Now, checking if open succeeded is not optional. There is no point in
continuing at this point if you cannot open that file for writing.
> truncate TEMP, 1;
Given that you are opening the file with '>', I don't see what function
this serves. Also, use consistent indentation.
> print TEMP "$variable\n";
Given that being able to write successfully to this file is a prerequisite
to invoking the second script, checking if print succeeded is not optional
either.
print $temp_fh $variable, "\n"
or die "Cannot write to '$temp_file': $!";
> close TEMP;
Ditto.
close $temp_fh or die "Cannot close '$temp_file': $!";
> system "runit.pl";
>
>>>>pico runit.pl
> #! /usr/bin/perl
> @ARGV = qw# temp.txt #;
There is no need to hard wire the name of the file in this script.
system runit.pl $temp_file;
#!/usr/bin/perl
> while (defined($line = <>)) {
> $cta += 1;
> @inval{$cta} = $line;
> }
I have no idea what you are doing here.
> chomp($variable = $inval{1});
Now, I don't see a good reason in this case for using temporary files. Why
not pass the argument directly on the command line?
system 'runit.pl', $variable;
Finally, if you are trying to factor out functionality, you probably want
to put together a module and use it.
perldoc perlmod
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 02 Aug 2006 14:45:27 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: how to "anonymize" Perl script before publishing it?
Message-Id: <g69u04vht88.fsf@CN1374059D0130.kendall.corp.akamai.com>
On 2 Aug 2006, nobody@dizum.com wrote:
> I want to publish a few of my Perl programs on usenet but I don't want
> it to be obvious who wrote them.
Run it through Acme::Buffy.
http://search.cpan.org/~lbrocard/Acme-Buffy-1.3/lib/Acme/Buffy.pm
(I'm joking)
> Any tips on "personal style" aspects of Perl that I need to watch out
> for to depersonalize or anonymize them?
Indentation, comments, and variable/subroutine names should be removed
and obfuscated respectively. Try a Perl obfuscator. I haven't used
any, but
http://search.cpan.org/~smueller/PAR-0.942/lib/PAR/Filter/Obfuscate.pm
could be useful.
Based on the data structures, modules, and flow control it's usually
easy to tell how experienced the author is. You can't hide this.
If you explain more about your reasons, and the possible audience of
your code who may want to find you, we could give you better advice.
Ted
------------------------------
Date: 2 Aug 2006 11:54:05 -0700
From: usenet@DavidFilmer.com
Subject: Re: how to "anonymize" Perl script before publishing it?
Message-Id: <1154544845.876834.219070@m73g2000cwd.googlegroups.com>
Nomen Nescio wrote:
> I want to publish a few of my Perl programs on usenet but I don't want
> it to be obvious who wrote them.
You can always use Acme::Bleach to 'clean up' your program:
http://search.cpan.org/~dconway/Acme-Bleach-1.12/lib/Acme/Bleach.pm
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Wed, 2 Aug 2006 22:14:18 +0200
From: =?ISO-8859-1?Q?Markus_H=E4nchen?= <youcontrol@hispeed.ch>
Subject: Re: How to "convert" a string into a variable name?
Message-Id: <44d1079b@news1.ethz.ch>
> While it's good that you found *a* solution on your own, I must caution
> you that this is a *bad* solution. Very very bad. eval() is a powerful
> but dangerous function. If at any point, the string you're eval'ing
> contains input from a user, you could do some serious damage to your
> program and to your system.
>
> A *good* solution is to _not_ try to create a variable name out of a
> string. Instead, store all the "variables" you want to access this way
> in a hash. The keys are whatever you currently have as a variable
> name, and the value is the value you wanted to assign to that variable.
> Using that method, your example above becomes:
>
> my %value_of
> $value_of{TempOut} = 25;
> $name = 'Temp' . 'Out';
> print $value_of{$name};
Thanks Paul. I really should use a hash (not least since my eval string
gets user input...).
------------------------------
Date: 2 Aug 2006 20:27:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: perl editor
Message-Id: <per1d2l6a6e2g71v9psjf29jodccoc76a3@4ax.com>
On Wed, 02 Aug 2006 12:52:11 -0400, Ted Zlatanov <tzz@lifelogs.com>
wrote:
>>> vim isn't vi. Despite toy OS distro's firing up 'vim' is you type 'vi'.
>>
>> What should they do? Avoid it altogether? I don't use vi myself, but I
>> wouldn't regard it as such a bad thing...
>
>I think Abigail is referring to the original request for a "free"
>editor, which vi isn't but vim is.
I understood that. I was specifically referring to the fact that some
distros "fire up 'vim' is you type 'vi'", which Abigail seems to
condemn by attaching a "toy" judgement to those distros, but which
doesn't seem such a bad thing to me.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 02 Aug 2006 18:54:57 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: perl editor
Message-Id: <slrned1t81.sce.abigail@alexandra.abigail.be>
Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMDCCXIX September
MCMXCIII in <URL:news:kuq0d294275v8jhckf649gi1mke1phr6cs@4ax.com>:
;; On 01 Aug 2006 20:17:20 GMT, Abigail <abigail@abigail.be> wrote:
;;
;; >vim isn't vi. Despite toy OS distro's firing up 'vim' is you type 'vi'.
;;
;; What should they do? Avoid it altogether? I don't use vi myself, but I
;; wouldn't regard it as such a bad thing...
If it doesn't have 'vi', it shouldn't start 'vim'. Just as it shouldn't
start 'emacs' if it doesn't have 'vi'.
'vim' isn't 'vi'. So it shouldn't be called 'vi'.
Abigail
--
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'
------------------------------
Date: 02 Aug 2006 19:00:12 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: perl editor
Message-Id: <slrned1ths.sce.abigail@alexandra.abigail.be>
Ted Zlatanov (tzz@lifelogs.com) wrote on MMMMDCCXIX September MCMXCIII in
<URL:news:g69vepbjd1g.fsf@CN1374059D0130.kendall.corp.akamai.com>:
<> On 2 Aug 2006, bik.mido@tiscalinet.it wrote:
<>
<> On 01 Aug 2006 20:17:20 GMT, Abigail <abigail@abigail.be> wrote:
<> >
<> >> vim isn't vi. Despite toy OS distro's firing up 'vim' is you type 'vi'.
<> >
<> > What should they do? Avoid it altogether? I don't use vi myself, but I
<> > wouldn't regard it as such a bad thing...
<>
<> I think Abigail is referring to the original request for a "free"
<> editor, which vi isn't but vim is.
<>
<> Plain vi is pretty awful, so it should probably be avoided altogether.
<> I speak from experience, having used vi on Solaris for a while.
<> Compared to vim it's simply outdated, and it has too many limitations
<> to be useful for any serious programming. For Perl specifically,
<> vim's support is much better.
I do most of my Perl coding in 'vile', another 'vi' clone. However, over
99% of the commands I use would be identical in either 'vile' and 'vi'.
I'd say that 'vi' is more than sufficient for coding Perl. Some of the
extras of the 'vi' clones are nice to have, but I've yet to find a
feature that's impossible to live without.
Abigail
--
#!/opt/perl/bin/perl -- # No trailing newline after the last line!
BEGIN{$|=$SIG{__WARN__}=sub{$_=$_[0];y-_- -;print/(.)"$/;seek _,-open(_
,"+<$0"),2;truncate _,tell _;close _;exec$0}}//rekcaH_lreP_rehtona_tsuJ
------------------------------
Date: 2 Aug 2006 21:09:49 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: perl editor
Message-Id: <2vt1d25o3kgllqtcv133rq49ajlb9rv4l8@4ax.com>
On 02 Aug 2006 18:54:57 GMT, Abigail <abigail@abigail.be> wrote:
>;; What should they do? Avoid it altogether? I don't use vi myself, but I
>;; wouldn't regard it as such a bad thing...
>
>
>If it doesn't have 'vi', it shouldn't start 'vim'. Just as it shouldn't
>start 'emacs' if it doesn't have 'vi'.
>
>'vim' isn't 'vi'. So it shouldn't be called 'vi'.
Point taken! (Although I have the impression that this won't bother
the vast majority of users, and those distros are appearently aimed at
satisfying the needs of that vaste majority...)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 02 Aug 2006 19:53:51 GMT
From: tinnews@isbd.co.uk
Subject: Re: perl editor
Message-Id: <44d102cf$0$640$bed64819@news.gradwell.net>
Abigail <abigail@abigail.be> wrote:
> Ted Zlatanov (tzz@lifelogs.com) wrote on MMMMDCCXIX September MCMXCIII in
> <URL:news:g69vepbjd1g.fsf@CN1374059D0130.kendall.corp.akamai.com>:
> <> On 2 Aug 2006, bik.mido@tiscalinet.it wrote:
> <>
> <> On 01 Aug 2006 20:17:20 GMT, Abigail <abigail@abigail.be> wrote:
> <> >
> <> >> vim isn't vi. Despite toy OS distro's firing up 'vim' is you type 'vi'.
> <> >
> <> > What should they do? Avoid it altogether? I don't use vi myself, but I
> <> > wouldn't regard it as such a bad thing...
> <>
> <> I think Abigail is referring to the original request for a "free"
> <> editor, which vi isn't but vim is.
> <>
> <> Plain vi is pretty awful, so it should probably be avoided altogether.
> <> I speak from experience, having used vi on Solaris for a while.
> <> Compared to vim it's simply outdated, and it has too many limitations
> <> to be useful for any serious programming. For Perl specifically,
> <> vim's support is much better.
>
>
> I do most of my Perl coding in 'vile', another 'vi' clone. However, over
> 99% of the commands I use would be identical in either 'vile' and 'vi'.
>
Hurrah, another vile user! :-)
--
Chris Green
------------------------------
Date: 02 Aug 2006 20:19:52 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: perl editor
Message-Id: <slrned2278.24r.abigail@alexandra.abigail.be>
Michele Dondi (bik.mido@tiscalinet.it) wrote on MMMMDCCXIX September
MCMXCIII in <URL:news:2vt1d25o3kgllqtcv133rq49ajlb9rv4l8@4ax.com>:
** On 02 Aug 2006 18:54:57 GMT, Abigail <abigail@abigail.be> wrote:
**
** >;; What should they do? Avoid it altogether? I don't use vi myself, but I
** >;; wouldn't regard it as such a bad thing...
** >
** >
** >If it doesn't have 'vi', it shouldn't start 'vim'. Just as it shouldn't
** >start 'emacs' if it doesn't have 'vi'.
** >
** >'vim' isn't 'vi'. So it shouldn't be called 'vi'.
**
** Point taken! (Although I have the impression that this won't bother
** the vast majority of users, and those distros are appearently aimed at
** satisfying the needs of that vaste majority...)
Hence my classification of 'toy distros'.
Abigail
--
perl -we 'eval {die ["Just another Perl Hacker\n"]}; print ${${@}}[$#{@{${@}}}]'
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V10 Issue 9550
***************************************