GeNi's bulk

To content | To menu | To search

Perl strange compilation messages on win32

I am using SciTE to edit a package and running with perl 5.10.1 on win32 and sudently I got compilation message that I couldn't understand.

So I reduce my package to the smallest code that reproduce it in a Bar package.

Here is my Bar.pm package :

package Bar;
sub test{
  #doc
}
1;

Here is how it failed to compile:

>perl -c -e "use Bar;"
Missing right curly or square bracket at Bar.pm line 1, at end of line
syntax error at Bar.pm line 1, at EOF
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

If I remove the line 3 #doc it say "syntax ok" !

So what was wrong? Look at what perl really read (by looking at binary content):

perl -Mv5.10.1 -MData::HexDump -MFile::Slurp=read_file -e"say HexDump read_file('Bar.pm', binmode=>':raw')"
          00 01 02 03 04 05 06 07 - 08 09 0A 0B 0C 0D 0E 0F  0123456789ABCDEF

00000000  70 61 63 6B 61 67 65 20 - 42 61 72 3B 0D 73 75 62  package Bar;.sub
00000010  20 74 65 73 74 7B 0D 09 - 23 64 6F 63 0D 7D 0D 31   test{..#doc.}.1
00000020  3B                                                 ;

Humm, looks like my line ending is 0x0D ( \r old Mac <OS X standard) rather than 0x0A ( \n *nix standard) or \x0D\x0A (\r\n windows standard).

So I go into SciTE menu "Options>Line End Characters" and oh I saw that CR was selected rather than CR+LF; may I changed this by error...

So I fix this option, click on SciTE menu "Options>Convert Line End Characters", save and check the file content again:

>perl -Mv5.10.1 -MData::HexDump -MFile::Slurp=read_file -e"say HexDump read_file('Bar.pm', binmode=>':raw')"
          00 01 02 03 04 05 06 07 - 08 09 0A 0B 0C 0D 0E 0F  0123456789ABCDEF

00000000  70 61 63 6B 61 67 65 20 - 42 61 72 3B 0A 73 75 62  package Bar;.sub
00000010  20 74 65 73 74 7B 0A 09 - 23 64 6F 63 0A 7D 0A 31   test{..#doc.}.1
00000020  3B                                                 ;

And now, it should compile successfuly:

>perl -c -e "use Bar;"
-e syntax OK

PerlSharp for MS .Net story

I was looking for way to hack with Perl 5 from C# and found PerlNet(from activestate) and PerlSharp(open source) which is only for Mono and unix-like os ;(' ... Frustrated I start to make it working on my platform and compiler.

Continue reading...

EmbeddingPerl project

This project was started about 4 years ago from a hack and today it is time to put it out of the box!

Continue reading...

showing executable console

Did you ever try to write to the standard output using STDOUT but never seen your output in the console?

This is a little known thing about PE executable on windows that were compiled to be GUI.

Continue reading...

My Datawindow DebugMachine v2.4

Long time I did not post here! The datawindow debug machine has changed again...

Continue reading...

My Datawindow DebugMachine v2.3 (updated)

The datawindow swiss knife has new features ! :-)

Continue reading...

Powerbuilder .DBG files (using /PBDEBUG)

Did you already try to produce a .dbg file by running your powerbuilder application with the /DEBUG or /PBDEBUG parameter ? It is a trace of each call and executed line, so it could help to find where an application crash in production env, but is is slow to produce (huge file).

Continue reading...

My Datawindow DebugMachine

This is a tool that help to understand a lot of situation with datawindow.

Continue reading...

Powerbuilder and regular expression

Regex will help you in text processing,

Continue reading...

Powerbuilder 11.5 rebuild message clicker

Are you used to that message ? A full rebuild is required to be compatible with the source code. Do the build now? Do you want to you project finish to be rebuild by itself without your action ?

Continue reading...

Builins functions history between Powerbuilder 10.0 to 12.5

my @versions = qw( 100 105 110 115 120 125 );

sub compare{
  my ($a, $b) = @_;
  print "Between $a and $b:\n";
  my $code = '-MPowerbuilder=":all" -e "print Sys->Dump"';
  `pbperl${a} $code > tmp${a}.txt`;
  `pbperl${b} $code > tmp${b}.txt`;
  print join $/, map{s/^[<]/-/; s/^[>]/+/;$_} grep {/^[<>]/ && !/^[<>] CLASS/} split /\n/, `diff tmp${a}.txt tmp${b}.txt`;
  unlink "tmp${a}.txt";
  unlink "tmp${b}.txt";
  print "\n\n";
  return 0;  #don't mind
}

$a = shift @versions;
while($b = shift @versions){
  compare( $a, $b );
  $a = $b;
}

Output :

Between 100 and 105:
+ 	public function byte(any v) return byte
+ 	public function getbyte(blob b,unsignedlong o,ref byte v) return integer
+ 	public function setbyte(ref blob b,unsignedlong o,byte v) return integer

Between 105 and 110:
- 	public function blob(string s) return blob
+ 	public function blob(any stringorbyetarray) return blob
+ 	public function getbytearray(blob input) return any
+ 	public function getremote(string l,ref string t,long c,boolean b) return integer
+ 	public function getremote(string l,ref string t,long c,long w,boolean b) return integer
+ 	public function getremote(string l,ref string t,string a,string p,boolean b) return integer
+ 	public function lefttrim(readonly string s,boolean removealltypespaces) return string
+ 	public function righttrim(readonly string s,boolean removealltypespaces) return string
+ 	public function setremote(string l,string r,long c,boolean b) return integer
+ 	public function setremote(string l,string r,long c,long w,boolean b) return integer
+ 	public function setremote(string l,string r,string a,string t,boolean b) return integer
+ 	public function starthotlink(string l,string a,string t,boolean b) return integer
+ 	public function trim(readonly string s,boolean removealltypespaces) return string

Between 110 and 115:
+ 	public function pbgetmenustring(long h,integer i,ref string t,integer n) return long

Between 115 and 120:
+ 	public function setpointer(string s) return pointer!

Between 120 and 125:

Enumerations history from Powerbuilder 10.0 to 12.5

In this article I will explain how I extract pragmatically the enumerations differences between Powerbuilder releases using EmbeddingPerl library and the differents pbperlxxx interpreters.

Continue reading...

enumeration evolution from 10.0 to 12.0

In this article I will explain how I extract pragmatically the enumerations differences between Powerbuilder releases using EmbeddingPerl library and the differents pbperlxxx interpreters.

Continue reading...

About Syntax highlighting

This blog engine make available plugin(s) for the syntax highlighting, but I can't found one that match I want. Colorize at least Powerbuilder and perl.

Continue reading...

Powerbuilder::ORCA 0.06

This is a pre-unofficial release, It just allow to open powerbuilder project up to 12.0, but a lot of new api are not mapped yet. Here is was we could do with it.

Continue reading...

Color codes

Here is the list of default colors of powerbuilder, given (R,G,B) and the combinated values.

Continue reading...

Free.fr hosting

Tips about free.fr hosting and mysql / php5

Continue reading...

NSIS nsPerl 1.4.1

I have ported it to perl 5.10.1.

Continue reading...

Win32::ODBC 0.35 (Unofficial)

Win32::ODBC 0.35 Added a hdbc contructor (allow to share ODBC connection between languages, so nice for embedding perl !).

Continue reading...

Win32::Exe 0.15 more powerbuilder compliant

An offical perl contribution,

Continue reading...

- page 1 of 2