-
-
Notifications
You must be signed in to change notification settings - Fork 79
Inject macros via %envir #1391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Inject macros via %envir #1391
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -150,19 +150,33 @@ sub loadMacros { | |||||||||
| if $debugON; | ||||||||||
| unless ($macro_file_loaded) { | ||||||||||
| warn "loadMacros: loading macro file $fileName" if $debugON; | ||||||||||
| my $filePath = $self->findMacroFile($fileName); | ||||||||||
| #### (check for renamed files here?) #### | ||||||||||
| warn "loadMacros: look for $fileName at |$filePath|" if $debugON; | ||||||||||
| if ($filePath) { | ||||||||||
| $self->compile_file($filePath); | ||||||||||
| warn "loadMacros is compiling $filePath" if $debugON; | ||||||||||
|
|
||||||||||
| # Check for injected macro source (from OPL content-addressed macros) | ||||||||||
| # before searching the filesystem. This allows custom macros to be | ||||||||||
| # delivered via %envir without requiring them on disk. | ||||||||||
| my $injected = $self->{envir}{injectedMacros}{$fileName}; | ||||||||||
| if ($injected) { | ||||||||||
| warn "loadMacros: using injected source for $fileName" if $debugON; | ||||||||||
| my ($result, $error, $fullerror) = | ||||||||||
| $self->PG_macro_file_eval($injected, "injected:$fileName"); | ||||||||||
| if ($error) { | ||||||||||
| die "Error detected while loading injected macro $fileName:\n$fullerror"; | ||||||||||
| } | ||||||||||
| } else { | ||||||||||
| my $pgDirectory = $self->{envir}{pgMacrosDir}; | ||||||||||
| my $templateDirectory = $self->{envir}{templateDirectory}; | ||||||||||
| my @shortenedPaths = @{$macrosPath}; | ||||||||||
| @shortenedPaths = map { $_ =~ s|^$templateDirectory|[TMPL]/|; $_ } @shortenedPaths; | ||||||||||
| @shortenedPaths = map { $_ =~ s|^$pgDirectory|[PG]/macros/|; $_ } @shortenedPaths; | ||||||||||
| warn "Can't locate macro file |$fileName| via path: |" . join("|,<br/> |", @shortenedPaths) . "|\n"; | ||||||||||
| my $filePath = $self->findMacroFile($fileName); | ||||||||||
| #### (check for renamed files here?) #### | ||||||||||
| warn "loadMacros: look for $fileName at |$filePath|" if $debugON; | ||||||||||
| if ($filePath) { | ||||||||||
| $self->compile_file($filePath); | ||||||||||
| warn "loadMacros is compiling $filePath" if $debugON; | ||||||||||
| } else { | ||||||||||
| my $pgDirectory = $self->{envir}{pgMacrosDir}; | ||||||||||
| my $templateDirectory = $self->{envir}{templateDirectory}; | ||||||||||
| my @shortenedPaths = @{$macrosPath}; | ||||||||||
| @shortenedPaths = map { $_ =~ s|^$templateDirectory|[TMPL]/|; $_ } @shortenedPaths; | ||||||||||
| @shortenedPaths = map { $_ =~ s|^$pgDirectory|[PG]/macros/|; $_ } @shortenedPaths; | ||||||||||
|
Comment on lines
+176
to
+177
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that this is the original code, but it should be fixed. It should not modify So could you fix this and change this to
Suggested change
|
||||||||||
| warn "Can't locate macro file |$fileName| via path: |" . join("|,<br/> |", @shortenedPaths) . "|\n"; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| $init_subroutine = eval { \&{ 'main::' . $init_subroutine_name } }; | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
That is the reason this is failing the
perltidycheck.