RE: [OT?] Win32 permissions puzzler

2003-02-20 Thread Alessandro Forghieri
Greetings.

I am afraid this is rapidly becoming less than relevant, however..

 -Original Message-
 From: Stas Bekman [mailto:[EMAIL PROTECTED]]
[...]
 You have to declare variables as globals before using them. 

Agreed 

 Even the imported ones. That's a pure perl issue. Please proceed to the
perl 
 lists/groups/monks for further discussion.

This is a bit of a surprise the following, in fact, runs just fine:

--Foo.pm--
package Foo;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = ( qw( $foo ) );
our @EXPORT = qw();
our $VERSION = '0.01';
our $foo=1;
1;

--usefoo.pl
use strict;
use warnings;
use Foo qw($foo);
print foo is $foo\n;

$ perl usefoo.pl
foo is 1

This is according to my instinct - and practice: I have been using this
idiom, under strict, for the longest time and the interpreter has never
raised an eyebrow about it. BTW, this also works with @IMPORT (not only with
@IMPORT_OK). I cannot give you a doc pointer that explicitely says that it
must be so (or why), though. 

Cheers,
alf



Re: [OT?] Win32 permissions puzzler

2003-02-20 Thread Stas Bekman
Alessandro Forghieri wrote:


This is a bit of a surprise the following, in fact, runs just fine:

--Foo.pm--
package Foo;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = ( qw( $foo ) );
our @EXPORT = qw();
our $VERSION = '0.01';
our $foo=1;
1;

--usefoo.pl
use strict;
use warnings;
use Foo qw($foo);
print foo is $foo\n;

$ perl usefoo.pl
foo is 1

This is according to my instinct - and practice: I have been using this
idiom, under strict, for the longest time and the interpreter has never
raised an eyebrow about it. BTW, this also works with @IMPORT (not only with
@IMPORT_OK). I cannot give you a doc pointer that explicitely says that it
must be so (or why), though. 

It works because Exporter aliases variables in the exporting package to the 
importing one and probably adds some black magic ;)

However I thought that you may have hit the problem described here:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#toc_Using_Exporter_pm_to_Share_Global_Variables
when the same variable is to be shared by several packages. But I guess that 
wasn't the case.

Can you reduce the code to a generic case so it can be reproduced at will? 
Does it behave the same with and without mod_perl?

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [OT?] Win32 permissions puzzler

2003-02-19 Thread Alessandro Forghieri

Greetings.



Alessandro Forghieri wrote:
[...]

use Bar qw($foo);

if($foo) {
...
Global symbol $foo requires explicit package name at

use vars qw($foo);
use Bar qw($foo);

[...]


Not sure I am following you here. $foo is in the @EXPORT_OK list of module
Bar, which is, in turn,an Exporter. It is my understanding that this should
work (as it does after
the impersonated user has been given Admin powers).
 
Cheers,
alf


-- 


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [OT?] Win32 permissions puzzler

2003-02-19 Thread Stas Bekman
Alessandro Forghieri wrote:


Alessandro Forghieri wrote:
[...]



use Bar qw($foo);

if($foo) {
...
Global symbol $foo requires explicit package name at


use vars qw($foo);
use Bar qw($foo);



[...]


Not sure I am following you here. $foo is in the @EXPORT_OK list of module
Bar, which is, in turn,an Exporter. It is my understanding that this should
work (as it does after
the impersonated user has been given Admin powers).


You have to declare variables as globals before using them. Even the imported 
ones. That's a pure perl issue. Please proceed to the perl lists/groups/monks 
for further discussion.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [OT?] Win32 permissions puzzler

2003-02-13 Thread Stas Bekman
Alessandro Forghieri wrote:
[...]

use Bar qw($foo);

if($foo) {
...
Global symbol $foo requires explicit package name at


use vars qw($foo);
use Bar qw($foo);

or with 5.6+

our $foo;
use Bar qw($foo);

See:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Using_Global_Variables_and_Sharing_Them_Between_Modules_Packages

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com