cvs commit: p5ee/App-Context/lib/App Context.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     06/01/18 06:55:58

  Modified:    App-Context/lib/App Context.pm
  Log:
  second try to get {temporary} working
  
  Revision  Changes    Path
  1.24      +7 -6      p5ee/App-Context/lib/App/Context.pm
  
  Index: Context.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Context/lib/App/Context.pm,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Context.pm	8 Nov 2005 03:44:42 -0000	1.23
  +++ Context.pm	18 Jan 2006 14:55:58 -0000	1.24
  @@ -473,9 +473,10 @@
       }
   
       $new_service = 0;
  +    my $temporary = $args->{temporary};
   
       #   NEVER DEFINED     OR   NON-BLESSED HASH (fully defined services are blessed into classes)
  -    if (!defined $service || ref($service) eq "HASH") {
  +    if ($temporary || !defined $service || ref($service) eq "HASH") {
           $service = {} if (!defined $service);  # start with new hash ref
           $service->{name} = $name;
           $service->{context} = $self;
  @@ -546,10 +547,10 @@
       # This is really handy when you have something like a huge spreadsheet
       # of text entry cells (usually an indexed variable).
   
  -    if (defined $args->{temporary}) {            # may be specified implicitly
  +    if ($temporary) {                            # may be specified implicitly
           $lightweight = 1;
       }
  -    if (defined $args->{lightweight}) {          # may be specified explicitly
  +    elsif (defined $args->{lightweight}) {       # may be specified explicitly
           $lightweight = $args->{lightweight};
       }
       else {
  @@ -580,7 +581,7 @@
           $self->dbgprint("Context->service() new service [$name]")
               if ($App::DEBUG && $self->dbg(3));
   
  -        if (defined $service->{default}) {
  +        if (!$temporary && defined $service->{default}) {
               $default = $service->{default};
               if ($default =~ /^\{today\}\+?(-?[0-9]+)?$/) {
                   $default = time2str("%Y-%m-%d",time + 2*3600 + ($1 ? ($1*3600*24) : 0));
  @@ -606,7 +607,7 @@
               if ($App::DEBUG && $self->dbg(3));
   
           bless $service, $class;            # bless the service into the class
  -        if (!$service->{temporary}) {
  +        if (!$temporary) {
               $session->{cache}{$type}{$name} = $service;   # save in the cache
           }
           $service->_init();               # perform additional initializations
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.