[29546] in Perl-Users-Digest
Perl-Users Digest, Issue: 790 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 24 11:09:39 2007
Date: Fri, 24 Aug 2007 08:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 24 Aug 2007 Volume: 11 Number: 790
Today's topics:
autobox as ppm package for AS Perl? <bik.mido@tiscalinet.it>
Re: best practice ... requires xhoster@gmail.com
Re: How safe is $0? anno4000@radom.zrz.tu-berlin.de
Re: How safe is $0? xhoster@gmail.com
Re: How safe is $0? <bik.mido@tiscalinet.it>
Re: Is there a better way of doing this? usenet@DavidFilmer.com
Re: Is there a better way of doing this? <klaus03@gmail.com>
Re: Is there a better way of doing this? <mritty@gmail.com>
Regular expression use (Nick Maclaren)
Re: Regular expression use anno4000@radom.zrz.tu-berlin.de
Re: Regular expression use <klaus03@gmail.com>
Re: Regular expression use <bert.heymans@gmail.com>
Re: Regular expression use <wahab-mail@gmx.net>
Re: Regular expression use (Nick Maclaren)
Re: Script does not want to run in background ?!? <benoit.lefebvre@gmail.com>
Re: Starting with SOAP xhoster@gmail.com
Re: Starting with SOAP <scobloke2@infotop.co.uk>
Re: Why is $^O assignable? <pue@gmx.net>
Re: Why is $^O assignable? <pue@gmx.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 24 Aug 2007 14:05:45 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: autobox as ppm package for AS Perl?
Message-Id: <nsgtc3hbkc487nvfg2forde9tdfq4cnclc@4ax.com>
Does anybody have a precompiled autobox ppm for AS Perl, version
5.8.8? Currently my repositories are:
+---------------------------------------------+
¦ id ¦ pkgs ¦ name ¦
+----+-------+--------------------------------¦
¦ 1 ¦ 6837 ¦ ActiveState Package Repository ¦
¦ 2 ¦ 648 ¦ uwinnipeg ¦
¦ 3 ¦ 420 ¦ bribes ¦
¦ 4 ¦ 10501 ¦ trouchelle ¦
¦ 5 ¦ 20 ¦ SoulCage ¦
+---------------------------------------------+
(5 enabled repositories)
But a search of autobox only turns out
1: autobox-Core
Perl built-in functions exposed as methods in primitive types
Version: 0.3
Author: Scott Walters scott@slowass.net
Provide: autobox::Core version 0.3
Require: autobox
Repo: trouchelle
CPAN: http://search.cpan.org/dist/autobox-Core-0.3/
Installed: 0.3 (site)
Which depends on autobox itself.
Note: also posted in PerlMonks at
<http://perlmonks.org/?node_id=634841>.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 24 Aug 2007 14:36:20 GMT
From: xhoster@gmail.com
Subject: Re: best practice ... requires
Message-Id: <20070824103621.981$Vg@newsreader.com>
mike <hillmw@charter.net> wrote:
> i'm having trouble with variables
>
> I have a main cgi script ... lets call it main.cgi
>
> In main.cgi i have some other perl scripts that have subroutines
>
> #!/usr/bin/perl -w
> #
> # name of this program is: main.cgi
> #
You should use strict;
>
> use CGI;
> use Cwd; #used to get the current working directory
> $filebase = cwd;
>
> #requires here
> require "$filebase/some.lib";
> require "$filebase/a.pl";
> require "$filebase/b.pl";
> require "$filebase/c.pl";
I think use is usually better than require for this type of stuff.
And if "." is in your @INC, then it will automatically search cwd for them.
>
> my $x = &do this;
Why are using this syntax?
> So the question is:
> 1) if i dont use a subroutine that is in some.lib here in main.cgi but
> in a.pl is it better to remove the require from main.cgi and put it in
> a.pl?
Probably, yes.
> 2) can my require in main.cgi be global since the vars in some.lib are
> used in a.pl, b.pl, and c.pl?
Does your library or any of the scripts change the package?
"package" variables in some.lib can be used from anywhere, they just need
to be fully qualified with a package name if you are using them from
another package (or even from the same package under strict.)
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 24 Aug 2007 11:16:10 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How safe is $0?
Message-Id: <5j7svqF3sm5ugU1@mid.dfncis.de>
Bill H <bill@ts1000.us> wrote in comp.lang.perl.misc:
> If I use $0 to determine the name of the script that is running is it
> safe to assume that it will not change within the script (as long as I
> never intentionally try to change it? The way I am using it is setting
> certain messages based on the the script. Somthing like this:
>
> if ($0 eq "foo.pl")
> {
> $blah = "foo";
> }
> if ($0 eq "bar.pl")
> {
> $blah = "bar";
> }
Well, $0 is a writable package variable, so in principle anyone
can change it. To do so in a module would have to be considred
bad style, but that's no guarantee it won't happen. To be safe
you can but the code that uses $0 in a BEGIN block in the main
script that happens before any "use" statements:
my $blah;
BEGIN { ( $blah = $0) =~ s/\.pl$// }
use ...;
Anno
------------------------------
Date: 24 Aug 2007 14:49:10 GMT
From: xhoster@gmail.com
Subject: Re: How safe is $0?
Message-Id: <20070824104911.693$6R@newsreader.com>
Bill H <bill@ts1000.us> wrote:
> If I use $0 to determine the name of the script that is running is it
> safe to assume that it will not change within the script (as long as I
> never intentionally try to change it?
That is probably fairly safe to assume, but why assume? I can't think of
Perl's internals mucking with it without being asked to. Some weird module
might want to.
> The way I am using it is setting
> certain messages based on the the script. Somthing like this:
>
> if ($0 eq "foo.pl")
> {
> $blah = "foo";
> }
> if ($0 eq "bar.pl")
> {
> $blah = "bar";
> }
Why not just put "my $orig_0=$0" near the top of the script? Then
you don't have to worry about either Perl's internals or other modules
changing it, plus it frees you (or your successor) to change the real $0
in the future if you ever feel the need to use its status-indicating
feature.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 24 Aug 2007 16:52:49 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How safe is $0?
Message-Id: <b2stc3has5csj1u0q44754m6pifgh14afd@4ax.com>
On 24 Aug 2007 14:49:10 GMT, xhoster@gmail.com wrote:
>Why not just put "my $orig_0=$0" near the top of the script? Then
>you don't have to worry about either Perl's internals or other modules
>changing it, plus it frees you (or your successor) to change the real $0
>in the future if you ever feel the need to use its status-indicating
>feature.
Huh?!? "near the top"? As Anno correctly pointed out, to be really
sure it needs to be in a BEGIN block before other BEGIN blocks and
use's.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 24 Aug 2007 10:13:49 -0000
From: usenet@DavidFilmer.com
Subject: Re: Is there a better way of doing this?
Message-Id: <1187950429.422199.303260@i38g2000prf.googlegroups.com>
On Aug 24, 2:05 am, Bill H <b...@ts1000.us> wrote:
> In a script I have on a site I read all the values passed in the url
> (using the GET method) into an array called $query{'foo'}
http://search.cpan.org/~lds/CGI.pm-3.29/CGI.pm#FETCHING_THE_PARAMETER_LIST_AS_A_HASH:
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Fri, 24 Aug 2007 03:59:52 -0700
From: Klaus <klaus03@gmail.com>
Subject: Re: Is there a better way of doing this?
Message-Id: <1187953192.990390.228980@r23g2000prd.googlegroups.com>
On Aug 24, 11:05 am, Bill H <b...@ts1000.us> wrote:
[snip]
[rearranged from the bottom]
> foreach $temp (keys(%query))
> {
> eval("\$$temp = \$query{\$temp};");
> }
> The question is, is there anything wrong with doing the following to
> automate this process
String-eval is dangerous if you don't control the content of $temp and
it is also slow.
> or is there a better "perl" way of doing the same?
You could try symbolic references (see perldoc perlref), but beware:
Only package variables (globals, even if localized) are visible to
symbolic references. Lexical variables (declared with my()) aren't in
a symbol table, and thus are invisible to this mechanism
--
Klaus
------------------------------
Date: Fri, 24 Aug 2007 05:36:37 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Is there a better way of doing this?
Message-Id: <1187958997.270535.35810@z24g2000prh.googlegroups.com>
On Aug 24, 5:05 am, Bill H <b...@ts1000.us> wrote:
> In a script I have on a site I read all the values passed in the url
> (using the GET method) into an array called $query{'foo'} where foo is
> the name of the value. Though this has always worked fine I find
> myself assigning them to a new variable to make it easier to recognize
> them and quicker to type, for example I'll make $foo = $query{'foo'};
Why aren't you just using the standard CGI.pm module? Why are you
bothering to parse the query string and build a parameter list
yourself?
use CGI ':standard';
import_names 'Q';
print "Foo: $Q::foo\n";
Paul Lalli
------------------------------
Date: 24 Aug 2007 10:58:46 GMT
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Subject: Regular expression use
Message-Id: <famdl6$p9j$1@gemini.csx.cam.ac.uk>
For reasons that I won't explain, as they are too complicated
and not terribly relevant, I am interested in discovering what
people actually use regular expressions for. Not the subject
domain, but the construction of the regular expressions.
I know about computer scientists and parsing, and I know about
the use of relatively simple ones for things like extracting
HTML links from Web pages. But I don't have much feel for the
(probably rare but difficult) uses of more complex ones for
other purposes. I have heard of several such uses, but don't
have an overall idea of what is going on.
Any pointers appreciated, to more-or-less anything.
Regards,
Nick Maclaren.
------------------------------
Date: 24 Aug 2007 11:39:23 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Regular expression use
Message-Id: <5j7ubbF3sovufU1@mid.dfncis.de>
Nick Maclaren <nmm1@cus.cam.ac.uk> wrote in comp.lang.perl.misc:
>
> For reasons that I won't explain, as they are too complicated
> and not terribly relevant,
Your reasons are relevant as a motivation for your readers to
answer such a broad question.
> I am interested in discovering what
> people actually use regular expressions for. Not the subject
> domain, but the construction of the regular expressions.
How is the construction of a regex related to what it is used
for? That makes no sense.
> I know about computer scientists and parsing,
That's a (broad) subject domain.
> and I know about
> the use of relatively simple ones for things like extracting
> HTML links from Web pages.
That's another subject domain (and a regex for that purpose wouldn't
qualify as "relatively simple").
> But I don't have much feel for the
> (probably rare but difficult) uses of more complex ones for
> other purposes. I have heard of several such uses, but don't
> have an overall idea of what is going on.
Your question is so badly defined, it would take considerable effort
just to make sense of it. Given your premise of "Never mind what I
need it for, just gimme the info," I won't even try.
Anno
------------------------------
Date: Fri, 24 Aug 2007 04:40:20 -0700
From: Klaus <klaus03@gmail.com>
Subject: Re: Regular expression use
Message-Id: <1187955620.234939.166350@i13g2000prf.googlegroups.com>
On Aug 24, 12:58 pm, n...@cus.cam.ac.uk (Nick Maclaren) wrote:
> For reasons that I won't explain, as they are too complicated
> and not terribly relevant, I am interested in discovering what
> people actually use regular expressions for. Not the subject
> domain, but the construction of the regular expressions.
>
> I know about computer scientists and parsing, and I know about
> the use of relatively simple ones for things like extracting
> HTML links from Web pages. But I don't have much feel for the
> (probably rare but difficult) uses of more complex ones for
> other purposes. I have heard of several such uses, but don't
> have an overall idea of what is going on.
As far as Perl is concerned: have a look at http://search.cpan.org/ .
I guess it's fairly representative of all perl programs and you will
find tons of regular expressions there.
--
Klaus
------------------------------
Date: Fri, 24 Aug 2007 06:09:28 -0700
From: Bert Heymans <bert.heymans@gmail.com>
Subject: Re: Regular expression use
Message-Id: <1187960968.808605.20050@i38g2000prf.googlegroups.com>
Nick,
In "Mastering Regular Expressions" by Jeffrey E. F. Friedl your
question is answered in the first 6 chapters. Seriously, that's what
it takes. It's a really good book.
Cheers
Bert
On Aug 24, 12:58 pm, n...@cus.cam.ac.uk (Nick Maclaren) wrote:
> For reasons that I won't explain, as they are too complicated
> and not terribly relevant, I am interested in discovering what
> people actually use regular expressions for. Not the subject
> domain, but the construction of the regular expressions.
>
> I know about computer scientists and parsing, and I know about
> the use of relatively simple ones for things like extracting
> HTML links from Web pages. But I don't have much feel for the
> (probably rare but difficult) uses of more complex ones for
> other purposes. I have heard of several such uses, but don't
> have an overall idea of what is going on.
>
> Any pointers appreciated, to more-or-less anything.
>
> Regards,
> Nick Maclaren.
------------------------------
Date: Fri, 24 Aug 2007 15:07:56 +0200
From: Mirco Wahab <wahab-mail@gmx.net>
Subject: Re: Regular expression use
Message-Id: <famlj0$33k$1@mlucom4.urz.uni-halle.de>
Nick Maclaren wrote:
> For reasons that I won't explain, as they are too complicated
> and not terribly relevant, I am interested in discovering what
> people actually use regular expressions for. Not the subject
> domain, but the construction of the regular expressions.
After I figured out how to solve a problem,
I'll surely rewrite the solution again in
pure Perl5 regular expressions in order to
outrun the normal mental degradation processes
related to aging ... :)
> I know about computer scientists and parsing, and I know about
> the use of relatively simple ones for things like extracting
> HTML links from Web pages. But I don't have much feel for the
> (probably rare but difficult) uses of more complex ones for
Using complex regular expressions is like tank destruction
with contact charges glued on them. Only a few people
will even survive the first "usage", but survivors will
then eventually be able to destroy almost every tank with
tremendous speed and precision.
> other purposes. I have heard of several such uses, but don't
> have an overall idea of what is going on.
On business software projects, maintainability is a key
prerequisite - after using complex regular expressions
on business critical parts you are bound to involve
very very expensive maintenance programmers ... :)
What exactly did you "hear" of several "uses"? Which
application? Academia, Business, ...?
Regards
M.
------------------------------
Date: 24 Aug 2007 13:36:00 GMT
From: nmm1@cus.cam.ac.uk (Nick Maclaren)
Subject: Re: Regular expression use
Message-Id: <famms0$em2$1@gemini.csx.cam.ac.uk>
In article <famlj0$33k$1@mlucom4.urz.uni-halle.de>,
Mirco Wahab <wahab-mail@gmx.net> writes:
|>
|> Using complex regular expressions is like tank destruction
|> with contact charges glued on them. Only a few people
|> will even survive the first "usage", but survivors will
|> then eventually be able to destroy almost every tank with
|> tremendous speed and precision.
I must remember that! It is nicely put.
|> On business software projects, maintainability is a key
|> prerequisite - after using complex regular expressions
|> on business critical parts you are bound to involve
|> very very expensive maintenance programmers ... :)
Yes :-) Even regular expression experts have major problems
ensuring that complicated ones match everything that they need
to and nothing that they don't. The same thing applies to
uses of the C preprocessor and many uses of Perl ....
|> What exactly did you "hear" of several "uses"? Which
|> application? Academia, Business, ...?
Mainly academic research, but that still covers many fields.
However, I am not and never have been a 'pure' academic, and
am as interested in other uses as in academic research.
Regards,
Nick Maclaren.
------------------------------
Date: Fri, 24 Aug 2007 06:30:22 -0700
From: Benoit Lefebvre <benoit.lefebvre@gmail.com>
Subject: Re: Script does not want to run in background ?!?
Message-Id: <1187962222.450593.253880@z24g2000prh.googlegroups.com>
On Aug 24, 3:59 am, Joe Smith <j...@inwap.com> wrote:
> Benoit Lefebvre wrote:
> > When I run it from the crontab or in background "&" it fails.
> > chomp(@list = `ssh -q hscroot\@$hmc 'lssyscfg -r sys --all'`);
>
> You're supposed to use `ssh -n` for that.
>
> -n Redirects stdin from /dev/null (actually, prevents reading from
> stdin). This must be used when ssh is run in the background.
Oh!
Hey it's working now :)
Thanks for that.. I feel so stupid to have forgot that !
Thanks!
--Benoit Lefebvre
benoit.lefebvre@cn.ca
------------------------------
Date: 24 Aug 2007 14:24:51 GMT
From: xhoster@gmail.com
Subject: Re: Starting with SOAP
Message-Id: <20070824102452.297$Ui@newsreader.com>
Ian Wilson <scobloke2@infotop.co.uk> wrote:
> xhoster@gmail.com wrote:
> > When I point SOAP::Lite at a .net WSDL, it just dies from
> > internal errors.
>
> It may depend on the particular web-service. Can you get a basic
> SOAP::Lite client and server working?
>
> I have Apache installed on my Windows XP computers since the target
> environment for which I develop is Apache.
>
> In Apache's cgi-bin directory I put service.pl
> -----------------------------8<--------------------------------
> #!perl
> use strict;
> use warnings;
> use SOAP::Transport::HTTP;
> SOAP::Transport::HTTP::CGI
> -> dispatch_to('C:/path/to/cgi-bin/SoapModules')
> -> handle;
> -----------------------------8<--------------------------------
>
> In a subfolder cgi-bin\SoapModules I have Temperature.pm
> -----------------------------8<--------------------------------
> package Temperature;
> sub c2f {
> my ($class, $c) = @_;
> return 32+$c*9/5;
> }
> 1;
> -----------------------------8<--------------------------------
>
> Elsewhere I have a client tempclient.pl
> -----------------------------8<--------------------------------
> #!perl
> use strict;
> use warnings;
> use SOAP::Lite;
>
> my $temperature=SOAP::Lite
> -> uri('Temperature')
> -> proxy('http://localhost/cgi-bin/service.pl');
>
> print $temperature
> -> c2f(37.5)
> -> result;
> -----------------------------8<--------------------------------
>
> C:> perl tempclient.pl
> 99.5
> C:>
It works almost without a problem. The only problem is that
SOAP and SOAP::Lite both have package named SOAP::Packager. If
SOAP::Lite does "use SOAP::Packager" and gets the module from
SOAP instead of SOAP::Lite, then it won't work. So I had to arrange for
all of SOAP::Lites modules to come before any of SOAP's in the search
path. Then I just deleted SOAP altogether, which seems to have been
a good decision.
And to the original poster, It also looks like SOAP and SOAP::Lite
both define a package SOAP::Transport::HTML::CGI. One defines it
in it's own .pm file, and the other includes it as an internal
package of SOAP::Transport::HTTP.pm. So perhaps the problem is not
that you need to have both installed but rather than you have to *not*
have both installed.
>
> There's crawling, walking and running stages of learning SOAP::Lite. The
> above constitutes crawling. I find it useful to make sure I can crawl
> before attempting more advanced forms of locomotion.
Unfortunately, crawling just isn't getting me anywhere. I already know
who to make Perl talk to Perl; if that was the goal I'd wouldn't resort to
SOAP to do it. It is working with WSDLs created by other "frameworks"
there the benefit is, and that is what I can't get working.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 24 Aug 2007 15:52:05 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: Starting with SOAP
Message-Id: <46cef09a$0$21093$da0feed9@news.zen.co.uk>
xhoster@gmail.com wrote:
> Ian Wilson <scobloke2@infotop.co.uk> wrote:
>
>> There's crawling, walking and running stages of learning
>> SOAP::Lite. The above constitutes crawling. I find it useful to
>> make sure I can crawl before attempting more advanced forms of
>> locomotion.
Now I re-read what I wrote, it sounds a bit condescending, that wasn't
what I intended - my apologies for that.
> Unfortunately, crawling just isn't getting me anywhere. I already
> know who to make Perl talk to Perl; if that was the goal I'd wouldn't
> resort to SOAP to do it. It is working with WSDLs created by other
> "frameworks" there the benefit is, and that is what I can't get
> working.
I suppose this WSDL isn't something you can post here?
Anyway, WSDL is just a convenience. If you understand what the service
expects you can generate a SOAP call without having SOAP::Lite read the
WSDL.
There are some public websites into which you can type the URL of some
WSDL and they will then provide a more human readable interpretation.
That might help.
http://www.mgateway.com/php/wsdlValidator/home.php
What I have found very useful is when the service developer provides
some "test client" that exercises the service. In conjunction with a
network sniffer such as Wireshark it is then possible to view the XML
transmitted and adjust your SOAP::Lite client until it emits
sufficiently similar XML to be acceptable to the service. Some
web-server technologies are more tolerant than others!
If Perl won't grok the WSDL, will Mono? - I found it fairly easy to
generate simple web-service clients using Mono - I had one working
within a day with no prior C/C++/C# experience. Then you can run a
sniffer on that to see what XML is flying back and forth.
http://www.mono-project.com/Web_Services
In your shoes, I'd give up on getting Perl to read the WSDL and try and
construct a SOAP::Lite call for the simplest service defined in that
WSDL, using any of the ideas suggested above.
Your Mileage May Vary :-)
I hope that helps, commiserations if not.
------------------------------
Date: Fri, 24 Aug 2007 16:14:08 +0200
From: =?ISO-8859-1?Q?Andreas_P=FCrzer?= <pue@gmx.net>
Subject: Re: Why is $^O assignable?
Message-Id: <5j874sF3t68hiU1@mid.individual.net>
xhoster@gmail.com schrieb:
> Andreas_Pürzer <pue@gmx.net> wrote:
>
>>Greetings!
>>
>>Recently I've stumbled over code where someone assigned to $^0
>>
>>So, I'm a little lost why it's even possible to (ab-)use $^O this way,
>>and I fail to see the possible benefits of doing so.
>
>
> I can see doing that for various testing, debugging, and development
> purposes.
>
>
> Xho
>
Yes, testing, I had thought of that too, with the following scenario:
Developing a Module that is intended to behave differently on differing
platforms. Say I'm on Win32 and want to test the part of the Module
designed for MacOs, what good would it be to trick the Module into
believing being on MacOs, if, in fact it's still on Win32?
I mean, none of the MacOs code could possibly work, right?
At least not the code depending on the filesystem.
That's why I discarded the testing-answer.
But then again, for example File::Spec->devnull() could very well be
tested with $^O-magic.
So, your answer seems to be absolutely perfect.
I guess I was struck by perlvar talking about $^O in the past, so I
considered it to be a constant, the $OSNAME perl was built on.
Somehow I was under the impression there were 2 $^O-Variables, something
like $BUILD_OSNAME and $RUN_OSNAME. My bad...
Thanks for clearing things up,
Andreas Pürzer
--
Have Fun,
and if you can't have fun,
have someone else's fun.
The Beautiful South
------------------------------
Date: Fri, 24 Aug 2007 16:25:03 +0200
From: =?ISO-8859-1?Q?Andreas_P=FCrzer?= <pue@gmx.net>
Subject: Re: Why is $^O assignable?
Message-Id: <5j87pbF3stg5rU1@mid.individual.net>
Ben Morrow schrieb:
> Quoth "Sisyphus" <sisyphus1@nomail.afraid.org>:
>
>>"Andreas Pürzer" <pue@gmx.net> wrote in message
>>news:5j564nF3riro0U1@mid.individual.net...
>>.
>>.
>>
>>>So, I'm a little lost why it's even possible to (ab-)use $^O this way,
>>
>>Damn good question ... I don't know the answer (and I look forward to seeing
>>responses from folk who *do* know).
>
>
> I can't answer, but there is special code in mg.c to make it possible,
> and it has been there since at least 5.003.
>
Magical Case '\017', I see...
So $^0 can be used as both the historical value while building, as well
as the currently running OS, very nice.
But why am I surprised, it's Perl! ;->
>
>>>and I fail to see the possible benefits of doing so.
>>
>>Me too.
>
>
> I guess perhaps for testing? Presumably the File::Spec test suite, for
> instance, contains some tests along the lines of
>
> {
> local $^O = 'MSWin32';
> require File::Spec;
> File::Spec->import;
> # check that File::Spec::Win32 got loaded
> }
>
> Ben
>
This seems to be 'The Answer'.
Thanks to both Sisyphus and Ben Morrow for helping me understand,
Andreas Pürzer
--
Have Fun,
and if you can't have fun,
have someone else's fun.
The Beautiful South
------------------------------
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 V11 Issue 790
**************************************