Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

perl template generates code with syntax errors and quoting issues #39

Open
yargevad opened this issue Mar 11, 2015 · 5 comments
Open

Comments

@yargevad
Copy link

JSON objects translated to Perl hash references use : as the separator instead of , or =>, which causes syntax errors.

There can be unbalanced braces in generated code, which causes syntax errors.

JSON containing embedded newlines is single quoted, which double escapes the newlines, causing literal \n characters to appear in embarrassing places. This can be avoided by using qq'...' or regular double quotes instead of single quotes, however that will trigger Perl's string interpolation on the entire string, so it might be necessary to only double quote the newlines:

my $hr = {
  'abc' => 'def' ."\n". 'ghi',
};

In order to see this in action, head over to the SparkPost API docs, click the < on the black background near the top right hand corner, click Create Transmission with Inline Parts Content, and scroll down to select Perl from the language dropdown.

@bennettellis
Copy link

This has been open for some time. What's the ETA on a fix for this?

@Baggz
Copy link

Baggz commented Feb 25, 2016

@yargevad @bennettellis

Hi,

we just deployed a fix! Could you please give it a try?

Thanks!

@bennettellis
Copy link

I see the changes. Looks reasonable. Will test this out when we can.

@bennettellis
Copy link

And Thanks!

@Baggz
Copy link

Baggz commented Feb 25, 2016

Np, @bennettellis! Feel free to ping me if there's anything else!

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants