[23988] in Perl-Users-Digest
Perl-Users Digest, Issue: 6189 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 27 14:05:42 2004
Date: Fri, 27 Feb 2004 11:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 27 Feb 2004 Volume: 10 Number: 6189
Today's topics:
Re: Coderef usage in complex data structures nobull@mail.com
Re: Comments requested: brief summary of Perl <bik.mido@tiscalinet.it>
Re: Comments requested: brief summary of Perl <bik.mido@tiscalinet.it>
Re: Comments requested: brief summary of Perl (Malcolm Dew-Jones)
complex regex (Sami)
Re: complex regex <jgibson@mail.arc.nasa.gov>
Re: complex regex <jwillmore@remove.adelphia.net>
Re: Double Jump Box Redirection <mr@sandman.net>
Re: How to access filehandle through globref? <jill_krugman@yahoo.com>
Re: How to reassign DB::OUT? <nospam-abuse@ilyaz.org>
Re: How to send cookie and redirect in a cgi script? <flavell@ph.gla.ac.uk>
Re: Module Install on XP Question <Petri_member@newsguy.com>
Re: Multiple substitution in a complex RE (SqlSlinger)
Re: Perl Permissions on Windows <arthur0421@163.com>
Re: Regexp problem <nomail_nospam@nopain.nopain.com>
Re: RegExp Replace Using a Variable nobull@mail.com
Re: return multiple arrays from functions <uri@stemsystems.com>
site launch <greger@[NOSPAM-PLEASE]gh-webinteractive.com>
Thanks for the advice <jwcorpening@verizon.net>
Re: using sed from with a perl script <bik.mido@tiscalinet.it>
Re: using sed from with a perl script <fifo@despammed.com>
Re: your partner <greger@[NOSPAM-PLEASE]gh-webinteractive.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Feb 2004 09:59:50 -0800
From: nobull@mail.com
Subject: Re: Coderef usage in complex data structures
Message-Id: <4dafc536.0402270959.5905afd8@posting.google.com>
Tad McClellan <tadmc@augustmail.com> wrote in message news:<slrnc3s0gj.3hl.tadmc@magna.augustmail.com>...
>
> It looks to me like the docs for strict.pm are incomplete|misleading|wrong.
Yes it is.
>
> perldoc strict
>
> "strict refs"
> ...
> There is one exception to this rule:
>
> $bar = \&{'foo'};
> &$bar;
>
>
> The docs do not provide a specification for the exception, only
> an example of an exception.
>
> The example has no runtime-ness in the symbol, so you could
> reasonably conclude that the exception is only at compile-time,
> while it looks like we are seeing runtime stuff being excepted...
Well, the exception would be rather meaningless if it were restricted
to constant expressions. I don't really think it would be
_reasonable_ to conclude that the exception is only for constant
expressions.
So if we assume the exception is not totally pointless then we can
infer that it must mean that you can derefernce a symbolic coderef as
the argument to the \ operator without having to relax strict. I
agree that it would be better for the docs to spell this out.
Actually, however, this is not the full story. You can also
dereference a symbolic coderef as the argument to goto(), defined() or
exists().
Indeed strict.pm goes on to mention goto() - thus having said there's
only one exception it lists two!
The purpose of use strict is to avoid the compiler thinking you want a
symref when you accidently get a string where you wanted a reference.
This is unlikely to be the case in the above situatiuons so it's more
convenient to have them excluded.
However, until this is documented I'm going to continue to put "no
strict 'refs'" in my AUTOLOAD functions.
I'm sorry that the following patch is line-wrap damaged, I'm having to
post via Google due to NNTP problems here.
--- perl5/5.8.0/strict.pm Fri Nov 1 15:39:49 2002
+++ strict.pm Fri Feb 27 17:52:35 2004
@@ -37,13 +37,18 @@
$file = "STDOUT";
print $file "Hi!"; # error; note: no comma after $file
-There is one exception to this rule:
-
- $bar = \&{'foo'};
- &$bar;
-
-is allowed so that C<goto &$AUTOLOAD> would not break under
stricture.
+There is an exception to this rule. You can dereference a string as
a
+subroutine as the argument to C<goto()>, C<defined()>, C<exits()> or
+the backslask operator.
+
+ $symref = 'foo';
+ $ref = \&$symref; # ok
+ goto &$symref; # ok
+ if ( defined &$symref ) { do_stuff() } # ok
+ if ( exists &$symref ) { do_stuff() } # ok
+This allowed, not because symbolic code references are a good thing,
+but so that AUTOLOAD methods do not need to switch off the stricture.
=item C<strict vars>
------------------------------
Date: Fri, 27 Feb 2004 15:56:51 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Comments requested: brief summary of Perl
Message-Id: <hrku309rcm7tpclj9dqh58evd5oq565c4k@4ax.com>
On 23 Feb 2004 22:33:37 -0800, adamba@gte.net (Adam Barr) wrote:
>The file is at
>
>http://www.proudlyserving.com/language/perl.pdf
Some more cmts...
[about REs]
| () can be used to group parts of a regular expression
^^^
But does a lot more than that, with side-effects. For simple grouping
you can use (?: ... ) instead.
| if ($phone =~ /\d{3}\-\d{4}/) {
if ($phone =~ /\d{3}-\d{4}/) {
| The return statement is actually optional; if it is missing, then the subroutine will return the
| value of the last expression calculated, or undef if no expressions were calculated.
But it becomes necessary if one wants to exit early from a sub, as is
often the case e.g. with recursive ones...
| Variables local to a function can be declared with the my operator, so the previous function
| could be written:
Variables local to "anything"! As you should have clearly stated much
above...
| accesses the global variable by name. And, for reasons which are best left to Perl wizards to
| explain, you can't use my on a file handle, you have to use local.
But with recent enough perls it is much better and highly recommended
to use lexical filehandles (unless backwards compatibility is an
issue), as you may explain in the section about open():
my $all = do {
open my $fh, '<', $file or die $!;
local $/;
<$fh> };
Hmmm, seems like eventually I finished it! These are more or less the
cmts and suggestion I felt like giving about your work. Other posters
(Hey, Ben!!) may correct me if, as is unfortunately usual, further
imprecisions have inadvertently slipped in...
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Fri, 27 Feb 2004 15:56:53 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Comments requested: brief summary of Perl
Message-Id: <e8mu30pvj3i4h0u53iudm2enlaeciico9h@4ax.com>
On Thu, 26 Feb 2004 22:21:47 +0000 (UTC), Ben Morrow
<usenet@morrow.me.uk> wrote:
>> I think this is not clear, I'd express the concept saying: "assignment
>> returns a value too, exactly the rvalue that was assigned to the
>> lvalue", or variations thereof.
>
>No, it returns the assigned-to lvalue. This is why
>
>(my $x = $y) =~ s/a/b/;
>
>does what it does.
Yes, it's obvious. Now that you tell me! An yet I've used such
constructs who knows how many times... Thank you for the
clarification.
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: 27 Feb 2004 10:07:10 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Comments requested: brief summary of Perl
Message-Id: <403f874e@news.victoria.tc.ca>
Michele Dondi (bik.mido@tiscalinet.it) wrote:
: | As a shortcut for lists of strings, you can use qw (the letter q followed by the letter w):
: ^^^^^^^
: Of "words"!
not really words, actually fairly arbitrary strings, just as long as they
don't have white space in them, try the following
e.g.
@a=qw( s/one/two/g; $x=sub{print"hello"}; );
eval $a[1];
&$x;
--
Web Work Wanted, Perl Projects Programmed, Database Development Done.
I'm looking for telecommute projects. (Paying that is, various
arrangements possible.)
------------------------------
Date: 27 Feb 2004 07:51:36 -0800
From: amoura@sbcglobal.net (Sami)
Subject: complex regex
Message-Id: <dd593a87.0402270751.55f32bf@posting.google.com>
Hi There, I have a challenging problem here , atleast to me . I have a
file contains students information as follow:
GRADE MATH COMPUTER HISTORY GOVERNEMENT
A Sue DON
Mike
TOM
B+ Sue
What I am doing is reading the student information with the grade and
class and updating that information file. I need to watchout for not
inserting information for the same student twice for one subject. I am
able to find the grade but not able to instert the entry in the
correct location .
my $Info="/home/Info";
print " Enter the GRADE\n";
my $grd = <STDIN>;
#Don't forget to get rid of the newline character from the input
chomp $GRADE;
print " Enter the SUBJECT\n";
my $subj = <STDIN>;
#Don't forget to get rid of the newline character from the input
chomp $subj;
print " Enter the Student Name\n";
my $std = <STDIN>;
#Don't forget to get rid of the newline character from the input
chomp $std;
&update($grd, $subj, $std);
sub update {
my $grade = $_[0];
my $subject = $_[1];
my $name = $_[2];
#Open the file and read it in:
open(FILE, "$Info") || die "couldn't open $Info for reading";
#Each line is stored in an array
my @in=<FILE>;
close(FILE);
#Now open the same file again for output
open (FILE, ">$Info") ||die "couldn't open $Info for writing";
#Now print out everything and update:
for (@in)
{
print FILE ;
if /^$grade/ # and here where I lose it ,, what to do to match
+ the rest :(
}
close(FILE);
Can someone advide please ? thanks much
------------------------------
Date: Fri, 27 Feb 2004 09:10:12 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: complex regex
Message-Id: <270220040910129550%jgibson@mail.arc.nasa.gov>
In article <dd593a87.0402270751.55f32bf@posting.google.com>, Sami
<amoura@sbcglobal.net> wrote:
> Hi There, I have a challenging problem here , atleast to me . I have a
> file contains students information as follow:
>
>
> GRADE MATH COMPUTER HISTORY GOVERNEMENT
> A Sue DON
> Mike
> TOM
> B+ Sue
You have a "database" problem, here. You want a set of persistent data
that stores subjects, students, and grades. This is also a "relational
database" problem, in that you have three things that are related.
If this is a "real" program to solve some task, then you should be
investigating database-based solutions. Perl gives you access to many,
including some free ones, such as MySQL and Postgres, and even some
perl specific solutions. Since I haven't used any of these, I won't
recommend any or even describe them. Perhaps someone who has used them
will suggest one. You can also search the archive of free, downloadable
Perl modules at www.cpan.org.
If this is just a learning program, then I have some additional
suggestions:
The data shown above has a somewhat form-free structure. You are better
off making it more structured and restrictive. Something like:
MATH,Sue,A
MATH,Mike,A
COMPUTER,DON,A
COMPUTER,Sue,B+
HISTORY,TOM,B+
Note that this is not as readable for a person, but it is much easier
for a program to parse. If you want a nicely-formatted report, you can
write a program to take this file and generate the report shown above.
Once you have a good representation of your data, the programming
becomes much easier.
>
>
> What I am doing is reading the student information with the grade and
> class and updating that information file. I need to watchout for not
> inserting information for the same student twice for one subject. I am
> able to find the grade but not able to instert the entry in the
> correct location .
You should be posting a complete, workable program that demonstrates
the problem you are having.
You should also always include the following lines at the beginning of
your program:
use strict;
use warnings;
>
> my $Info="/home/Info";
>
> print " Enter the GRADE\n";
> my $grd = <STDIN>;
> #Don't forget to get rid of the newline character from the input
> chomp $GRADE;
For the benefit of those trying to help you, none of whom ever forget
to get rid of the newline character from the input, please leave out
the unnecessary (for us) comments.
>
> print " Enter the SUBJECT\n";
> my $subj = <STDIN>;
> #Don't forget to get rid of the newline character from the input
> chomp $subj;
>
> print " Enter the Student Name\n";
> my $std = <STDIN>;
> #Don't forget to get rid of the newline character from the input
> chomp $std;
>
>
> &update($grd, $subj, $std);
You should not call subroutines using the ampersand unless you are
aware of the effect of that and need it.
>
>
>
> sub update {
> my $grade = $_[0];
Please use proper indenting to make your program more readable. Indent
loops, compound statements such as subroutines.
> my $subject = $_[1];
> my $name = $_[2];
my( $grade, $subject, $name ) + @_;
>
> #Open the file and read it in:
> open(FILE, "$Info") || die "couldn't open $Info for reading";
> #Each line is stored in an array
> my @in=<FILE>;
> close(FILE);
Don't forget to get rid of the newline character from the input:
chomp(@in);
You are better off writing to an output file that is different than the
input file. This has two advantages: 1) you can have them both open at
the same time, which can make a difference when your dataset gets
really big, and 2) if your program crashes after you have opening the
output file, you won't wipe out your data. After you have successfully
written the output file, rename the input file as a backup set and then
rename the output file to the name of the input file.
>
>
> #Now open the same file again for output
> open (FILE, ">$Info") ||die "couldn't open $Info for writing";
open( FILE, ">$Info.tmp" ) or die("Couldn't open $Info.tmp for
writing: $!");
You should use "or" instead of "||" for precedence reasons and include
the reason ($!) in your message.
>
> #Now print out everything and update:
> for (@in)
> {
> print FILE ;
> if /^$grade/ # and here where I lose it ,, what to do to match
> + the rest :(
Here, you would look for a match to subject, student, and grade. If you
use the modified data structure above, you could say:
my( $sub,$stu,$grd ) = split(',');
if( ($subject eq $sub) && ($name eq $stu) ) {
# you have found a duplicate entry
print "Duplicate entry for ($subject,$student)\n;
You could also replace the old entry with the new if that is what you
want:
$_ = "$subject,$student,$grade";
}
Since we got rid of the newline:
print FILE "$_\n";
> }
> close(FILE);
>
>
> Can someone advide please ? thanks much
HTH.
------------------------------
Date: Fri, 27 Feb 2004 13:12:07 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: complex regex
Message-Id: <pan.2004.02.27.18.12.05.117908@remove.adelphia.net>
On Fri, 27 Feb 2004 07:51:36 -0800, Sami wrote:
> Hi There, I have a challenging problem here , atleast to me . I have a
> file contains students information as follow:
>
>
> GRADE MATH COMPUTER HISTORY GOVERNEMENT
> A Sue DON
> Mike
> TOM
> B+ Sue
>
>
> What I am doing is reading the student information with the grade and
> class and updating that information file. I need to watchout for not
> inserting information for the same student twice for one subject. I am
> able to find the grade but not able to instert the entry in the
> correct location .
[snip]
> Can someone advide please ? thanks much
Short answer - use DBD::CSV :-)
Explaination - if you want to use a database, but really it's just a "flat
file" that "thinks" it's a database, then using DBI with DBD::CSV, IMHO,
is the way to go. I suggest this because ....
* a CSV file can be read/written/etc. from an editor as well as a script
of your own design.
* you can use SQL againist the file to not only prevent duplication, but
do such wonderful things as calculating averages and selecting grades for
one student only.
* when you decide that you hvae quite a bit of information in this file
and want to use a "real" database, it won't be such a pain to convert.
And the script(s) you write will only need one or two lines changed versus
total re-writing.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
The hardest thing in the world to understand is the income tax.
-- Albert Einstein
------------------------------
Date: Fri, 27 Feb 2004 18:14:08 +0100
From: Sandman <mr@sandman.net>
Subject: Re: Double Jump Box Redirection
Message-Id: <mr-B4933B.18140827022004@news.fu-berlin.de>
In article <f18c773b.0402261823.5008e693@posting.google.com>,
kenton_mcleod@hotmail.com (Kenton) wrote:
> Hi
>
> Been pulling my hair out for hours on this one and I was wondering if
> anyone could help.
>
> I would like two drop down lists for navigation.
> One to select state and one to select product.
> So that selecting option 1, option 1 gives you
> http://www.example.com/state_1/product1.htm
>
> I started using javascript but in my travels have been scared off it.
>
> So that leave me with pearl.
>
> Given I have a form (remnants of my JS) with 2 drop down lists similar
> to below can pearl cope with the redirect or do I need something
> different?
>
> <form name="RegionProduct" method="get" action="">
> <select name="region" size="1" >
> <option selected value="">Select your region</option>
> <option value="state_1/">state 1</option>
> <option value="state_2/">state 2</option>
> </select>
> <select name="service" size="1" >
> <option selected value="index.htm">Select service</option>
> <option value="widgets.htm">Widgets</option>
> <option value="wodgets.htm">Wodgets</option>
> </select>
> <input name="button" type="button" onClick="????????????????"
>
> Any help would be greatly appreciated
> Kenton
All you seem to have recieved was attitude.
What you want to do is quite possible with perl, allthough not using the method
you would use with JavaScript.
As others have pointed out, JavaScript is a client-side scripting language,
meaning you can write code ein your html that the web browser will perform.
Perl, on the other hand, is server-side scripting, meaning that a browser
couldn't cope with perl code, but you can run perl scripts to generate code
that a browser can deal with, such as HTML or even JavaScript.
To solve your problem in JavaScript, you would use a function pretty much like
this:
function go(){
top.location = "http://www.example.com/" + document.formName.region[document.formName.region.selectedIndex].value +
"/" + document.formName.service[document.formName.service.selectedIndex].value
+ ".htm";
}
And then call on function go() in your onclick="".
Using perl, you would have to use a "proxy-script" that will take the values of
those two popups as post/get-data and then redirect the browser accordingly. A
script that looks something like this (been a while since I used CGI though):
#!/usr/bin/perl
use CGI;
ReadParse;
print "Location: http://www.example.com/$in{region}/$in{service}.htm\n\n";
I think you'd be better off doing this in JavaScript, though.
--
Sandman[.net]
------------------------------
Date: Fri, 27 Feb 2004 14:39:00 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: Re: How to access filehandle through globref?
Message-Id: <c1nkq4$4oo$1@reader2.panix.com>
In <c1n7uj$g8q$1@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:
>J Krugman <jill_krugman@yahoo.com> wrote:
>> I'm trying to find a way to temporarily reassign DB::OUT in perldb.
>> Everything I've tried has failed...
>>
>> The reason I want to reassign DB::OUT is that I want to capture
>> the output of certain perldb commands (e.g. x or V) to a file.
>open my $SAVE_DBOUT, '>&=', DB::OUT;
>open DB::OUT, '>', 'file';
>...
>open DB::OUT, '>&=', $SAVE_DBOUT;
>If you're not using 5.8 you'll need to change those to
>open my $SAVE_DBOUT, '>&=' . fileno DB::OUT;
Many thanks! This is great to know.
>> P.S. "X-Y problem"???
>This a common expression here... it means 'you asked how to do X, but
>you're actually trying to do Y and X is not the way to go about it'. The
>implication is that we'll be better able to help you if you tell us what
>Y is.
Ironically, I originally posted precisely Y (see the post "How to
reassign DB::OUT?"), but I got zero replies... Come to think of
it, X-Y problems would be the natural outcome from such situations
(i.e. you get no replies when you ask how to do Y, so you try your
desperate best guess, which requires doing X; it doesn't work, so
you end up asking about X).
jill
------------------------------
Date: Fri, 27 Feb 2004 09:46:49 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: How to reassign DB::OUT?
Message-Id: <c1n3m9$o9d$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
J Krugman
<jill_krugman@yahoo.com>], who wrote in article <c1loa7$ghg$1@reader2.panix.com>:
> I have a huge data structure in the perl debugger, which I can view
> with the x command. I would like to save the output of the x
> command to a file. I thought that one way to do this would be to
> reassign DB::OUT, but all my effort to do this have failed. How
> can I reassign DB::OUT so that commands like 'x $foo' print to a
> file?
The simplest hack is to reset $ENV{PAGER} and do `|x $foo'... But
personally, I would just call Dumpvar.pm manually...
Hope this helps,
Ilya
------------------------------
Date: Fri, 27 Feb 2004 14:52:14 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: How to send cookie and redirect in a cgi script?
Message-Id: <Pine.LNX.4.53.0402271433520.21753@ppepc56.ph.gla.ac.uk>
On Fri, 27 Feb 2004, Gunnar Hjalmarsson wrote:
> IMNSHO, this is yet another example of CGI.pm unnecessarily
> abstracting trivial things, and it's remarkable, to say the least,
> that you're not able to figure it out by help of the 3,400+ lines POD.
There's a long-standing problem here. The author maintains the CGI.pm
documentation as a rather useful HTML file, which accompanies his
version of the module.
The Perl porters distribute their core version of CGI.pm (just as they
do with other core modules) with POD-format documentation - which then
can be optionally HTML-ified within their installation script.
Unfortunately, these two versions of the documentation are not very
consistent with each other. The POD documentation is quite old, and
tends to lag behind the changes to the code.
> Other things than my solution can be said to have the "wrong
> emphasis". ;-)
I would definitely recommend to users that they get the author's own
HTML-format documentation for CGI.pm (NOT the HTML-ified POD).
Perhaps the version that corresponds to the version of CGI.pm that
they get to use - or better, if they can, to install a current version
of CGI.pm as a separate module, rather than relying on the version
which happened to come with their core distribution.
While it's true that the HTML documentation has no example shown of
cookie-with-redirect - despite it (apparently[1]) being a frequently
wanted procedure and frequently asked question - nevertheless, it
seems to me that the documentation is set out quite clearly, with
"Creating the HTTP Header" as main section header, and "Creating the
Standard Header for a Virtual Document" and "Creating the Header for a
Redirection Request" as the two sub-section headers, which I think
makes it pretty clear what is wanted here.
all the best
[1] I'm no great fan of cookies myself, and I routinely reject them if
they are offered from a server [browser alert enabled] without any
explanation of any benefits they might bring me as a user.
------------------------------
Date: 27 Feb 2004 05:41:56 -0800
From: Petri <Petri_member@newsguy.com>
Subject: Re: Module Install on XP Question
Message-Id: <c1nhf401h32@drn.newsguy.com>
In article <3Qw%b.9711$ee3.469174@news20.bellglobal.com>, Matt Garrish says...
>> IMO, the ONLY way to use perl on XP is to install cygwin, build
>> it yourself, and use gcc to compile them. Anything else is going
>> to be an excercise in frustration.
> The only problem I've personally run into is with the Crypt modules,
> but I remember reading once that that was only because AS doesn't
> have a license to distribute cryptographic software. Have you tried
> including other ppm respoitories? I always add the following ones
> whenever I install Perl on a Windows box:
> http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58
I've never had any problems with ppm either, AS always seem to keep the packages
up-to-date for the latest version of ActivePerl, eg 800-series, etc.
Only the SSL modules have eluded me. :)
But there they are, in the repository you mention above.
Thanks for the tip!
Petri
------------------------------
Date: 27 Feb 2004 06:48:18 -0800
From: vince.iacoboni@db.com (SqlSlinger)
Subject: Re: Multiple substitution in a complex RE
Message-Id: <b74d9c54.0402270648.426ef744@posting.google.com>
Thanks, Fifo. Making more sense now.
------------------------------
Date: Fri, 27 Feb 2004 23:08:19 +0800
From: Regent <arthur0421@163.com>
Subject: Re: Perl Permissions on Windows
Message-Id: <c1nmi3$2shj$1@mail.cn99.com>
Read httpd.conf comments. You can specify user access restrictions.
Regent
Connell Gauld wrote:
> Hey,
>
> I have a slight problem...I have installed the latest version of Apache on
> Windows XP Home and ActivePerl. I am looking to server as a small web host.
> The problem is that users will be able to upload their own perl scripts and
> using the open command, would be able to see and modify the entire hard
> drive. Is there any way to restrict their access to the disk to that they
> can only view and modify in their root directory. It is a NTFS drive but
> there is no security options installed (ie you cannot specify file
> permissions).
>
> Any help would be greatly appreciated.
> Connell Gauld
>
>
------------------------------
Date: Fri, 27 Feb 2004 15:19:10 +0000 (UTC)
From: kj <nomail_nospam@nopain.nopain.com>
Subject: Re: Regexp problem
Message-Id: <c1nn5e$5i3$1@reader2.panix.com>
Thanks!
kj
------------------------------
Date: 27 Feb 2004 10:20:09 -0800
From: nobull@mail.com
Subject: Re: RegExp Replace Using a Variable
Message-Id: <4dafc536.0402271020.592a04a0@posting.google.com>
"David K. Wall" <dwall@fastmail.fm> wrote in message news:<Xns949ACF2798508dkwwashere@216.168.3.30>...
> Brian McCauley <nobull@mail.com> wrote:
>
> > Ben Morrow <usenet@morrow.me.uk> writes:
> >
> >> We've just had this thread...
> >
> > And I commented there that this question comes in waves. It goes
> > una[s]ked for weeks then along come two in two days.
>
> Maybe it follows a Poisson distribution.....
>
> If I could figure out how to find all occurences with Google, it might be an
> interesting thing to look at.
I was planning to do a lightning talk at YAPC::Europe::2004 on this
question.
So if you can get off your little Pacific island[1] and get to
Northern Ireland you may just get to look at this interesting think.
[1] Or are you flying a flag of convenience?
------------------------------
Date: Fri, 27 Feb 2004 15:12:15 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: return multiple arrays from functions
Message-Id: <x7k728o8tw.fsf@mail.sysarch.com>
>>>>> "TvP" == Tassilo v Parseval <tassilo.parseval@rwth-aachen.de> writes:
TvP> Also sprach Uri Guttman:
>> and it makes your code look like a perl4 kiddie coder wrote it. just
>> because you are used to it doesn't defend your use of it. and how can it
>> be confused with a method? there is NO object nor -> there. and
>> confusing it with a perl function is rare since you should KNOW most of
>> the perl function names and not use a sub name that would be confused
>> with them.
>>
>> any more weak defenses?
TvP> Consistency. Look at how you create references for instance:
TvP> *GLOB => \*GLOB
TvP> $scalar => \$scalar
TvP> @ary => \@ary
TvP> %hash => \%hash
TvP> When using the ampersand, this table can be completed to
TvP> &func => \&func
funcs are usually called with arguments and need () (i don't use the
operator style with no () since that needs predeclaring). so the case of
no arguments is just foo(). that is enough to mark a func to me and the
& is just more unneeded noise. other than dispatch tables and a few
other places where you need code refs, & doesn't come in to play
(especially for most newbies) so this is not a strong point IMO.
TvP> Every data-type (and functions in Perl can be considered a type
TvP> as well) has a special sigil so why not keep using it with
TvP> functions, too? Not that I'd be using ampersands on function
TvP> calls, but then I don't see a problem when others do.
TvP> It's a style issue and not a technical one (the often quoted
TvP> side-effects of the ampersand really don't count since they wont
TvP> get into the way). And now that we are talking about matters of
TvP> taste, the old Latin saying "De gustibus non est disputandum"
TvP> comes to my mind.
it will bite them at some point with passing @_ implicitly or disabling
prototypes. it is doing something without the code understanding why so
it is more than just style. and i covered the noisy style point above as
well.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 27 Feb 2004 18:52:04 +0200
From: Greger <greger@[NOSPAM-PLEASE]gh-webinteractive.com>
Subject: site launch
Message-Id: <%7M%b.48$MX6.25@reader1.news.jippii.net>
welcome to our new site
looking for a coder?
look no further,
www.gh-webinteractive.com
------------------------------
Date: Fri, 27 Feb 2004 18:13:34 GMT
From: JC <jwcorpening@verizon.net>
Subject: Thanks for the advice
Message-Id: <iNL%b.108$qX5.17@nwrdny03.gnilink.net>
Thanks for replying to my original post and for pointing me in some
directions. As I mentioned, I code alot with PERL, but I'm pretty much
self-taught, so I'm sure that I learned incorrectly and am at a very
intro level, still.
> And don't call sub-routines with a '&' unless you really
> know what you're doing.
Nope, I don't know enough to know otherwise.
> XML::DOM
> XML::DOM::Document
Nope, don't know what these mean. I starting learning at
www.cgi101.com, in 1999, and have since used an HTML version of a perl.1
man page for PERL v. 4, Teach Yourself CGI Programming with PERL 5, and
other people's code. I'm limping, but thanks for the help.
-jc
------------------------------
Date: Fri, 27 Feb 2004 16:38:47 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: using sed from with a perl script
Message-Id: <evou30t386lpl1vmj8b4vkmmsqitt8k8p8@4ax.com>
On 27 Feb 2004 04:24:21 -0800, jackpenarth@aol.com (Jack Penarth)
wrote:
>I use a perl scrip to parse fixed-length field database outputs into
>.csv files. I regularly use a back-ticked sed command to do stuff
>after perl has finished with the file ('cos I am not that good with
>perl yet!). I have a need to remove the last line of these files and I
>thought that the following line would work:
>
>`sed '$d' file.csv > file.csvnew`
>
>But it doesn't. Am I missing something obvious here?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(Apart the serious answer you have already received) I'd guess... the
whole point about using Perl...
As for how to print everything but the last line, there are as usual
tons of WTDI, here's just a try/example:
#!/usr/bin/perl -ni
use strict;
use warnings;
close ARGV if eof;
print our $l unless $.==1;
$l=$_;
__END__
For once this (is simple enough that it) may well have been *not*
strict- and warnings-enabled, but I guess your actual script is
considerably more complex...
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Fri, 27 Feb 2004 16:07:57 +0000
From: fifo <fifo@despammed.com>
Subject: Re: using sed from with a perl script
Message-Id: <20040227160756.GB23783@fleece>
At 2004-02-27 16:38 +0100, Michele Dondi wrote:
> On 27 Feb 2004 04:24:21 -0800, jackpenarth@aol.com (Jack Penarth)
> wrote:
> >I use a perl scrip to parse fixed-length field database outputs into
> >.csv files. I regularly use a back-ticked sed command to do stuff
> >after perl has finished with the file ('cos I am not that good with
> >perl yet!). I have a need to remove the last line of these files and I
> >thought that the following line would work:
> >
> >`sed '$d' file.csv > file.csvnew`
> >
> >But it doesn't. Am I missing something obvious here?
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> (Apart the serious answer you have already received) I'd guess... the
> whole point about using Perl...
>
> As for how to print everything but the last line, there are as usual
> tons of WTDI, here's just a try/example:
>
>
> #!/usr/bin/perl -ni
>
> use strict;
> use warnings;
>
> close ARGV if eof;
> print our $l unless $.==1;
> $l=$_;
>
> __END__
>
I think this would be a bit easier:
#!/usr/bin/perl -pi
last if eof
__END__
------------------------------
Date: Fri, 27 Feb 2004 17:16:05 +0200
From: Greger <greger@[NOSPAM-PLEASE]gh-webinteractive.com>
Subject: Re: your partner
Message-Id: <%JK%b.19$Sa6.6@reader1.news.jippii.net>
Robert M. wrote:
> In article <LWVYb.553$oj7.369@reader1.news.jippii.net>,
> "Bob Smith" <bobsmith@[don't-even-think-about-it]jippii.fi> wrote:
>
>
>>"Robert M." <rmarkoff@msn.com> wrote in message
>>news:rmarkoff-C1FBCF.21021018022004@news4.west.earthlink.net...
>>
>>>In article <BoVYb.552$5X7.85@reader1.news.jippii.net>,
>>> "Bob Smith" <bobsmith@[don't-even-think-about-it]jippii.fi> wrote:
>>>
>>>
>>>>http://www.geocities.com/etc
>>>>
>>>"We prefer not to publish pricing" it says.
>>>
>>>Then whats the point of a web site?
>>>
>>the point is to get the customer to talk,
>>
>
> You sell website development and you won't even buy yourself a domain
> name?
>
i have one now
www.gh-webinteractive.com
------------------------------
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 6189
***************************************