1
second_routine
에 exported_function
전화에 대해서만 _function_used_by_exported_function
을 재정의 할 수 있습니까?코드의 일부로 현지화 될 서브 루틴을 재정의 할 수 있습니까?
#!/usr/bin/env perl
use warnings;
use strict;
use Needed::Module qw(exported_function);
sub first_routine {
return exported_function(2);
}
no warnings 'redefine';
sub Needed::Module::_function_used_by_exported_function {
return 'B';
}
sub second_routine {
return exported_function(5);
}
say first_routine();
say second_routine();
그렇게 할 수 있지만 좋지 않습니다. 우리가 사용하는 것을 설명하면 아마 더 좋은 방법을 찾을 수있을 것입니다. – Schwern
약간의 속도 향상이 있었을 것입니다. 그러나 나는이 경우 불쾌한 코드를 원하지 않으므로 사용하지 않을 것이다. –