naming question: Tie::Env 
Author Message
 naming question: Tie::Env

I wrote a little module that ties scalars and arrays to %ENV, the idea
was to allow for an 'export' sub routine. See the synopsis below.

I named this module Tie::Env for the time being, but this doesn't feel
like a speaking name. Someone also suggested Shell::Export. Which name
should I give it for cpan ?

Also I would like to make the routine work without references (syntactic
sugar), is that do-able ? See code below.

=head1 SYNOPSIS

  use Tie::Env qw/export/;




=cut

sub export {
  for (my $i = 0; $i <= $#_; $i += 2) {
    if (ref $_[$i] eq 'SCALAR') {
      tie ${$_[$i]}, 'Tie::Env::scalar', $_[$i+1] ;
    }
    elsif (ref $_[$i] eq 'ARRAY') {

    }
    else { carp 'Invalid arguments.' }
  }

Quote:
}

--
Jaap Karssenberg || Pardus [Larus]

http://www.*-*-*.com/ ~pardus


Wed, 21 Sep 2005 22:46:59 GMT  
 naming question: Tie::Env

Quote:

> I wrote a little module that ties scalars and arrays to %ENV, the idea
> was to allow for an 'export' sub routine. See the synopsis below.

> I named this module Tie::Env for the time being, but this doesn't feel
> like a speaking name. Someone also suggested Shell::Export. Which name
> should I give it for cpan ?

> Also I would like to make the routine work without references (syntactic
> sugar), is that do-able ? See code below.

I'm not sure of what you mean by that .Nevertheless, you might find
David Boyce's closely related module Env::Path inspiring (unless you've
already seen it). See
http://search.cpan.org/author/DSB/Env-Path-0.14/Path.pm.

Heini



Wed, 21 Sep 2005 22:58:10 GMT  
 naming question: Tie::Env

: > Also I would like to make the routine work without references
: > (syntactic sugar), is that do-able ? See code below.
:
: I'm not sure of what you mean by that .Nevertheless, you might find
: David Boyce's closely related module Env::Path inspiring

I mean I would like to do

or even

instead of the current

I've seen Env::Path and the internals are almost the same, but I like a
tie'ed syntax better.

--
Jaap Karssenberg || Pardus [Larus]

http://pardus-larus.student.utwente.nl/~pardus



Thu, 22 Sep 2005 00:56:08 GMT  
 naming question: Tie::Env

Quote:

> I wrote a little module that ties scalars and arrays to %ENV, the idea
> was to allow for an 'export' sub routine. See the synopsis below.

There already is a module to tie the ev's to scalars and arrays, the Env
module by Chip Salzenberg and Gregor N. Purdy (it doesn't seem to be at
CPAN, but it is included in the ActiveState Perl). I don't see what you
are trying to add to that?

Heini



Thu, 22 Sep 2005 00:20:50 GMT  
 naming question: Tie::Env

: There already is a module to tie the ev's to scalars and arrays, the
: Env module by Chip Salzenberg and Gregor N. Purdy (it doesn't seem to
: be at CPAN, but it is included in the ActiveState Perl). I don't see
: what you are trying to add to that?

I wasn't aware of that module <em>because it isn't on cpan</em>.
A module name/href/anything would be nice to check it in detail.

--
Jaap Karssenberg || Pardus [Larus]

http://pardus-larus.student.utwente.nl/~pardus



Thu, 22 Sep 2005 01:49:40 GMT  
 naming question: Tie::Env
My excuses - I was to fast with my reply.
It is on CPAN **shame**.

http://search.cpan.org/src/JHI/perl-5.8.0/lib/Env.pm

Anyway the point remains I want an 'export' function, but it will be
more simple using Env.

--
Jaap Karssenberg || Pardus [Larus]

http://pardus-larus.student.utwente.nl/~pardus



Thu, 22 Sep 2005 01:59:13 GMT  
 naming question: Tie::Env


: There already is a module to tie the ev's to scalars and arrays, the
: Env module by Chip Salzenberg and Gregor N. Purdy (it doesn't seem to
: be at CPAN, but it is included in the ActiveState Perl). I don't see
: what you are trying to add to that?

It is on CPAN
http://search.cpan.org/src/JHI/perl-5.8.0/lib/Env.pm

I totally overlooked it one cpan *shame* - I looked for things like 'tie
env' but simply forgot the search term 'env' alone.

--
Jaap Karssenberg || Pardus [Larus]

http://pardus-larus.student.utwente.nl/~pardus



Thu, 22 Sep 2005 02:08:34 GMT  
 naming question: Tie::Env

Quote:


> : There already is a module to tie the ev's to scalars and arrays, the
> : Env module by Chip Salzenberg and Gregor N. Purdy (it doesn't seem to
> : be at CPAN, but it is included in the ActiveState Perl). I don't see
> : what you are trying to add to that?

> It is on CPAN
> http://search.cpan.org/src/JHI/perl-5.8.0/lib/Env.pm

> I totally overlooked it one cpan *shame* - I looked for things like 'tie
> env' but simply forgot the search term 'env' alone.

Ach, I was actually trying to find Env::Array, which is mentioned in
Env::Path's document, but didn't realize that Env::Array is part of Env,
and wasn't really looking for Env either. There are lots of modules at
CPAN that I am not aware of.

Heini

Quote:

> --
> Jaap Karssenberg || Pardus [Larus]

> http://pardus-larus.student.utwente.nl/~pardus



Thu, 22 Sep 2005 01:20:47 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Concern over method names for Perl 5 tie access

2. How to name a Tie:: and namespace issues

3. How to name a Tie:: and namespace issues

4. Expand ENV var within another ENV var

5. Insecure $ENV{ENV} complaint from -T

6. Newbie: %ENV question

7. url, $ENV question

8. $ENV{'REFER_URL'} Question

9. Unix shell env var question ???

10. env var question

11. Beginner's question : how to set path and env

12. ENV Question

 

 
Powered by phpBB® Forum Software