diff Lib/IMPL/Web/Application/Resource.pm @ 333:cd6409f66a5f

small fixes, request environment is deprecated
author cin
date Tue, 11 Jun 2013 20:22:52 +0400
parents 04a093f0a5a6
children 71221d79e6b4
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/Resource.pm	Sun Jun 09 21:48:57 2013 +0400
+++ b/Lib/IMPL/Web/Application/Resource.pm	Tue Jun 11 20:22:52 2013 +0400
@@ -2,6 +2,7 @@
 use strict;
 
 use URI;
+use Carp qw(carp); 
 use IMPL::Const qw(:prop);
 use IMPL::declare {
 	require => {
@@ -35,13 +36,13 @@
 	die ArgumentException->new( contract => 'A contract is required' )
 	  unless $args{contract};
 
-	$this->request($args{action})
+	$this->request($args{request})
 		or die ArgumentException->new(request => 'A request object must be specified');
 	$this->parent( $args{parent} );
 	$this->model( $args{model} );
 	$this->id( $args{id} );
 	$this->contract( $args{contract} );
-	$this->application( $args{action}{application} );
+	$this->application( $args{request}->application );
 
 # если расположение явно не указано, то оно вычисляется автоматически,
 # либо остается не заданным
@@ -70,7 +71,10 @@
 # т.к. они просто освободятся несколько позже.
 	if ( not $request->context->{resource} ) {
 		$request->context->{resource} = $this;
-		$request->context->{environment} = sub { $this->PrepareEnvironment() };
+		$request->context->{environment} = sub {
+			carp "using request environment is deprecated";
+			$this->PrepareEnvironment()
+		};
 	}
 
 	return _InvokeDelegate( $operation, $this, $request );