[22350] in Perl-Users-Digest
Perl-Users Digest, Issue: 4571 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 16 03:05:53 2003
Date: Sun, 16 Feb 2003 00:05:09 -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 Sun, 16 Feb 2003 Volume: 10 Number: 4571
Today's topics:
Re: $^S == 0 inside eval (v5.6.1) <goldbb2@earthlink.net>
Re: Bad Output from Perldoc (remove the obvious)
Re: configure 'PerlModule Apache2' in httpd.conf <randy@theoryx5.uwinnipeg.ca>
Re: configure 'PerlModule Apache2' in httpd.conf <Pop@goesthe.net>
Re: DB2 Connect and DBD::DB2 <dmcbride@naboo.to.org.no.spam.for.me>
DBI seg fault (Todd Smith)
Re: DBI seg fault (Tad McClellan)
JPG RGB to JPG CMYK <aferla01@postoffice.csu.edu.au>
Re: New JAPH <goldbb2@earthlink.net>
Re: New JAPH (Jay Tilton)
Re: newbie date comparison <bongie@gmx.net>
Re: newbie date comparison <Jodyman@hotmail.com>
Re: Perl my variable question <wksmith@optonline.net>
Re: Perl my variable question <goldbb2@earthlink.net>
Re: Perl+Tk+MySQL for Win32 that *works*? (Jeffrey Jenkins)
undef true|false (Hunch)
Re: undef true|false <tassilo.parseval@post.rwth-aachen.de>
Re: undef true|false (Hunch)
use lib Apache->server_root_relative('lib/perl'); <Pop@goesthe.net>
Re: use lib Apache->server_root_relative('lib/perl'); <flavell@mail.cern.ch>
Re: use lib Apache->server_root_relative('lib/perl'); <Pop@goesthe.net>
Re: use lib Apache->server_root_relative('lib/perl'); (Tad McClellan)
Re: use lib Apache->server_root_relative('lib/perl'); <Pop@goesthe.net>
Re: use lib Apache->server_root_relative('lib/perl'); <goldbb2@earthlink.net>
Re: use lib Apache->server_root_relative('lib/perl'); <usenet@dwall.fastmail.fm>
Re: use lib Apache->server_root_relative('lib/perl'); <usenet@dwall.fastmail.fm>
Win32::NetResource::GetSharedResources <sapbasis2003@netscape.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 16 Feb 2003 00:07:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: $^S == 0 inside eval (v5.6.1)
Message-Id: <3E4F1C8E.12168611@earthlink.net>
Paul Wood wrote:
>
> Hi.
>
> I'm having trouble with $^S being zero inside an eval { }.
That's proper behavior. It's only supposed to be true in eval ( ).
If you can't tell the difference between {} and (), make your text
bigger, or use a different font.
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: Sat, 15 Feb 2003 21:01:09 GMT
From: "--Rick" <no_trick@my-de(remove the obvious)ja.com>
Subject: Re: Bad Output from Perldoc
Message-Id: <pUx3a.54466$zF6.3661609@bgtnsc04-news.ops.worldnet.att.net>
"James Willmore" <jwillmore@cyberia.com> wrote in message
news:e0160815.0302141949.5a848423@posting.google.com...
| Have you tried 'perldoc -t <what_ever_else_you_need>'? I had a
| simmilar issue with a Linux box. There was something funny about
| groff and it would print strange characters. If you use the '-t'
| option, it prints the output in text format - then you can pipe the
| output through 'more' (or 'less' or what ever else there is as a
pager
| on your box).
|
| Just a suggestion
| HTH
|
| Jim
| > the text is not properly left-aligning. Instead, it is skewing
across the
| > page as if it were a stack of playing cards being tilted to the
right.
Here is a solution. Go to this link for the complete discussion.
http://rt.perl.org/rt2/Ticket/Display.html?id=19682
==============================================
> I guess I'll look into a different pager. I haven't found a silver-
> bullet for this anywhere.
I have, thanks to Sean M. Burke, who suggested installing
Pod::Perldoc.
That module comes with a replacement 'perldoc' script which Does The
Right Thing on Windows.
It's pure Perl, so just fetch it from CPAN. If you have a make utility
(preferably Microsoft's nmake, since that's what ActivePerl was built
with), then the standard "perl Makefile.PL; make; make install" should
work.
Otherwise copy Pod\Perldoc.pm to a directory under @INC and put
perldoc
into the Perl "bin" directory; it may need converting to a batch file
by hand (with pl2bat) so that you can simply call it as "perldoc".
Cheers,
Philip
--
Philip Newton
------------------------------------------
Subject: perldoc using \n rather than \r\n [ ticket #19682 ]
Since I have the default Activestate binary distribution, it was even
easier.
PPM>install Pod::Perldoc
When the install finished, perldoc worked. (It even creates
perldoc.bat).
--R Clary
============ End of Solution, Some detail follows ============
If I understand correctly, v5.8.0 perldoc writes it's temp file as
binary, so the end of line isn't adapted to the platform.
Win98's more.com can't handle this, but NT's more.com can. It's not
as simple as copying NT's more.com.
There are some other applications on Win98 that can display perldoc
properly. Wordpad works (in it's own window). If you have loaded a
windows version of less, that will work too.
Try: set PAGER="c:\program files\accessories\wordpad.exe"
That will cause perldoc to open a wordpad window and display it's
output there.
--R Clary
------------------------------
Date: Sat, 15 Feb 2003 14:49:01 -0600
From: "Randy Kobes" <randy@theoryx5.uwinnipeg.ca>
Subject: Re: configure 'PerlModule Apache2' in httpd.conf
Message-Id: <0Jx3a.43717$7_.189183@news1.mts.net>
"Papa Oohmawmaw" <Pop@goesthe.net>
wrote in message news:9Us3a.111250$SD6.5316@sccrnsc03...
> I finally got Mod_perl installed and have a problem, the program said to:
>
> "Don't forget to:
> - configure 'PerlModule Apache2' in httpd.conf"
>
> I don't know the syntax for adding this. I've tried a few ways to add it
but
> always get an error. Can anyone help me with the syntax to add this?
Thanks.
That just means to add the directive 'PerlModule Apache2' somewhere
in your httpd.conf. This module adjusts @INC so as to include an
Apache2/ subdirectory in your Perl tree. The errors you received
may be due to using this directive too late - try putting it in before
any mod_perl things (but after of course loading mod_perl.so).
best regards,
randy kobes
------------------------------
Date: Sun, 16 Feb 2003 00:51:04 GMT
From: "Papa Oohmawmaw" <Pop@goesthe.net>
Subject: Re: configure 'PerlModule Apache2' in httpd.conf
Message-Id: <YfB3a.117605$iG3.13752@sccrnsc02>
Thanks, Randy for the reply. I finally read enough to do what you're
advising. I also have another problem in another post. If you can, I
appreciate any help.
"Randy Kobes" <randy@theoryx5.uwinnipeg.ca> wrote in message
news:0Jx3a.43717$7_.189183@news1.mts.net...
> "Papa Oohmawmaw" <Pop@goesthe.net>
> wrote in message news:9Us3a.111250$SD6.5316@sccrnsc03...
> > I finally got Mod_perl installed and have a problem, the program said
to:
> >
> > "Don't forget to:
> > - configure 'PerlModule Apache2' in httpd.conf"
> >
> > I don't know the syntax for adding this. I've tried a few ways to add it
> but
> > always get an error. Can anyone help me with the syntax to add this?
> Thanks.
>
> That just means to add the directive 'PerlModule Apache2' somewhere
> in your httpd.conf. This module adjusts @INC so as to include an
> Apache2/ subdirectory in your Perl tree. The errors you received
> may be due to using this directive too late - try putting it in before
> any mod_perl things (but after of course loading mod_perl.so).
>
> best regards,
> randy kobes
>
>
>
------------------------------
Date: Sun, 16 Feb 2003 05:52:07 GMT
From: Darin McBride <dmcbride@naboo.to.org.no.spam.for.me>
Subject: Re: DB2 Connect and DBD::DB2
Message-Id: <bGF3a.5413$na.233401@news2.calgary.shaw.ca>
Wonderinguy wrote:
> I have a db2 connect server (windows) installed which is used to
> connect to db2 on OS/390.
> I have db2 connect personal edition on a Redhat 8.0
> A perl script using DBD::DB2 use the datasource in the redhat computer
> to query db2 on os/390.
> When I go directly from linux computer(installed with db2 connect PE)
> it works, but when I route it thru the DB2 Connect EE on a windows
> server, it gives me segmentation fault.
> How ever if I do db2 connect to db2 OS/390 via the db2 connect EE it
> works. Just the perl DBD:DB2 application gives segmentaion fault.
> Any ideas...
I think your best bet is, unfortunately, to open a PMR with IBM. They'll
probably need you to take a trace of the crashing application.
I presume that if you do the same thing with the DB2 CLP, even routing
through the Connect EE server, that everything works fine?
------------------------------
Date: 15 Feb 2003 15:39:23 -0800
From: smittod@auburn.edu (Todd Smith)
Subject: DBI seg fault
Message-Id: <ed3092e7.0302151539.27f22314@posting.google.com>
I'm using this test script (that i found from another post inthis
group) and a username/password that works whe connecting to mysql from
the command line.
-------------------
#!/usr/bin/perl
++$|;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
print "Content-type: text/html\n\n";
print "<html>\n <head>\n";
print "<title></title>\n";
print "</head>\n <body>";
$driver="mysql";
$database="mysql";
$user="root";
$password="password";
$dsn = "dbi:$driver:$database";
print "<br> Connecting...";
$dbh = DBI->connect($dsn, $user, $password) or die "Error...
$DBI::errstr\n";;
print "<br> Connected";
print "<br> Disconnecting...";
$dbh->disconnect;
print "<br> Disconnected";
print " </body>\n </html>";
-----------------------
with this output:
------------------------
[root web]# ./test.cgi
Content-type: text/html
<html>
<head>
<title></title>
</head>
<body><br> Connecting...Segmentation fault
[root web]#
-------------------------
does anybody know what might cause that error?
thanks
-todd
------------------------------
Date: Sat, 15 Feb 2003 21:09:48 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: DBI seg fault
Message-Id: <slrnb4u07s.5qt.tadmc@magna.augustmail.com>
Todd Smith <smittod@auburn.edu> wrote:
> $user="root";
> $dbh = DBI->connect($dsn, $user, $password) or die "Error...
Why must you be the superuser?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 16 Feb 2003 18:10:11 +1100
From: Adam Ferla <aferla01@postoffice.csu.edu.au>
Subject: JPG RGB to JPG CMYK
Message-Id: <3E4F3953.9000705@postoffice.csu.edu.au>
Hey peoples,
I was just wondering if there is a Perl module than can convert between
RGB and CMYK jpeg images? If not, does anyone know of any good online
resources to help me in this task?
Thanx for you help.
Adam
------------------------------
Date: Sat, 15 Feb 2003 23:34:24 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: New JAPH
Message-Id: <3E4F14D0.E36460E2@earthlink.net>
Jay Tilton wrote:
>
> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>
> : $,=q=,JtutsarfornreehaPefhkfcl=;$;=25;sub _{
> : my$__ if 0;++$__;print substr$,,$;&&$__%$;,1
> : ,q;;;--$;;$__>2&&&_;}$,=~tr;f; ;;_ for 1..9;
> :
> : This is of course dependent on the funky behavior of my $foo if 0;,
> : and thus is subject to breakage on any future perls which alter that
> : behavior.
>
> Nice. The " $,=~tr;f; ; " part had me puzzled for a moment. I was
> trying to find its significance to the algorithm. :)
Really? I woulda thunk that was the simplest part... since it has no
real impact on the algorithm, merely on the data.
> Naturally, I had to noodle around with it.
>
> $;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
> my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
> $__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print
>
> Fundamentally the same, but different.
>
> I rather like the transform of "my $__ if 0" into "0 && my $__",
> especially how the "my $__" looks like its own statement.
>
> And I've been waiting for a good reason to say "y yiy y".
Wow... you've added some obscurities I never woulda thought of.
The "0 &&\nmy" is definitely a cool trick.
I rather like the use of 's ee substr... ee; .... ;print' instead of
'print substr...'.
Definitely changing the '25' to '22 + $; =~ y yiy y' puzzled me for a
bit.
I'm curious, though -- how did you go about finding the right initial
string to produce "Just another Perl Hacker,"?
I know how I did it, but I wonder how others would go about it.
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: Sun, 16 Feb 2003 07:36:51 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: New JAPH
Message-Id: <3e4f1e41.98417035@news.erols.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
: Jay Tilton wrote:
: >
: > Benjamin Goldberg <goldbb2@earthlink.net> wrote:
: >
: > : $,=q=,JtutsarfornreehaPefhkfcl=;$;=25;sub _{
: > : my$__ if 0;++$__;print substr$,,$;&&$__%$;,1
: > : ,q;;;--$;;$__>2&&&_;}$,=~tr;f; ;;_ for 1..9;
: >
: > Nice. The " $,=~tr;f; ; " part had me puzzled for a moment. I was
: > trying to find its significance to the algorithm. :)
:
: Really? I woulda thunk that was the simplest part... since it has no
: real impact on the algorithm, merely on the data.
It was tunnel vision. I had to step back to see it as a red herring.
Sometimes thinking just gets in the way.
: > Naturally, I had to noodle around with it.
: >
: > $;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
: > my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
: > $__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print
:
: The "0 &&\nmy" is definitely a cool trick.
I think I lost focus on it. Nobody's going to notice the weird
behavior of "my $foo if 0" with all that obfuscation. It would have
been nice to emphasize that there's a persistent value there
throughout the loops and recursions.
: I rather like the use of 's ee substr... ee; .... ;print' instead of
: 'print substr...'.
Collecting the result into a single string was originally done to help
find the right initial scramble. See below.
: Definitely changing the '25' to '22 + $; =~ y yiy y' puzzled me for a
: bit.
I liked seeing lots of doubled and tripled characters, so I looked for
ways to get more of them. Using 'e' as the delimiter for s/// came
from that, since it already had the /e modifier on the end. Getting
'22' in there was the last touch.
: I'm curious, though -- how did you go about finding the right initial
: string to produce "Just another Perl Hacker,"?
:
: I know how I did it, but I wonder how others would go about it.
The code is just a black box whose transform can be mapped onto what
is supposed to come out.
I ran the character-jumble code (without any of the character-altering
bits like 'y yiy y' ) on 'abcdefghijklmnopqrstuvwxy', with the result
going into $_ . Then...
@foo{/./g} = 'Just another Perl hacker,' =~ /./g;
print join '', @foo{sort keys %foo};
------------------------------
Date: Sat, 15 Feb 2003 22:11:01 +0100
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: newbie date comparison
Message-Id: <1237532.c79Kdae9Xs@nyoga.dubu.de>
Jodyman wrote:
> "Harald H.-J. Bongartz" <bongie@gmx.net> wrote in message
>> No. You should read it like
>> $_ = sprintf("%02d", $_) for ($new_month, $new_day, $new_year);
>>
>> The code above could also be written as
>> for ($new_month, $new_day, $new_year) {
>> $_ = sprintf ("%02d", $_);
>> }
>
> This format is easier to understand. I know about $_ in for and
> foreach loops. I got the aliasing part.
Good.
> I just didn't understand it
> written the top way with $_ = in the front.
Hm. I cannot see your problem, I must admit. But I'll try anyway.
The first code has the form
STATEMENT for EXPR;
which could be written as
for (EXPR) { STATEMENT }
perldoc perlsyn will tell you more of this statement modifier syntax in
the section "Simple statements".
The statement here is an assignment, using the sprintf function:
VARIABLE = sprintf FORMATSTRING, VARLIST;
where both the VARIABLE and the VARLIST in this case are just $_:
$_ = sprintf FORMATSTRING, $_;
The FORMATSTRING is "%02d", that means "take the first argument from
LIST, interpret it as a number that gets formatted with two digits and
maybe a leading zero." So this takes our $_ variable (which is an
alias for $new_month, $new_day, or $new_year), formats it in the
two-digit, leading zero format, and assigns the resulting string again
to $_ (and thus to $new_month, $new_day, or $new_year, respectively).
> In most documentation $_ can be implied,
There are many Perl functions that use an implied $_ if no other
parameter is given, like chop(), chomp(), split() etc.
sprintf is not one of these functions. See perldoc perlfunc for a list
of Perl's built-in functions. If $_ can be a default argument, it is
documented.
HTH,
Harald
--
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"The rule on staying alive as a program manager is to give 'em a number
or give 'em a date, but never give 'em both at once."
------------------------------
Date: Sun, 16 Feb 2003 01:07:28 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: newbie date comparison
Message-Id: <kvB3a.3880$_c6.353730@newsread2.prod.itd.earthlink.net>
"Harald H.-J. Bongartz" <bongie@gmx.net> wrote in message
news:1237532.c79Kdae9Xs@nyoga.dubu.de...
> Jodyman wrote:
>
> > "Harald H.-J. Bongartz" <bongie@gmx.net> wrote in message
> >> No. You should read it like
> >> $_ = sprintf("%02d", $_) for ($new_month, $new_day, $new_year);
> >>
> >> The code above could also be written as
> >> for ($new_month, $new_day, $new_year) {
> >> $_ = sprintf ("%02d", $_);
> >> }
> >
> > This format is easier to understand. I know about $_ in for and
> > foreach loops. I got the aliasing part.
>
> Good.
>
> > I just didn't understand it
> > written the top way with $_ = in the front.
>
> Hm. I cannot see your problem, I must admit. But I'll try anyway.
>
> The first code has the form
> STATEMENT for EXPR;
> which could be written as
> for (EXPR) { STATEMENT }
>
> perldoc perlsyn will tell you more of this statement modifier syntax in
> the section "Simple statements".
>
> The statement here is an assignment, using the sprintf function:
> VARIABLE = sprintf FORMATSTRING, VARLIST;
> where both the VARIABLE and the VARLIST in this case are just $_:
> $_ = sprintf FORMATSTRING, $_;
>
> The FORMATSTRING is "%02d", that means "take the first argument from
> LIST, interpret it as a number that gets formatted with two digits and
> maybe a leading zero." So this takes our $_ variable (which is an
> alias for $new_month, $new_day, or $new_year), formats it in the
> two-digit, leading zero format, and assigns the resulting string again
> to $_ (and thus to $new_month, $new_day, or $new_year, respectively).
>
> > In most documentation $_ can be implied,
>
> There are many Perl functions that use an implied $_ if no other
> parameter is given, like chop(), chomp(), split() etc.
> sprintf is not one of these functions. See perldoc perlfunc for a list
> of Perl's built-in functions. If $_ can be a default argument, it is
> documented.
DING... DING... DING...
I finally get it, Thanks for ALL your help.
Jody
------------------------------
Date: Sun, 16 Feb 2003 05:38:29 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Perl my variable question
Message-Id: <ptF3a.358089$HG.61955811@news4.srv.hcvlny.cv.net>
"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3e4dde21.16452586@news.erols.com...
--snip--
> NOTE: The behaviour of a my statement modified with a
> statement modifier conditional or loop construct (e.g. my $x
> if ...) is undefined. The value of the my variable may be
> undef, any previously assigned value, or possibly anything
> else. Don't rely on it. Future versions of perl might do
> something different from the version of perl you try it out
> on. Here be dragons.
>
>
--snip--
This certainly seems to be the right answer, but I cannot find it in the
documentation supplied with ActiveState 5.6.1. Is this before the 'now'
that you refer to?
Bill
------------------------------
Date: Sun, 16 Feb 2003 01:57:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl my variable question
Message-Id: <3E4F3647.28EF8DEC@earthlink.net>
Bill Smith wrote:
>
> "Jay Tilton" <tiltonj@erols.com> wrote in message
> news:3e4dde21.16452586@news.erols.com...
> --snip--
> > NOTE: The behaviour of a my statement modified with a
> > statement modifier conditional or loop construct (e.g. my $x
> > if ...) is undefined. The value of the my variable may be
> > undef, any previously assigned value, or possibly anything
> > else. Don't rely on it. Future versions of perl might do
> > something different from the version of perl you try it out
> > on. Here be dragons.
> >
> >
> --snip--
>
> This certainly seems to be the right answer, but I cannot find it in
> the documentation supplied with ActiveState 5.6.1. Is this before the
> 'now' that you refer to?
Yes, when he said, "The docs now do the Right Thing...", he was
referring to the docs in perl5.8.0.
--
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print
------------------------------
Date: 15 Feb 2003 23:34:10 -0800
From: zivilyn@www.com (Jeffrey Jenkins)
Subject: Re: Perl+Tk+MySQL for Win32 that *works*?
Message-Id: <ec688889.0302152334.2d0586c8@posting.google.com>
> I'm surprised too this hasn't arisen before. It may be because
> most people happen to have a local mysql installation already,
> or else didn't realize that remote connections are possible,
> and so never tried.
I was just having the same problem and that solved it. Thanks!
------------------------------
Date: 15 Feb 2003 14:29:10 -0800
From: spamthemuse@yahoo.com (Hunch)
Subject: undef true|false
Message-Id: <67800695.0302151429.1fea7c91@posting.google.com>
$hash->{'tmp'} = "hello";
$hash->{'tmp'} = undef;
if ($hash->{'tmp'}) {
print "yes\n";
}
else {
print "no\n";
}
On my linux box it returns "no". Taking the code over to a solaris
box it returns "yes". (We were developing on linux and pushing live
to solaris.) How come? Both use 5.005_03 . It looks like it has
something to do with some systems using 0 and others using the null
string maybe...? Any details/advice?
I had started using "set it to undef" as the best way to make
something resolve to "false" but even that doesn't work in all cases,
looks like. I know it's better to just delete $hash->{'tmp'} but
sometimes I just want to set it to a value returned from a subroutine
(even if it's undef that is returned).
------------------------------
Date: 15 Feb 2003 22:54:23 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: undef true|false
Message-Id: <b2mgev$qda$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Hunch:
> $hash->{'tmp'} = "hello";
> $hash->{'tmp'} = undef;
> if ($hash->{'tmp'}) {
> print "yes\n";
> }
> else {
> print "no\n";
> }
>
> On my linux box it returns "no". Taking the code over to a solaris
> box it returns "yes". (We were developing on linux and pushing live
> to solaris.) How come? Both use 5.005_03 . It looks like it has
> something to do with some systems using 0 and others using the null
> string maybe...? Any details/advice?
I don't know what you did, but I get:
bash-2.03$ perl
$hash->{'tmp'} = "hello";
$hash->{'tmp'} = undef;
if ($hash->{'tmp'}) {
print "yes\n";
}
else {
print "no\n";
}
^D
no
bash-2.03$ uname -a
SunOS usf-cf-sparc-solaris-1 5.8 Generic_108528-17 sun4u sparc SUNW,Ultra-60
bash-2.03$ perl -v
This is perl, version 5.005_03 built for sun4-solaris
...
> I had started using "set it to undef" as the best way to make
> something resolve to "false" but even that doesn't work in all cases,
> looks like. I know it's better to just delete $hash->{'tmp'} but
> sometimes I just want to set it to a value returned from a subroutine
> (even if it's undef that is returned).
Deleting a hash-key and undefing the corresponding value is not the same
thing. In the first case, exists() will return false while in the second
case exists() returns true but the value itself evalutes to false. This
distinction can be useful sometimes.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 15 Feb 2003 22:47:48 -0800
From: spamthemuse@yahoo.com (Hunch)
Subject: Re: undef true|false
Message-Id: <67800695.0302152247.1080d6f9@posting.google.com>
"Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de> wrote in message news:<b2mgev$qda$1@nets3.rz.RWTH-Aachen.DE>...
> Also sprach Hunch:
>
> > $hash->{'tmp'} = "hello";
> > $hash->{'tmp'} = undef;
> > if ($hash->{'tmp'}) {
> > print "yes\n";
> > }
> > else {
> > print "no\n";
> > }
> >
>
> I don't know what you did, but I get:
>
> no
> bash-2.03$ uname -a
>
> This is perl, version 5.005_03 built for sun4-solaris
> ...
Perhaps it's a compile flag? If I insert after line 2:
if ($hash->{'tmp'} == undef) {
delete $hash->{'tmp'};
}
then it returns no. But if I comment that out, it returns yes.
------------------------------
Date: Sun, 16 Feb 2003 00:49:31 GMT
From: "Papa Oohmawmaw" <Pop@goesthe.net>
Subject: use lib Apache->server_root_relative('lib/perl');
Message-Id: <veB3a.117585$iG3.14669@sccrnsc02>
1) Can someone tell me where the line below (a) is pointing to? It's from my
startup.pl file. I'm wanting it to go to "/home/perl_apache/lib/perl/."
a) use lib Apache->server_root_relative('lib/perl');
2) The startup.pl file is at this address (b)
b) /home/perl_apache/lib/perl/startup.pl
3) My httpd.conf is at this address (c)
c) /opt/apache/conf/httpd.conf
Here's the error message I'm getting when trying to start Apache (d).
d) [root@ensim Apache2]# /opt/apache/bin/apachectl start
[error] Can't locate object method "server_root_relative" via package
"Apache" at /home/perl_apache/lib/perl/startup.pl line 5.
BEGIN failed--compilation aborted at /home/perl_apache/lib/perl/startup.pl
line 5.
Compilation failed in require at (eval 1) line 1.
[Sat Feb 15 18:37:35 2003] [error] Can't load Perl file:
/home/perl_apache/lib/perl/startup.pl for server ensim.rackshack.net:0,
exiting...
------------------------------
Date: Sun, 16 Feb 2003 02:03:19 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <Pine.LNX.4.53.0302160159001.27157@lxplus096.cern.ch>
On Feb 16, Papa Oohmawmaw inscribed on the eternal scroll:
> 1) Can someone tell me where the line below (a) is pointing to?
Can you tell me why I've just read this same content posted separately
on comp.infosystems.www.servers.unix ?
That's rude. Please check FAQs for new users (e.g from postings on
news.newusers.questions) to understand how to work properly with the
usenet community.
------------------------------
Date: Sun, 16 Feb 2003 02:26:01 GMT
From: "Papa Oohmawmaw" <Pop@goesthe.net>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <ZEC3a.118673$iG3.14838@sccrnsc02>
Well, slap my hand! Don't you have better things to do than answer emails in
this manner. Answer to help someone if you know anything. Get a life, jerk.
You read 'em, I'm looking for help.
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.53.0302160159001.27157@lxplus096.cern.ch...
> On Feb 16, Papa Oohmawmaw inscribed on the eternal scroll:
>
> > 1) Can someone tell me where the line below (a) is pointing to?
>
> Can you tell me why I've just read this same content posted separately
> on comp.infosystems.www.servers.unix ?
>
> That's rude. Please check FAQs for new users (e.g from postings on
> news.newusers.questions) to understand how to work properly with the
> usenet community.
------------------------------
Date: Sat, 15 Feb 2003 21:08:33 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <slrnb4u05h.5qt.tadmc@magna.augustmail.com>
Papa Oohmawmaw <Pop@goesthe.net> wrote:
> I'm looking for help.
You will get less from now on.
[snip TOFU]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 16 Feb 2003 03:20:07 GMT
From: "Papa Oohmawmaw" <Pop@goesthe.net>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <GrD3a.117730$2H6.2300@sccrnsc04>
Boo hoo. You probably don't know shit, either, jerk.
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb4u05h.5qt.tadmc@magna.augustmail.com...
> Papa Oohmawmaw <Pop@goesthe.net> wrote:
>
> > I'm looking for help.
>
>
> You will get less from now on.
>
>
> [snip TOFU]
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sat, 15 Feb 2003 23:58:04 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <3E4F1A5C.D75EB0E0@earthlink.net>
Papa Oohmawmaw wrote:
>
> Well, slap my hand! Don't you have better things to do than answer
> emails in this manner. Answer to help someone if you know anything.
> Get a life, jerk. You read 'em, I'm looking for help.
I would suggest you read the following message:
http://groups.google.com/groups?selm=u93dhkluz2.fsf@wcl-l.bham.ac.uk
We're not obligated to help you -- we do this for fun. If you're not
polite ... well, no one is paying us to ignore your rudeness.
In addition to reading the new users faq on news.newusers.questions, you
should read the comp.lang.perl.misc posting guidelines:
http://groups.google.com/groups?selm=gHidnXxRH6KmSdGjXTWcrg@august.net
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: Sun, 16 Feb 2003 07:02:52 GMT
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <Xns932414D438560dkwwashere@204.127.199.17>
[post rearranged to normal order instead of TOFU]
"Papa Oohmawmaw" <Pop@goesthe.net> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnb4u05h.5qt.tadmc@magna.augustmail.com...
>> Papa Oohmawmaw <Pop@goesthe.net> wrote:
>>
>> > I'm looking for help.
>>
>>
>> You will get less from now on.
>
> Boo hoo. You probably don't know shit, either, jerk.
You've just irritated most if not all of the regulars here. Tad is one
of the most prolific and knowledgeable posters in this group. I would
guess that a large proportion of the others just silently added you to
their killfiles. Hence Tad's response.
This is not a good way to get help.
In his response to your original post here, Alan was merely pointing out
that it probably should have been *cross-posted* to
comp.infosystems.www.servers.unix instead being in two separate posts.
Whether you like it or not, this newsgroup (clpm) insists that some
basic etiquette be observed. If your actions are perceived as rude,
this newsgroup will not be of much assistance to you.
Good luck.
( TOFU: http://catb.org/esr/jargon/html/entry/TOFU.html )
--
David Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Sun, 16 Feb 2003 07:23:18 GMT
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: use lib Apache->server_root_relative('lib/perl');
Message-Id: <Xns9324184B0BA82dkwwashere@204.127.199.17>
"David K. Wall" <usenet@dwall.fastmail.fm> wrote:
> You've just irritated most if not all of the regulars here. Tad is
> one of the most prolific and knowledgeable posters in this group.
Oops. I should have said "Tad and Alan are among...". Sorry, Alan.
--
David Wall - me@dwall.fastmail.fm
"Oook."
------------------------------
Date: Sat, 15 Feb 2003 21:27:40 -0800
From: SAPBasis2003 <sapbasis2003@netscape.net>
Subject: Win32::NetResource::GetSharedResources
Message-Id: <3E4F214C.6090901@netscape.net>
I'm trying to use Win32::NetResource::GetSharedResources to retrieve all
shares from a system. But, I don't get anything.
Here is my code:
$c_comp=0;
undef @Resources;
use Win32::NetResource;
if (Win32::NetResource::GetSharedResources(\@Resources,
RESOURCETYPE_DISK, ""))
{
map
{
$c_comp++;
print "$_\n";
}
@Resources;
}
The output I get is:
HASH(0x1a5742c)
HASH(0x1abd35c)
HASH(0x1abd374)
HASH(0x1abd38c)
HASH(0x1abd3a4)
What am I missing?
Thanks a lot!
------------------------------
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 4571
***************************************