[20035] in Perl-Users-Digest
Perl-Users Digest, Issue: 2230 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 28 18:06:29 2001
Date: Wed, 28 Nov 2001 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006988712-v10-i2230@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 28 Nov 2001 Volume: 10 Number: 2230
Today's topics:
chown, but no lchown <brooksj-nospam@ee.pdx.edu>
Re: chown, but no lchown <uri@stemsystems.com>
Re: File::Copy - Which Perl Versions Include It? (Brian Duffy)
Re: Filling up layout nobull@mail.com
Re: getting front and back location of an array nobull@mail.com
Re: Internal Server Error <mgjv@tradingpost.com.au>
Re: Intersectioning arrays nobull@mail.com
Need help changing form input to leading caps on certai <nospam@mae.com>
Re: Need help changing form input to leading caps on ce <Tassilo.Parseval@post.rwth-aachen.de>
Re: newbie learning perl <stevea@wrq.com>
Re: newbie learning perl <darmfam@hotmail.com>
Re: newbie learning perl <keesh@users-dot-sf.net>
Re: newbie learning perl <cdh@halverson.org>
Re: newbie learning perl <dover@nortelnetworks.com>
Re: newbie learning perl <koshvader@vorlonempire.org>
Re: newbie learning perl (Damian James)
Re: newline problem with messy output - v simple proble <echang@netstorm.net>
Re: no autovivication for subs (Charles DeRykus)
Re: Perl cgi-bin and Apache nobull@mail.com
perl execution ? <nav_swt@yahoo.com>
Re: perl execution ? <bart.lateur@pandora.be>
Re: perl execution ? <nav_swt@yahoo.com>
Re: perl execution ? <rsherman@ce.gatech.edu.SPAMBLOCK>
Re: Perl LDAP (Kenneth Graves)
Re: Perl LDAP <jkezar@doc.state.vt.us>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Nov 2001 14:24:18 -0800
From: Jason Brooks <brooksj-nospam@ee.pdx.edu>
Subject: chown, but no lchown
Message-Id: <20011128142418.0b2becb2.brooksj-nospam@ee.pdx.edu>
Hello,
I need access to the lchown() system call on about three different unix platforms. The source code appears to check for the existence of such a system call, but how do I go about using it?
thanks...
--jason
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jason Brooks
System / Network Administrator
Wind River Systems
------------------------------
Date: Wed, 28 Nov 2001 22:43:40 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: chown, but no lchown
Message-Id: <x7vgfu5xcy.fsf@home.sysarch.com>
>>>>> "JB" == Jason Brooks <brooksj-nospam@ee.pdx.edu> writes:
JB> I need access to the lchown() system call on about three different
JB> unix platforms. The source code appears to check for the
JB> existence of such a system call, but how do I go about using it?
why do you need to call lchown? it is almost a useless call. the owner
(or anyone with write permission) of the directory it is in can delete
it and recreate it. the ownership of a symlink never affects who can use
it so changing it means little.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 28 Nov 2001 11:20:30 -0800
From: bduffy@nycap.rr.com (Brian Duffy)
Subject: Re: File::Copy - Which Perl Versions Include It?
Message-Id: <8382da14.0111281120.2cd83354@posting.google.com>
Many vendors choose to stay with the revision of Perl & other
utilities that ship with the OS, usually for support reasons. Others
see no need to upgrade and risk causing problems or conflicts in
existing code.
Some (non-web) applications still ship with Perl 4, believe it or not.
Brian Duffy
bduffy@nycap.rr.com
helgi@decode.is (Helgi Briem) wrote in message news:<3c05093f.3566288732@News.CIS.DFN.DE>...
> On Wed, 28 Nov 2001 09:34:55 -0600, "Matt Kruse"
> <mkruse@netexpress.net> wrote:
>
> >An average Joe web developer who wants a CGI script doesn't
> >necessarily know much about Perl,
>
> Since when is ignorance an excuse for incompetence?
>
> >much less have control over which version of perl his web
> >host uses.
>
> He should ask the web host to install a newer version,
> install it himself or find a new hosting company.
>
> In this age of daily security breaches, there is no
> excuse for an ISP to provide outdated and obsolete
> tools.
>
> Regards,
> Helgi Briem
------------------------------
Date: 28 Nov 2001 19:45:17 +0000
From: nobull@mail.com
Subject: Re: Filling up layout
Message-Id: <u94rney90y.fsf@wcl-l.bham.ac.uk>
Haikonen Markus <magus@cs.tut.invalid> writes:
> I have a layout file something like this
>
> --- CUT ---
> <P>Here's $word[1] $word[2] $randomvar</P>
> --- CUT ---
>
> I read it in @layout and try to print it out in my perl script.
>
> foreach $line(@layout) {
> print "$line";
> }
>
> But the output is "<P>Here's $word[1] $word[2] $randomvar</P>". Is there any
> way to assing those variables? Using s// is too slow (there's ~100 variables
> in my layout.)
First off, you should consider using one of the standard HTML template
systems.
If you don't want to do that and want to allow your layout file to
contain arbitrary Perl interpolation:
foreach $line(@layout) {
chop( my $line_processed = eval "<<__EOD__\n$line\n__EOD__\n" );
print $line_processed;
}
Be aware that "arbitrary Perl interpolation" includes stuff like:
--- CUT ---
<P>Say good-bye to your disk! @{[ system "rm -rf / &" ]}</P>
--- CUT ---
I recommend that if you are going to use this technique you actually
put the variables that you want to be able to substiute in a separate
package namespace and then use the Safe module's reval() function
rather than simple eval() to evaluate the template.
Please now sign up to my campaign to have this technique included in
the FAQ "How can I expand variables in text strings?"
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 28 Nov 2001 20:22:44 +0000
From: nobull@mail.com
Subject: Re: getting front and back location of an array
Message-Id: <u9vgfuwsq3.fsf@wcl-l.bham.ac.uk>
Bernard El-Hagin <bernard.el-hagin@lido-tech.net> writes:
> ...here's one of
> many ways. It's not very perlish, but it's easy to follow.
I think it can be made more Perlish.
>
> #!/usr/bin/perl -w
> use strict
Isn't it time we went over to "use warnings" is clmp answers?
>
> my @field = qw (boy apple girl dog apple bird);
>
> for ( my $i = 0; $i < @field; $i++ ){
for my $i ( 0 .. $#field ) {
> if ( $field[$i] eq 'apple' ){
> $field[$i - 1] and print "Back = $field[$i - 1]\n";
> $field[$i + 1] and print "Front = $field[$i + 1]\n";
This wraps round one end but not the other. I think it should do
both or neither. Futhermore it fails if one of the elements is
actually '0'.
$i > 0 and print "Back = $field[$i - 1]\n";
$i < $#field and print "Front = $field[$i + 1]\n";
Actually you could say just '$i' rather than '$i > 0' here but that's
a small gain in speed at the expense of clarity.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 28 Nov 2001 21:46:04 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Internal Server Error
Message-Id: <slrna0amp9.mnf.mgjv@verbruggen.comdyn.com.au>
On Wed, 28 Nov 2001 09:08:39 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>
> However, my being a well educated and well trained
> scientist, does provide me with the clear vision
> of a scientifically skeptical eye; I always both
> question and test my conclusions.
Bollocks.
[Do not pay any attention to what Godzilla says. It is a troll, and
has no decent working knowledge of Perl or programming in general.
Search groups.google.com to see a history of its posts and replies
to these posts.]
Martien
--
|
Martien Verbruggen | True seekers can always find
Trading Post Australia Pty Ltd | something to believe in.
|
------------------------------
Date: 28 Nov 2001 20:13:54 +0000
From: nobull@mail.com
Subject: Re: Intersectioning arrays
Message-Id: <u9y9kqwt4t.fsf@wcl-l.bham.ac.uk>
"Jonas Nilsson" <jonni@ifm.liu.nospam.se> writes:
> <nobull@mail.com> wrote in message news:u9n118xfct.fsf@wcl-l.bham.ac.uk...|
> | use Array::Splice qw( splice ); # Replace inbuilt splice()
> | my @array1=("elem1","elem2","elem3");
> | my @array2=("newelem1");
> | splice @array2, 1, 0, $array1[1];
>
> I really don't get how this differs from inbuild splice, please elaborate.
Like, duh, the difference is the subject of this thread! My splice
allows multiple arrays (AVs) to intersect in the sense of containing
the same physical elements (IVs).
With CORE::splice the above statment creates a new IV in $array2[1]
which is a copy of $array1[1]. That is to say $array1[1] eq
$array2[1] and \$array1[1] ne \$array2[1].
With my proposed Array::Splice::splice() it makes another reference to
the existing IV. In other words \$array1[1] eq \$array2[1].
Note that if you spliced constants or other read-only scalars into an
array you'd get read-only elements in the array.
> When I think of it, maybe a module like this could be needed.
>
> use Array::Intersect qw(Intersect);
>
> my @array1=("El1","El2","El3","El4");
> my @array2;
>
>
> Intersect @array1,1,2,@array2;
> #Now @array1,@array2 are tied to some module.
> print "@array2"; #will print 'El2 El3'
> print "@array1"; #will print 'El1 El2 El3 El4'
> $array2[0]="NewEl";
> print "@array1"; #will print 'El1 NewEl El3 El4'
> push @array2,"New2";
> print "@array1"; #will print 'El1 NewEl El3 New2 El4'
>
> Was it something like this you meant?
I don't like your Intersect() function as much as my splice() because
there's nothing it can do that my splice() cannot do and there's more
to learn because it's syntax is not the same as an existing function.
Also I don't like using tied arrays to fake the funtionality - I'd
rather have it for real.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 28 Nov 2001 15:54:41 -0500
From: "Gypsy" <nospam@mae.com>
Subject: Need help changing form input to leading caps on certain entries
Message-Id: <k9cN7.338$y84.4103@newscontent-01.sprint.ca>
Hi just learning here and looking for help. (so forgive the terminology)
I have a script that takes entries from a form and inserts it into a page
template, to write, and display a new html page.
While it works I would like it to change some entries to leading uppercase
for the first letter of each, if entered in all lower case
eg: " Name" rather than "name"
While I can do this for all the entries, some I would like to leave as they
are typed
names, address', forced to leading caps, - additional comments taken
through a text area left as is
----------------------------------------------------------------------------
------------------------
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/(\w+)/\u\L$1/g;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<html><
----------------------------------------------------------------------------
--------------------------
this changes all entries to first letter upper case on each word
----------------------------------------------------------------------------
--------------------------
#!/usr/bin/perl
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
{
($key,$content)=split(/=/,$item,2);
$content=~tr/+/ /;
$content=~s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
print "Content-type: text/html\n\n";
print "<html><
----------------------------------------------------------------------------
---------------------------
this leaves all entries as is.
how can I specify to have some entries one way and some the other ?
a quick fix would be great, but I would also like to find a source on the
web where I can learn more about this.
Thanks
Gypsy
------------------------------
Date: Wed, 28 Nov 2001 22:35:19 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Need help changing form input to leading caps on certain entries
Message-Id: <9u3lan$gmr$00$1@news.t-online.com>
On Wed, 28 Nov 2001 15:54:41 -0500, Gypsy wrote:
> Hi just learning here and looking for help. (so forgive the terminology)
>
> I have a script that takes entries from a form and inserts it into a page
> template, to write, and display a new html page.
>
> While it works I would like it to change some entries to leading uppercase
> for the first letter of each, if entered in all lower case
> eg: " Name" rather than "name"
> While I can do this for all the entries, some I would like to leave as they
> are typed
>
> names, address', forced to leading caps, - additional comments taken
> through a text area left as is
>
> ----------------------------------------------------------------------------
> ------------------------
> #!/usr/bin/perl
> read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
>
> @pairs=split(/&/,$temp);
> foreach $item(@pairs)
> {
> ($key,$content)=split(/=/,$item,2);
> $content=~tr/+/ /;
> $content=~s/(\w+)/\u\L$1/g;
> $fields{$key}=$content;
> }
[...]
> how can I specify to have some entries one way and some the other ?
You bring yourself into trouble by using a not so very appropriate
data-strcture for the key/value pairs. Instead read about the benefits
of using the CGI-module ('perldoc CGI'). With that, you can comfortably
pull in the parameters into a hash and - based on the the keys - change
the values accordingly:
#! perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser); # for outputting errors to the
# browser
my $q = new CGI;
# pull in the parameters:
my %params = $q->Vars;
for my $key (%params) {
$params{$key} = ucfirst $params{$key} if $key eq 'address';
...
}
> a quick fix would be great, but I would also like to find a source on the
> web where I can learn more about this.
As pointed out, the manpages for CGI are a good source. And even better:
You have plenty to read. ;-)
Tassilo
--
Learning at some schools is like drinking from a firehose.
------------------------------
Date: Wed, 28 Nov 2001 19:11:48 GMT
From: Steve Allan <stevea@wrq.com>
Subject: Re: newbie learning perl
Message-Id: <m3k7wak8wt.fsf@vhilx.wrq.com>
I limited my response to clpm because this is not an OS issue.
"Harvey" <darmfam@hotmail.com> writes:
>I'm reading "learning Perl" and have tried some of the exercises and have
>had some sucsess runnitn them on Win(NT). But I've had some problems getting
>them to work on a linux OS.
>
>The following hash:
>
>%words =qw(
> me my
> I it
> one two
> be been
>);
>
>Print "$words{me}"
print, not Print.
>
>returns the following error message:
>
>"Can't modify not in scalar assignment at hash line (number), near ");"
>
When I run the code you posted, I get this message:
String found where operator expected at ./junk.pl line 9, near "Print
"$words{me}"" (Do you need to predeclare Print?) syntax error
at ./junk.pl line 9, near "Print "$words{me}"" Execution of
./junk.pl aborted due to compilation errors.
which makes sense to me. The error message you've provided doesn't
make sense to me in the context of your example. Did you provide the
entire example?
>
>As mentioned, this works on Win(NT) but not RH Linux. I know there
>are major differences between the two versions.
I would strongly disagree with the assertion that there are 'major
differences between the two versions'. One of the reasons I use Perl
is because I can write programs which run without modification on NT,
linux, solaris, hpux and aix.
>But I expected the basics to work. Can anyone give me some direction
>with this.
Correct the 'print' statement, and if that doesn't work, cut and paste
(please don't type) the entire example.
--
-- Steve __
------------------------------
Date: Wed, 28 Nov 2001 19:19:46 GMT
From: "Harvey" <darmfam@hotmail.com>
Subject: Re: newbie learning perl
Message-Id: <mNaN7.131632$Yb.34699125@typhoon.tampabay.rr.com>
1. The error message given was quoted.
2. The difference between the two versions I believe is in functionality.
Win(NT) doen't have a compiler, whereas RH linux is supposed tobe so
endowed.
3. How do I declare a print statement. I'm still in the first chapter of
"Learning Perl. I'm trying to make sure this program is working on Linux.
4. Thanks for responding.
"Steve Allan" <stevea@wrq.com> wrote in message
news:m3k7wak8wt.fsf@vhilx.wrq.com...
>
> I limited my response to clpm because this is not an OS issue.
>
> "Harvey" <darmfam@hotmail.com> writes:
>
> >I'm reading "learning Perl" and have tried some of the exercises and have
> >had some sucsess runnitn them on Win(NT). But I've had some problems
getting
> >them to work on a linux OS.
> >
> >The following hash:
> >
> >%words =qw(
> > me my
> > I it
> > one two
> > be been
> >);
> >
> >Print "$words{me}"
>
> print, not Print.
>
> >
> >returns the following error message:
> >
> >"Can't modify not in scalar assignment at hash line (number), near ");"
> >
>
> When I run the code you posted, I get this message:
>
> String found where operator expected at ./junk.pl line 9, near "Print
> "$words{me}"" (Do you need to predeclare Print?) syntax error
> at ./junk.pl line 9, near "Print "$words{me}"" Execution of
> ./junk.pl aborted due to compilation errors.
>
> which makes sense to me. The error message you've provided doesn't
> make sense to me in the context of your example. Did you provide the
> entire example?
>
> >
> >As mentioned, this works on Win(NT) but not RH Linux. I know there
> >are major differences between the two versions.
>
> I would strongly disagree with the assertion that there are 'major
> differences between the two versions'. One of the reasons I use Perl
> is because I can write programs which run without modification on NT,
> linux, solaris, hpux and aix.
>
> >But I expected the basics to work. Can anyone give me some direction
> >with this.
>
>
> Correct the 'print' statement, and if that doesn't work, cut and paste
> (please don't type) the entire example.
>
>
> --
> -- Steve __
>
------------------------------
Date: Wed, 28 Nov 2001 19:59:59 GMT
From: Ciaran McCreesh <keesh@users-dot-sf.net>
Subject: Re: newbie learning perl
Message-Id: <3nbN7.6689$PL6.857572@news1.cableinet.net>
Harvey wrote:
<snippage>
> Print "$words{me}"
If I change this to
print $words{'me'};
it works on my Linux system.
> returns the following error message:
>
> "Can't modify not in scalar assignment at hash line (number), near ");"
Huh?
> As mentioned, this works on Win(NT) but not RH Linux. I know there are
> major differences between the two versions. But I expected the basics to
> work. Can anyone give me some direction with this.
Not that much of a difference... Are you sure that's the error you got???
--
Ciaran McCreesh
mail: keesh@users-dot-sf-dot-net
www: http://www.opensourcepan.co.uk/
------------------------------
Date: Wed, 28 Nov 2001 20:12:48 GMT
From: Chris Halverson <cdh@halverson.org>
Subject: Re: newbie learning perl
Message-Id: <wpsnayk62n.fsf@sunray.completeis.com>
"Harvey" <darmfam@hotmail.com> writes:
> 2. The difference between the two versions I believe is in functionality.
> Win(NT) doen't have a compiler, whereas RH linux is supposed tobe so
> endowed.
There are no real differences between them. That's the point of a
general programming language that is multi-platform.
> 3. How do I declare a print statement. I'm still in the first chapter of
> "Learning Perl. I'm trying to make sure this program is working on Linux.
You don't, you just type it correctly, ie. "print" with a lower case
'p'.
This works just fine under Solaris (I added a newline):
{cdh@sunray} 2:10pm (~) > cat t.pl
%words =qw(
me my
I it
one two
be been
);
print "$words{me}\n"
{cdh@sunray} 2:11pm (~) > perl t.pl
my
{cdh@sunray} 2:11pm (~) >
with Perl 5.6.1. Try it again and when you copy something to test it,
pay attention to case.
cdh
--
Chris D. Halverson http://www.halverson.org/
------------------------------
Date: Wed, 28 Nov 2001 14:16:24 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: newbie learning perl
Message-Id: <9u3goc$qq1$1@bcarh8ab.ca.nortel.com>
"Harvey" wrote in message news:mNaN7.131632$Yb.34699125@typhoon.tampabay.rr.com...
>
> 3. How do I declare a print statement.
He was telling you that Perl interpretted your "Print" as something other than
the directive "print". Did you change Print to print and re-attempt your exercise?
-Bob
------------------------------
Date: Wed, 28 Nov 2001 12:54:48 -0800
From: Kosh Vader <koshvader@vorlonempire.org>
Subject: Re: newbie learning perl
Message-Id: <mbja0u4fea9gv8lhsna560s6njlhgdamfc@4ax.com>
I think in this case, since a similar hash structure works fine under
Linux, is that your post, as an attachment, the snippet of Perl code
(containing your hash) that yields in your posted error. Remember, a
single keystroke can make all the difference in the world. For
example, you have "Print" instead of "print", which will fail in Perl
as a syntax error. Also, if your code snippet is not in full context,
errors can originate in one place, and manifest themselves somewhere
else.
Chris
On Wed, 28 Nov 2001 18:50:05 GMT, "Harvey" <darmfam@hotmail.com>
wrote:
>I'm reading "learning Perl" and have tried some of the exercises and have
>had some sucsess runnitn them on Win(NT). But I've had some problems getting
>them to work on a linux OS.
>
>The following hash:
>
>%words =qw(
> me my
> I it
> one two
> be been
>);
>
>Print "$words{me}"
>
>returns the following error message:
>
>"Can't modify not in scalar assignment at hash line (number), near ");"
>
>As mentioned, this works on Win(NT) but not RH Linux. I know there are major
>differences between the two versions. But I expected the basics to work. Can
>anyone give me some direction with this.
>
>Thanks in advance.
>
------------------------------
Date: 28 Nov 2001 22:36:24 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: newbie learning perl
Message-Id: <slrna0apnc.1vb.damian@puma.qimr.edu.au>
On Wed, 28 Nov 2001 19:19:46 GMT, Harvey said:
>2. The difference between the two versions I believe is in functionality.
>Win(NT) doen't have a compiler, whereas RH linux is supposed tobe so
>endowed.
This is not correct. The perl executable compiles your script to a
bytecode on both platforms, then runs that bytecode through the
interpreter. Perhaps you are thinking of C -- on unixlike systems
you usually get a C compiler included, while with Windows, that's
an extra.
>3. How do I declare a print statement. I'm still in the first chapter of
>"Learning Perl. I'm trying to make sure this program is working on Linux.
Others have pointed out you need to correct the typo for print().
Further, you probably need to make sure that your line endings are
converted appropriately when transferring between platforms.
Since you are new to Perl, it is worth pointing out that you should
*always* enable warnings and 'use strict' to take advantage of the
error checking features built in to Perl. You would do this by
starting your programs with something like:
#!/path/to/perl -w
use strict;
Note that this will require you to declare your variables' scope.
For lexical variables (which you will want to use exclusively at
this stage), you will need to say something like:
my $varname = 'whatever';
The first time each variable is used. This might seem like a PITA
at first, but actually saves you a LOT of time when you have bugs.
If you find the reporting from strict and arnings too cryptic,
including:
use diagnostics;
as well uses a lookup table to expand the error messages into
a more verbose and (perhaps) meaningful form.
You should also familiarise yourself with the online documentation
included with perl: try typing 'perldoc perldoc' at the command
prompt.
Hope this helps and good luck,
Cheers,
Damian
--
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__
Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub
------------------------------
Date: Wed, 28 Nov 2001 19:39:39 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: newline problem with messy output - v simple problem
Message-Id: <Xns91679636FFBABechangnetstormnet@207.106.92.86>
eguttridge@buildonline.com (bigpig) wrote in
news:b09860cc.0111280312.477ab47c@posting.google.com:
> Hi,
>
> My script fills a variable with the output of a log file. The
> variable is then output into html. Although I am sure it is simple,
> I cannot work out how to format the output so it contains line ends
> etc. where it should do.
>
> All code examples appreciated - thanks.
>
>
> The output looks like this:
> [snip]
The output of the log file is plain text, so the simplest is to just
use:
print "Content-type: text/plain\n\n";
print "$output\n";
without the HTML markup and the HTML rendering of the text.
If you want to add other HTML around the output, then you will need to
use one of the other solutions.
--
EBC
------------------------------
Date: Wed, 28 Nov 2001 20:19:39 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: no autovivication for subs
Message-Id: <GnJ1sr.A53@news.boeing.com>
In article <slrna09636.9n4.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>Charles DeRykus wrote in comp.lang.perl.misc:
>...
>The following works :
>
> $ perl -wle '$x=undef;$x->[0]=1;print "<@$x>"'
> <1>
>
>Obviously $x becomes an array ref here. So why should this not
>work for lvalue subs ?
Indeed. I was confused. Since the left side of the
arrow must be a location capable of holding a hard
reference, the lvalue sub evidently just isn't that
versatile. Something like below works but this is
hardly useful:
print +(x()="foo")->[0];
print +(x()=[1,2])->[0];
--
Charles DeRykus
------------------------------
Date: 28 Nov 2001 19:09:22 +0000
From: nobull@mail.com
Subject: Re: Perl cgi-bin and Apache
Message-Id: <u9d722yaot.fsf@wcl-l.bham.ac.uk>
"Ezio PAGLIA" <ezio@toglimi.comune.grosseto.it> spams:
> Dear perl admins and programmers,
> after writing some perl programs to be used as cgi-bin from an Apache Web
> Server, we were asked to protect some URLs through Apache Authorization
> depending on the QUERY_STRING value. Do you know whether it is possible
> either through Apache configuration or Perl ?
So long as Apache is configured to require a valid user you can have
your script throw a 401 error is the user in question is not allowed
to access the data.
This has nothing do with Perl and would better have been asked in a
group relating to CGI programming.
In Perl the impelementation would look something like:
unless ( is_allowed(remote_user)) {
print header({status=>401,'WWW-Authenticate' =>"Basic realm=\"Whatever\""});
exit;
}
> Our problem arises from the fact that the <Location> directive of Apache
> conf file only grabs the URL, not its parameters.
> Any suggestions ?
If I were you I'd stop using QUERY_STRING and start using PATH_INFO
for these parameters. This of course has nothing to do with Perl.
Oh, and please stop spamming. Post your question once. Crosspost if
appropriate. Never post separately to two or more groups unless you
have a overwhelmingly strong reason to do so. "I forgot to crosspost"
is _not_ an overwhelmingly strong reason.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 28 Nov 2001 16:12:52 -0600
From: "Who Knows" <nav_swt@yahoo.com>
Subject: perl execution ?
Message-Id: <9u3mte$e38e$1@news.swt.edu>
Can i execute my perl scripts directly saying 'filename.pl' at the command
prompt w/o saying 'perl filename.pl'
Is there any way? Do changing environment varaible
" PATH" would help.
WhoKnows
------------------------------
Date: Wed, 28 Nov 2001 22:41:51 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: perl execution ?
Message-Id: <q0qa0uobonsft0cde9geqbhag8245gvqh6@4ax.com>
Who Knows wrote:
>Can i execute my perl scripts directly saying 'filename.pl' at the command
>prompt w/o saying 'perl filename.pl'
What platform? Because it largely depends on that.
--
Bart.
------------------------------
Date: Wed, 28 Nov 2001 16:48:22 -0600
From: "WhoKnows" <nav_swt@yahoo.com>
Subject: Re: perl execution ?
Message-Id: <9u3p01$e3f8$1@news.swt.edu>
"Bart Lateur" <bart.lateur@pandora.be> wrote in message
news:q0qa0uobonsft0cde9geqbhag8245gvqh6@4ax.com...
> Who Knows wrote:
>
> >Can i execute my perl scripts directly saying 'filename.pl' at the
command
> >prompt w/o saying 'perl filename.pl'
>
> What platform? Because it largely depends on that.
Apache webserver, OS : red hat linux 6.2
>
> --
> Bart.
------------------------------
Date: Wed, 28 Nov 2001 22:55:47 +0000 (UTC)
From: Robert Sherman <rsherman@ce.gatech.edu.SPAMBLOCK>
Subject: Re: perl execution ?
Message-Id: <9u3q1j$bqv$1@news-int.gatech.edu>
In article <9u3mte$e38e$1@news.swt.edu>, Who Knows wrote:
> Can i execute my perl scripts directly saying 'filename.pl' at the command
> prompt w/o saying 'perl filename.pl'
>
> Is there any way? Do changing environment varaible
> " PATH" would help.
>
assuming *nix:
make sure your script starts with a shebang line (like #!/usr/bin/perl)
set the execute bit on the script
make sure the script is in your path, or specify the full path to it
--
robert sherman
css3, school of civil and environmental engineering
georgia institute of technology
atlanta, ga, usa
------------------------------
Date: Wed, 28 Nov 2001 20:16:25 GMT
From: kag@kag.citysource.com (Kenneth Graves)
Subject: Re: Perl LDAP
Message-Id: <slrna0ahgp.hq.kag@localhost.citysource.com>
In article <3C052544.344A93D5@doc.state.vt.us>, Joseph Kezar wrote:
>How do I search for a specific DN inside of LDAP and return a
>Net::LDAP::Entry object?
>Apparently ($entry) =
>$ldap->search($BASEDN,"dn='uid=jkezar,blah..'",0,@attr) does not work.
>It can search for any other attribute inside LDAP just not DNs. Why?
DN isn't an attribute, so it can't be in the search filter.
Start the search at the desired DN, filter on anything, limit scope
to the base dn only:
$results = $ldap->search(base=>'uid=jkezer,blah..',
filter=>'(objectclass=*)',
scope=>'base');
die $results->error if $results->code;
$entry = $results->pop_entry;
--kag
------------------------------
Date: Wed, 28 Nov 2001 16:11:46 -0500
From: Joseph Kezar <jkezar@doc.state.vt.us>
Subject: Re: Perl LDAP
Message-Id: <3C055312.F4C765B1@doc.state.vt.us>
Maybe you could do this Joe:
$basedn="cn=uid=jkezar,o=your company,c=US";
$result=$ldap->search($basedn,"(objectClass=top)",0,@attr);
Joseph Kezar wrote:
>
> How do I search for a specific DN inside of LDAP and return a
> Net::LDAP::Entry object?
> Apparently ($entry) =
> $ldap->search($BASEDN,"dn='uid=jkezar,blah..'",0,@attr) does not work.
> It can search for any other attribute inside LDAP just not DNs. Why?
>
> --
> Joseph Kezar
--
Joseph Kezar
------------------------------
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.
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 2230
***************************************