all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Perl and SQL within the same buffer
@ 2022-10-03 14:18 Luca Ferrari
  2022-10-03 22:38 ` Emanuel Berg
  2023-01-20  9:08 ` Luca Ferrari
  0 siblings, 2 replies; 3+ messages in thread
From: Luca Ferrari @ 2022-10-03 14:18 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,
when I edit PostgreSQL PL/Perl functions, I have a source code that
has a basic SQL mode in the outer part of a function, and Perl in the
inner part.
Is there a way to instrument Perl to recognize and use both modes and
syntax highlight? Something like what it happens when editing HTML and
PHP inside it.
An example of source code I edit:

CREATE OR REPLACE FUNCTION
pwc185.task2_plperl( text )
RETURNS text
AS $CODE$
my ( $input ) = @_;
my @output;
my $counter = 4;

for ( split( //, $input ) ) {
    push @output, 'x'
        and $counter--
        and next if ( /[a-z0-9]/i ) and $counter > 0;
    push @output, $_;
}

return join( '', @output );
$CODE$
LANGUAGE plperl;



Everything outside the $CODE$ lines is SQL, everything insde is Perl.

Any suggestion?

Thanks,
Luca



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-20  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 14:18 Perl and SQL within the same buffer Luca Ferrari
2022-10-03 22:38 ` Emanuel Berg
2023-01-20  9:08 ` Luca Ferrari

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.