|
Dear us!
> if isequal(varargin{1},'abc') % <- hard-coded
> ...
> % however, you cannot see the hard-coded CHAR strings 'abc',...
Built-in functions are shadowed by functions in the current folder. (This was not the case in Matlab 6.5, BTW). So create the function isequal.m in the same folder:
% isequal.m --------------------------
function Eq = isequal(a, b)
disp(a);
disp(b);
Eq = builtin('isequal', a, b);
return;
% ---------------------------------------
Do the same for STRCMP, @cell/STRCMP, @char/EQ, etc. and you can get some information about the hard coded strings in P-files.
A command which cannot be shadowed is SWITCH. So prefer this to keep secrets:
switch varargin{1}, case 'asd', ... end
Another thought: The debugger does not stop inside a line, but just at the beginning. This allows to use variables, which do not appear in the workspace, if the P-function is inspected with the debugger:
Var = 'password'; if isequal(Var, UserInput); disp('open'); end; clear('Var');
*in one line*
But: DBSTEP IN let you jump into subfunctions even inside a line. Then you can inspect the variables again from there, eg. with EVALIN('caller', 'whos').
My impression is, that it is really hard to keep secrets in P-files.
Kind regards, Jan
|