From plm at netspace.net.au Fri May 1 04:48:55 2009 From: plm at netspace.net.au (Paul Matthews) Date: Fri, 01 May 2009 21:48:55 +1000 Subject: [Canberra-pm] Packing to big endian on old versions of perl Message-ID: <49FAE1A7.2090500@netspace.net.au> An HTML attachment was scrubbed... URL: From jarich at perltraining.com.au Fri May 1 05:01:23 2009 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Fri, 01 May 2009 22:01:23 +1000 Subject: [Canberra-pm] Packing to big endian on old versions of perl In-Reply-To: <49FAE1A7.2090500@netspace.net.au> References: <49FAE1A7.2090500@netspace.net.au> Message-ID: <49FAE493.2010806@perltraining.com.au> Paul Matthews wrote: > On perl 5.10 the pack function allows you to say pack('n>',$num) to > encode a signed integer to big endian. And pack('n<',$num) to little > endian. However this feature is not available on older version of perl. > What is the most elegant means of achieving this? What are you trying to achieve here? Are you trying to convert data from one endian to another or do you specifically need to pack bits? Also how old is the version of Perl? Are you supporting 5.5.3 (10 years old), or 5.6.0 (9 years old) or something else? (Can you really not just upgrade?) J From jarich at perltraining.com.au Fri May 1 17:05:00 2009 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Sat, 02 May 2009 10:05:00 +1000 Subject: [Canberra-pm] Packing to big endian on old versions of perl In-Reply-To: <49FAF8EA.3080502@netspace.net.au> References: <49FAE1A7.2090500@netspace.net.au> <49FAE493.2010806@perltraining.com.au> <49FAF8EA.3080502@netspace.net.au> Message-ID: <49FB8E2C.3000306@perltraining.com.au> I originally only sent this to Paul (oops!). Turns out that the module I suggest at the end (Convert::IBM390) might be the sought-after solution. I still think there's a way of using layers/encoding to solve this, so I'll poke Paul Fenwick to show off how he does Ascii to EBCDIC stuff. All the best, Jacinta ----------------- Paul Matthews wrote: > Perl 5.8 something. Oh good! I'm so used to people having to worry about 9+ year old Perls. 5.8.something is just fine! > These are machines at work, and no we cannot just upgrade them, infinite > amounts of paperwork, service first requests, charge codes.... We are > supposed to be grateful for what we have. (They make us use vi you know ...) I'm sorry you have to use vi. :( Vim's much older than 10 years too. > The long answer is; > I am creating files that can be read by COBOL on the Mainframe directly. > In particular encoding PIC S9(*) BINARY fields. The mainframe is big endian. > > sub encodeBIN4 { > return pack("n>",shift); > } > > This would correctly encode to big endian on any machine. But the pack > expression 'n>' is not available in 5.8. The syntax for > and < came in in 5.9.2. I suspect this was early in the start of the Perl 5.10 branch, but I'd be happy to be corrected. If you can't use > and < then the perlpacktut provides the following suggestion (http://perldoc.perl.org/perlpacktut.html#Byte-order-modifiers) my @data = unpack 's>*', $buf; is equivalent to: my @data = unpack 's*', pack 'S*', unpack 'n*', $buf; I don't have enough experience working with unpack and pack to give you a solution that uses this principle to work with your code, but perhaps it'll give you the clue you're looking for. I'm mildly concerned that your comments don't match your code though. You wrote: ...pack('n>',$num) to encode a signed integer to big endian.... but the documentation says: n An unsigned short in "network" (big-endian) order. signed != unsigned. I'm sure there must be a way to solve this problem without using pack and unpack but instead using Perl's filters. Unfortunately I can't guess what that is right now, so I'll answer more later in the morning if I come up with something. There's also a very good chance that someone else has solved this and put it up on CPAN, I presume you've looked at the Convert::IBM390 module and rejected it for some reason? http://search.cpan.org/perldoc?Convert::IBM390 All the best, Jacinta From jarich at perltraining.com.au Sun May 3 18:08:59 2009 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 04 May 2009 11:08:59 +1000 Subject: [Canberra-pm] OSDC 2009 Call For Papers Message-ID: <49FE402B.90702@perltraining.com.au> >From another list, but thought we should know... ------------ I'm please to announce that the call for papers for OSDC 2009 is officially opened. I would like to invite you to submit a paper and do a talk at our conference. This conference is a grassroots style conference designed by developers for developers. We're planning to cover Perl, Python, Ruby PHP and Open Source operating systems. If you'd like us to cover something else as well that is Open Source themed, please feel free. The Call for Papers can be found at: ~ http://2009.osdc.com.au/call-for-papers The important dates are: ~ Call for Papers Closes 30 June, 2009 ~ Proposal acceptance 20 July, 2009 ~ Accepted paper submissions 14 September, 2009 ~ OSDC 2009 Main Conference! 25th to 27th November, 2009 OSDC 2009 will be held at the Bardon Conference Center in Brisbane this year. This is a fantastic venue a short drive from the Brisbane CBD, totally surrounded by lush greenery. -- Regards, Stephen Thorne From paulway at mabula.net Fri May 8 05:55:56 2009 From: paulway at mabula.net (Paul Wayper) Date: Fri, 08 May 2009 22:55:56 +1000 Subject: [Canberra-pm] Paul Fenwick at CLUG PSIG next week, Message-ID: <4A042BDC.5060704@mabula.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi everyone, We are very fortunate to have one of Paul Fenwick's many trips to Canberra coincide with a CLUG PSIG meeting. He's keen to give a couple of talks of his choosing that have been popular, so we've scheduled those for next week. We'll be meeting at Cafe Essen at 6PM for the usual pre-talk drinks, then proceeding to the Griffin Centre at 7PM for about an hour and a half's talk. Then we head to Sammy's Kitchen for more fun. Have fun, Paul P.S. for those in the know, the fun is the joke :-) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkoEK9wACgkQu7W0U8VsXYK8PQCgm6+TIgladYo70HVScEyrGKFD 8wAAnjAgqIe4/IVZrXb/0O2ckRau+ZLN =5oHn -----END PGP SIGNATURE----- From paulway at mabula.net Mon May 11 17:27:07 2009 From: paulway at mabula.net (Paul Wayper) Date: Tue, 12 May 2009 10:27:07 +1000 Subject: [Canberra-pm] [Fwd: May CLUG Programmers' Special Interest Group meeting] Message-ID: <4A08C25B.4050602@mabula.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Canberra Perl Mongers - here's the event details! - -------- Original Message -------- Subject: May CLUG Programmers' Special Interest Group meeting Date: Tue, 12 May 2009 08:00:02 +1000 From: Paul Wayper To: linux at lists.samba.org CLUG Programmers' Special Interest Group Meeting - 14th May 2009 ================================================================ Date: 14th May 2009 (Second Thursday of the month) Time: 19:00 - 21:00 (or when it finishes) Speaker: Paul Fenwick Abstract: Paul Fenwick will give a couple of talks about Perl. That's worth seeing even without the description! The talks will be "The Art of Klingon Programming" and "Things You've Missed in Perl 5.10". He will also gladly answer questions about all things Perl, so bring along your hardest Perl questions and he'll answer them! **** NOTE **** The venue is Room 9 in the Griffin Centre. Meet at Cafe Essen from 6PM for a 7PM meeting. For a map, see ~ http://mzn.zwit.org/ If you would like to give a talk at a future meeting, please email me. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkoIwlsACgkQu7W0U8VsXYJ1eQCfUMr1Rhw6IqZw+cxGgs6cnaDz Hp8An3Y8RAQ/3TCwp1HKybYk2DS3+ea2 =smi0 -----END PGP SIGNATURE-----