in reply to using Inline Python with CGI

Here is the relevant piece of code causing the complaint (M09_marker_mismatch()) from Inline

sub read_DATA { require Socket; my ($marker, $marker_tag); my $o = shift; my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)}; unless ($DATA_read{$pkg}++) { no strict 'refs'; *Inline::DATA = *{$pkg . '::DATA'}; local ($/); my ($CR, $LF) = (&Socket::CR, &Socket::LF); (my $data = <Inline::DATA>) =~ s/$CR?$LF/\n/g; @{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data; shift @{$DATA{$pkg}} unless ($ {$DATA{$pkg}}[0] || '') =~ /__\ +S+?__\n/; } ($marker, $o->{API}{code}) = splice @{$DATA{$pkg}}, 0, 2; croak M08_no_DATA_source_code($language_id) unless defined $marker; ($marker_tag = $marker) =~ s/__(\S+?)__\n/$1/; croak M09_marker_mismatch($marker, $language_id) unless $marker_tag eq $language_id; }

first line below asks the system what is CR and what is LF and then replaces code-line endings with a \n and then splits the code to lines. If you are willing to add debugging lines in Inline.pm in the section with the above sub, or start by making sure your system's CR and LF are some valid characters.

my ($CR, $LF) = (&Socket::CR, &Socket::LF); (my $data = <Inline::DATA>) =~ s/$CR?$LF/\n/g; @{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data;

I would follow Corion's hint on CR/LF - what editor did you use to type in your perl script? what system are you on?

Replies are listed 'Best First'.
Re^2: using Inline Python with CGI
by Anonymous Monk on Jun 14, 2019 at 06:01 UTC
    We are doing it through Cygwin terminal and its a windows 10 machine

      I'm tempted just to link to Re^2: manipulating a data table.

      Why? Why this ammount of pure pain?

      • Scary operating system that you don't want to run a server on - CHECK
      • Emulating a completely different operating system family - CHECK
      • ... in user space - CHECK
      • Using two languages with probably the most opposite philosopies (TIMTOWTDI vs. TOOWTDI) in the same program - CHECK
      • ... when both support the common gateway interface (CGI) out of the box(1) - CHECK
      • Using the slowest possible interface (CGI) to the webserver - CHECK
      • ... despite both languages and most common webservers supporting FastCGI(2) - CHECK
      • ... despite both languages supporting integration into the webserver (mod_perl, mod_python) - CHECK

      What is wrong with you?

      Among collegues, I would ask if your domina has become too weak ...

      Alexander


      (1) Perl did so, for a long time. In very recent versions, you have to install CGI via CPAN.

      (2) FastCGI: See also Re: CGI or CGI::Fast, Re^9: mod_perl, and weird caching

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      all alarm lights blinking then