Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

In perl, what is the difference between $DB::single = 1 and 2? -


what difference between putting $db::single=1 , $db::single=2 in code? both seem have identical effect of halting execution @ statement following assignment when 'c' on perl debugger command line.

perldebug says value of 1 equivalent having pressed 's' next statement, , 2 same 'n', difference make how got statement?

from perldebug:

if set $db::single 2, it's equivalent having typed n command (which executes on subroutine calls), whereas value of 1 means s command (which enters subroutine calls).

that know already.


from user point of view, i'm pretty sure there no difference. base on examination of actual db.pm source code.

let's follow logically. may want refer source code. i've simplified of code remove unnecessary detail should able idea descriptions.

when executing code in debugger, there (at least) 2 important variables, running , single. combination of these decides whether code run:

running  single  description -------  ------  -----------    0       ?     not running    1       0     running flat-out    1       1     single stepping, execute function    1       2     single stepping, execute on function 

the db() function executed every single line, , contains following snippet stop running if single has been set (it executes current line regardless):

if ($db::single) {     $db::single = 0;     $running = 0; } 

that's why, if set variable in perl code, break (by break, mean "stop running code", not "damage somehow") debugger @ next line.

when running 0, db() function enters little loop:

# sit in event loop until sets $running {     $c->idle;          # call client event loop; must not block } until $running; 

in other words, waits on user command sets running 1. can done 1 of following 3 functions:

sub next {     $db::single = 2;     $running = 1; }  sub step {     $db::single = 1;     $running = 1; }  sub cont {     $db::single = 0;     $running = 1; } 

you can see these 3 commands set different combination of single , running used while executing next perl line (see earlier table see these combinations mean).

the ability use either 1 or 2 in perl code direct result of fact you're using sneaky clever trick break execution perl code itself, setting variable set debugger command.

that's why it's not value matters fact you're forcing debugger particular state.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -