Sridhar Dhanapalan | 1 Jan 2009 05:03
Favicon
Gravatar

Re: Linux Australia Council Meeting Minutes 18/12/2008

I've been wondering about this as well. Robin has offered to speak at
SLUG and I think a few other groups as well, but it's all dependent on
this grant. SLUG needs enough notice so that we can plan and announce
our next meeting on 30 Jan. Considering that LCA is in the middle, we
need to know in the next week or two.

Thanks.

2008/12/30 Silvia Pfeiffer <silvia@...>:
> Has any decision been arrvied at wrt Robin Garaeus' grant application?
> I know it's a bad time of year ... but still....
>
> Cheers,
> Silvia.
>
> On Thu, Dec 18, 2008 at 9:59 PM, Terry Dawson <secretary@...> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>> The minutes of the Linux Australia Council Meeting held 18/12/2008 are
>> published online at:
>>
>>        http://wiki.linux.org.au/Ctte/MeetingNotes20081218
>>
>> and are forwarded below:
>>
>> == Council meeting ==
>>  * Time 21:00, Thursday, 2008/12/18
>>  * Where: Linux Australia teleconference, and #LACTTE IRC channel
(Continue reading)

James Turnbull | 1 Jan 2009 14:27
Gravatar

linux.conf.au 2009 - news and rumours


Hi all

Josh Hesketh's latest blog post has some excellent news, rumours and
information about linux.conf.au 2009:

http://www.opentechnologysolutions.com.au/blog/joshua-hesketh/register-soon-linux-conf-au

It's taking place in Hobart, Tasmaia and if you haven't already
registered then there are tickets still available. I strongly recommend
grabbing one up as there are just 17 days to go!

Cheers

James Turnbull

--
Author of:
* Pulling Strings with Puppet
(http://www.amazon.com/gp/product/1590599780/)
* Pro Nagios 2.0
(http://www.amazon.com/gp/product/1590596099/)
* Hardening Linux
(http://www.amazon.com/gp/product/1590594444/)

Andrew Ruthven | 2 Jan 2009 00:04
Picon
Favicon
Gravatar

MythTV mini-conference at Linux.conf.au 2009 - Schedule

MythTV Mini-conference - LCA2009
================================

The schedule for the MythTV Mini-conference will be hosted as part of
the linux.conf.au conference in Hobart, Tasmania, Australia during
January 2009 has been published.  The talks we have are below.  The
schedule is online at:
  http://conf.linux.org.au/programme/schedule/monday

To attend the mini-conference you need to be registered for
linux.conf.au.  There are still tickets available, but get in fast!  To
register head over to:
   http://linux.conf.au

Talks:

MythNetTV by Michael Still
--------------------------

MythNetTV is a RSS / Atom aggregator for MythTV, which downloads videos
via HTTP, some streaming protocols and bittorrent, and then imports them
just like other recordings into the MythTV user interface. Its currently
packaged by MythBuntu, and available from
http://www.stillhq.com/mythtv/mythnettv/

Transcoding in MythTV by Paul Wayper
------------------------------------

Want to understand the transcoding process in MythTV? Then this is the
talk for you!
(Continue reading)

David Lloyd | 3 Jan 2009 09:01
Picon
Favicon

Moose, JSON Question


At the recent OSDC I heard about Moose so I thought I'd take the Moose out on the hunting range to see what I could come up with. Now, I also wanted to fiddle a bit with JSON so I thought, well, let's do some TDD as practice and see what happens. Here's a cut down version of TestJSON.pm:

# This is the actual module MINUS the POD - the POD is all there in the
# real version, I just feel it's unecessary to post.
package TestJSON;

our $VERSION = '0.01';

use Moose;

use Carp;
use Data::Dumper;

use JSON;

has "debug" => (
    is => "rw",
    isa => "Int",
    default => 1,
);

sub json2perl {
    my ($self, $perl) = <at> _;
    
    return from_json($perl);
}

sub perl2json {
my ($self, $hash) = <at> _;

return (if !defined $hash || ref($hash) ne "HASH");

return to_json($hash);
}

1;

Now, the JSON module export from_json and to_json by default.

The curious thing that I've noticed is that this works:

  DB<5> david-lloyds-imac:TestJSON lloy0076$ perl -Ilib -MTestJSON -d -e 0

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1): 0
DB<1> $tj = TestJSON->new();

DB<2> $tj->from_json('{"event":"suiteStart","suite":"ArrayTest","tests":2}');
malformed JSON string, neither array, object, number, string or atom, at character offset 0 ["TestJSON=HASH(0xbbd9..."] at /Library/Perl/5.8.8/JSON.pm line 154.

^^^ BTW, that is valid JSON, see below

It appears that "from_json" is being interpreted as an object method and then dispatched to JSON::from_json like this:

JSON::from_jason($object_hash, $json);

Take careful note that the object hash is now in the array. The function then reads the very first argument passed to it and then balks.

In another session I managed this:

DB<3> $tj->to_json({a => 'b'});
Can't locate object method "a" via package "JSON" at /Library/Perl/5.8.8/JSON.pm line 136.

So, a few questions:

  1. If one uses a module in Perl 5.8.10 inside an object, but more specifically a Moose based object, and it imports functions into the module's namespace, it appears that the functions really are in the namespace and can be called
    1. But the caveat is that they don't do what you expect them to do...
  2. Interestingly if I remove the perl2json or json2perl class, the class methods "to_json" and "from_json" respectively (or both) throw a "can't be found in namespace error", i.e. Moose/Perl can't find them
    1. Which implies they're being loaded because they're used in the module...
    2. I've looked into JSON's source code and it seems to be doing some funky stuff to figure out which backend JSON:: one is using but other than that it looks like a standard Exporter to me, it just has rolled its own export and import functions
  3. As a matter of OO style, is it "nice" to expose "used" package's imports in the class one is making even though the behaviour if you use them as a class method appears to be strange
    1. That is, in this case I did "use JSON;" and caused "from_json" and "to_json" to materialise - if I have an actual object (TestJSON->new()) I can call them but as shown the behaviour is suboptimal

I'm just wondering.

DSL
_______________________________________________
linux-aus mailing list
linux-aus@...
http://lists.linux.org.au/listinfo/linux-aus
Daniel Pittman | 3 Jan 2009 10:19
Gravatar

Re: Moose, JSON Question

David Lloyd <lloy0076 <at> adam.com.au> writes:

> At the recent OSDC I heard about Moose so I thought I'd take the Moose
> out on the hunting range to see what I could come up with.

Your question isn't actually Moose related, but a generic Perl question,
as far as I can tell.

> Now, I also wanted to fiddle a bit with JSON so I thought, well, let's
> do some TDD as practice and see what happens. Here's a cut down
> version of TestJSON.pm:

[...]

>     sub json2perl {
>         my ($self, $perl) =  <at> _;
>         return from_json($perl);
>     }

This will call from_json with only one argument, the '$perl' value.

[...]

>       DB<5> david-lloyds-imac:TestJSON lloy0076$ perl -Ilib -MTestJSON -d -e 0
>
>     Loading DB routines from perl5db.pl version 1.28
>     Editor support available.
>
>     Enter h or `h h' for help, or `man perldebug' for more help.
>
>     main::(-e:1): 0
>     DB<1> $tj = TestJSON->new();
>
>     DB<2> $tj->from_json('{"event":"suiteStart","suite":"ArrayTest","tests":2}');
>     malformed JSON string, neither array, object, number, string or atom, at character
>     offset 0 ["TestJSON=HASH(0xbbd9..."] at /Library/Perl/5.8.8/JSON.pm line 154.
>
>     ^^^ BTW, that is valid JSON, see below
>
> It appears that "from_json" is being interpreted as an object method and then
> dispatched to JSON::from_json like this:
>
>     JSON::from_jason($object_hash, $json);

Yes, it is — because you explicitly called it that way.  The '->'
operator passes the object on the left to the function on the right as
the first argument.

This has nothing to do with Moose, and would work the same way in any
object / package you created.

> Take careful note that the object hash is now in the array. The
> function then reads the very first argument passed to it and then
> balks.
>
> In another session I managed this:
>
>     DB<3> $tj->to_json({a => 'b'});
>     Can't locate object method "a" via package "JSON" at /Library/Perl/5.8.8/JSON.pm
>     line 136.

The JSON package to_json treats the hash keys in the second argument as
local method calls, resulting in this error.

> So, a few questions:
>
>  1. If one uses a module in Perl 5.8.10 inside an object, but more
>     specifically a Moose based object, and it imports functions into
>     the module's namespace, it appears that the functions really are
>     in the namespace and can be called

Correct.

>      1. But the caveat is that they don't do what you expect them to
>         do...

They don't do what *you* expect them to do — your examples did exactly
what I expected. ;)  More seriously, this is the standard Perl
behaviour, not anything to do with Moose or otherwise.

>  2. Interestingly if I remove the perl2json or json2perl class, the class methods
>     "to_json" and "from_json" respectively (or both) throw a "can't be found in
>     namespace error", i.e. Moose/Perl can't find them
>      1. Which implies they're being loaded because they're used in the module...
>      2. I've looked into JSON's source code and it seems to be doing some funky stuff
>         to figure out which backend JSON:: one is using but other than that it looks
>         like a standard Exporter to me, it just has rolled its own export and import
>         functions

They should show up in the namespace... and a quick test here shows that
they do:

    perl -e 'package Test; use JSON; package main; \
        print UNIVERSAL::can("Test", "to_json") ? "imported\n" : "missing\n"'

>  3. As a matter of OO style, is it "nice" to expose "used" package's
>     imports in the class one is making even though the behaviour if
>     you use them as a class method appears to be strange

Generally, no, you wouldn't expect to import a random class into your
object and have it add methods.

With Moose this is even less common: the 'Role' type is used for the
purpose of class extension, in a cleaner fashion than random exports
into your namespace.

>      1. That is, in this case I did "use JSON;" and caused "from_json"
>         and "to_json" to materialise - if I have an actual object
>         (TestJSON->new()) I can call them but as shown the behaviour
>         is suboptimal

Your calling convention is wrong: the JSON methods need to have their
data as the first argument, and calling them as methods means that they
don't.

The summary is, don't do that.  Use your wrapper methods. ;)

Regards,
        Daniel

_______________________________________________
linux-aus mailing list
linux-aus <at> lists.linux.org.au
http://lists.linux.org.au/listinfo/linux-aus
Steve Walsh | 3 Jan 2009 14:00
Picon
Favicon
Gravatar

Re: [LACTTE] LA application

The Linux Australia Council held a special vote on this matter tonight, 
and have agreed to fund Robin's application for travel funding for 
FOMS/LCA, SLUG and LUV  as a one-off grant to a total value of $2000.

The biggest factor in this decision was the contributions Robin's 
presentations at SLUG and LUV would provide to the Sydney and Melbourne 
linux communities, as well the follow-on effect from his attendance at 
FOMS and LCA.

Stephen Walsh
Vice President
Linux Australia

Robin Gareus wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello Linux Australia,
>
> Date:
>  This application: Dec 12, 2009
>  FOMS: Jan 15,16 2009
>  LCA:  Jan 19-24 2009
>  SLUG workshop/talk: Jan 30 2009
>
>  planning to leave Amsterdam,NL: 12.01.2008
>  planning to return: 12.02.2008
>
> Project Name:
>   Linux Media Workshop, FOMS & LCA
>
>
> Aim of Project:
>   Extend developer collaborations at FOMS + LCA and present a
>   hands-on tutorial on open-source A/V production at SLUG.
>
>   Besides running day to day business of linuxaudio.org, I'm author of
>   various FLOSS software [1] and affiliated with quite some FLOSS
>   projects around gnu/linux multimedia [2]. During my stay in AUS I'm
>   going to focus on interoperability and consolidation with emphasis on
>   JACK A/V sync.
>   Indirectly your grant will support development of xjadeo.sf.net,
>   lumiera.org and ardour.org. Directly it may affect projects of other
>   FOMS participants and SLUGs.
>
>   Furthermore this trip offers the opportunity to build a deeper
>   collaboration between developer groups in Europe and Australia.
>   I am involved with organizing the linux-audio-conference 2009 and
>   am exploring possibilities to organise a FOMS Europe. Attending FOMS
>   and LCA would be beneficial as to see how you are handling it there.
>
>
> Person Responsible for Request:
>   Robin Gareus
>
>
> People/Groups Supporting Request:
>
>   Silvia Pfeiffer (FOMS)
>  FOMS CTTE & President Annodex Association
>
>   Sridhar Dhanapalan (CTTE, SLUG)
>  President SLUG
>
>
> Request:
>   I require additional funding for travel to FOMS and meet a talk
>   invitation at SLUG.
>
>   Talks to be given at FOMS, LCA Multimedia miniconf and SLUG.
>
>   FOMS is offering $1000 partial travel sponsorship to me.
>   The air-fare will cost approx $3750 [3] and I would like to ask LA to
>   contribute $2000 towards this; if possible more. I am prepared to pick
>   up further travel expenses, including accommodation and local travels,
>   with my private money. I will, however, not be able to take the trip
>   without additional funding to the FOMS money.
>
> sincerely,
> robin
>
>
> [1] http://sf.net/users/x42 ; http://mir.dnsalias.com/gitweb/
> http://mir.dnsalias.com/oss/
>
> [2] linuxaudio.org, openmovieeditor.org & libopenvideo, jackaudio.org,
> ardour.org
>
> [3] with Quantas: AMS <-> SYD - 1,850 euro = 3,740$
>     AMS <-> Sydnet|Melbourne <-> Hobart - 1955 euro = 3900$
>
> quantas.com.au accepts only HTTP post search requests - see here for a link:
> https://lijnvluchten.cheaptickets.nl/transport/BookXpress_Hitchhiker/tarieven.cfm?parameter=k1oo3a955565007e7.N.1&Senioren=1&DES_APCODE=HBA&DES_APNAME=Hobart%2C
> ts&Studenten=1&ecobusfir=eco&nr_infants=0&nr_children=0&nr_adults=1&Roundtrip=1&DEP_APCODE=AMS&DEP_APNAME=Amsterdam&DEP_DATE=2009-01-13&filter_allowAirlines=*&DEP2_APCODE=HBA&DEP2_APNAME=Hobart%2C
> ts&DES2_APCODE=AMS&DES2_APNAME=Amsterdam&RET_DATE=2009-02-11
>
> - --
> Robin Gareus
> Tilanusstraat 77/3
> 1091 BG Amsterdam
>
> mobile: +31 643 711 283
> mailto: robin@...
>
> Public Key at http://pgp.mit.edu/
> Fingerprint : 7107 840B 4DC9 C948 076D 6359 7955 24F1 4F95 2B42
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAklCn58ACgkQeVUk8U+VK0JNYQCeM8H+trdJ3XVXtvFmjOiwXphQ
> ypYAoJFnV25Ox4RiYcmzsEWfyBrT4vor
> =7mrq
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> committee mailing list
> committee@...
> http://lists.linux.org.au/listinfo/committee
>   
Silvia Pfeiffer | 3 Jan 2009 23:30
Picon
Gravatar

Re: [LACTTE] LA application

Excellent, thanks for the special vote. Now we can all get active and
make the most of this.
Regards,
Silvia.

On Sun, Jan 4, 2009 at 12:00 AM, Steve Walsh <steve@...> wrote:
> The Linux Australia Council held a special vote on this matter tonight, and
> have agreed to fund Robin's application for travel funding for FOMS/LCA,
> SLUG and LUV  as a one-off grant to a total value of $2000.
>
> The biggest factor in this decision was the contributions Robin's
> presentations at SLUG and LUV would provide to the Sydney and Melbourne
> linux communities, as well the follow-on effect from his attendance at FOMS
> and LCA.
>
> Stephen Walsh
> Vice President
> Linux Australia
>
> Robin Gareus wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hello Linux Australia,
>>
>> Date:
>>  This application: Dec 12, 2009
>>  FOMS: Jan 15,16 2009
>>  LCA:  Jan 19-24 2009
>>  SLUG workshop/talk: Jan 30 2009
>>
>>  planning to leave Amsterdam,NL: 12.01.2008
>>  planning to return: 12.02.2008
>>
>> Project Name:
>>  Linux Media Workshop, FOMS & LCA
>>
>>
>> Aim of Project:
>>  Extend developer collaborations at FOMS + LCA and present a
>>  hands-on tutorial on open-source A/V production at SLUG.
>>
>>  Besides running day to day business of linuxaudio.org, I'm author of
>>  various FLOSS software [1] and affiliated with quite some FLOSS
>>  projects around gnu/linux multimedia [2]. During my stay in AUS I'm
>>  going to focus on interoperability and consolidation with emphasis on
>>  JACK A/V sync.
>>  Indirectly your grant will support development of xjadeo.sf.net,
>>  lumiera.org and ardour.org. Directly it may affect projects of other
>>  FOMS participants and SLUGs.
>>
>>  Furthermore this trip offers the opportunity to build a deeper
>>  collaboration between developer groups in Europe and Australia.
>>  I am involved with organizing the linux-audio-conference 2009 and
>>  am exploring possibilities to organise a FOMS Europe. Attending FOMS
>>  and LCA would be beneficial as to see how you are handling it there.
>>
>>
>> Person Responsible for Request:
>>  Robin Gareus
>>
>>
>> People/Groups Supporting Request:
>>
>>  Silvia Pfeiffer (FOMS)
>>  FOMS CTTE & President Annodex Association
>>
>>  Sridhar Dhanapalan (CTTE, SLUG)
>>  President SLUG
>>
>>
>> Request:
>>  I require additional funding for travel to FOMS and meet a talk
>>  invitation at SLUG.
>>
>>  Talks to be given at FOMS, LCA Multimedia miniconf and SLUG.
>>
>>  FOMS is offering $1000 partial travel sponsorship to me.
>>  The air-fare will cost approx $3750 [3] and I would like to ask LA to
>>  contribute $2000 towards this; if possible more. I am prepared to pick
>>  up further travel expenses, including accommodation and local travels,
>>  with my private money. I will, however, not be able to take the trip
>>  without additional funding to the FOMS money.
>>
>> sincerely,
>> robin
>>
>>
>> [1] http://sf.net/users/x42 ; http://mir.dnsalias.com/gitweb/
>> http://mir.dnsalias.com/oss/
>>
>> [2] linuxaudio.org, openmovieeditor.org & libopenvideo, jackaudio.org,
>> ardour.org
>>
>> [3] with Quantas: AMS <-> SYD - 1,850 euro = 3,740$
>>    AMS <-> Sydnet|Melbourne <-> Hobart - 1955 euro = 3900$
>>
>> quantas.com.au accepts only HTTP post search requests - see here for a
>> link:
>>
>> https://lijnvluchten.cheaptickets.nl/transport/BookXpress_Hitchhiker/tarieven.cfm?parameter=k1oo3a955565007e7.N.1&Senioren=1&DES_APCODE=HBA&DES_APNAME=Hobart%2C
>>
>> ts&Studenten=1&ecobusfir=eco&nr_infants=0&nr_children=0&nr_adults=1&Roundtrip=1&DEP_APCODE=AMS&DEP_APNAME=Amsterdam&DEP_DATE=2009-01-13&filter_allowAirlines=*&DEP2_APCODE=HBA&DEP2_APNAME=Hobart%2C
>> ts&DES2_APCODE=AMS&DES2_APNAME=Amsterdam&RET_DATE=2009-02-11
>>
>> - --
>> Robin Gareus
>> Tilanusstraat 77/3
>> 1091 BG Amsterdam
>>
>> mobile: +31 643 711 283
>> mailto: robin@...
>>
>> Public Key at http://pgp.mit.edu/
>> Fingerprint : 7107 840B 4DC9 C948 076D 6359 7955 24F1 4F95 2B42
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>>
>> iEYEARECAAYFAklCn58ACgkQeVUk8U+VK0JNYQCeM8H+trdJ3XVXtvFmjOiwXphQ
>> ypYAoJFnV25Ox4RiYcmzsEWfyBrT4vor
>> =7mrq
>> -----END PGP SIGNATURE-----
>>
>> _______________________________________________
>> committee mailing list
>> committee@...
>> http://lists.linux.org.au/listinfo/committee
>>
>
>
David Lloyd | 4 Jan 2009 01:13
Picon
Favicon

Re: Moose, JSON Question


Daniel,

On 03/01/2009, at 7:49 PM, Daniel Pittman wrote:

> David Lloyd <lloy0076@...> writes:
>
>> At the recent OSDC I heard about Moose so I thought I'd take the  
>> Moose
>> out on the hunting range to see what I could come up with.
>
> Your question isn't actually Moose related, but a generic Perl  
> question,
> as far as I can tell.
>
That's what I thought but seeing I'd put in a module I don't have that  
much experience with, and one that probably fiddles a bit to do what  
it does I'd mentin it.

>> Now, I also wanted to fiddle a bit with JSON so I thought, well,  
>> let's
>> do some TDD as practice and see what happens. Here's a cut down
>> version of TestJSON.pm:
>
> [...]
>
>>    sub json2perl {
>>        my ($self, $perl) =  <at> _;
>>        return from_json($perl);
>>    }
>
> This will call from_json with only one argument, the '$perl' value.

And by the way, it works.

>> It appears that "from_json" is being interpreted as an object  
>> method and then
>> dispatched to JSON::from_json like this:
>>
>>    JSON::from_jason($object_hash, $json);
>
> Yes, it is — because you explicitly called it that way.  The '->'
> operator passes the object on the left to the function on the right as
> the first argument.
>
> This has nothing to do with Moose, and would work the same way in any
> object / package you created.

Aye.

>
>> Take careful note that the object hash is now in the array. The
>> function then reads the very first argument passed to it and then
>> balks.
>>
>> In another session I managed this:
>>
>>    DB<3> $tj->to_json({a => 'b'});
>>    Can't locate object method "a" via package "JSON" at /Library/ 
>> Perl/5.8.8/JSON.pm
>>    line 136.
>
> The JSON package to_json treats the hash keys in the second argument  
> as
> local method calls, resulting in this error.

Ah, well spotted, I didn't quite see that.

>> So, a few questions:
>>
>> 1. If one uses a module in Perl 5.8.10 inside an object, but more
>>    specifically a Moose based object, and it imports functions into
>>    the module's namespace, it appears that the functions really are
>>    in the namespace and can be called
>
> Correct.
>
>>     1. But the caveat is that they don't do what you expect them to
>>        do...
>
> They don't do what *you* expect them to do — your examples did exactly
> what I expected. ;)  More seriously, this is the standard Perl
> behaviour, not anything to do with Moose or otherwise.

Sometimes Perl gives me the willies, to use the vernacular.

>> 2. Interestingly if I remove the perl2json or json2perl class, the  
>> class methods
>>    "to_json" and "from_json" respectively (or both) throw a "can't  
>> be found in
>>    namespace error", i.e. Moose/Perl can't find them
>>     1. Which implies they're being loaded because they're used in  
>> the module...
>>     2. I've looked into JSON's source code and it seems to be doing  
>> some funky stuff
>>        to figure out which backend JSON:: one is using but other  
>> than that it looks
>>        like a standard Exporter to me, it just has rolled its own  
>> export and import
>>        functions
>
> They should show up in the namespace... and a quick test here shows  
> that
> they do:
>
>    perl -e 'package Test; use JSON; package main; \
>        print UNIVERSAL::can("Test", "to_json") ? "imported\n" :  
> "missing\n"'

I must have missed that when I did:

perl -Ilib -MTestJSOn -e -d 0
...
DB<?> S
[lots of methods]
...

>
>> 3. As a matter of OO style, is it "nice" to expose "used" package's
>>    imports in the class one is making even though the behaviour if
>>    you use them as a class method appears to be strange
>
> Generally, no, you wouldn't expect to import a random class into your
> object and have it add methods.

Exactly - I think my trotting about in Java lately has kind of  
insulated me a little .

> With Moose this is even less common: the 'Role' type is used for the
> purpose of class extension, in a cleaner fashion than random exports
> into your namespace.

*hmm*

A "JSON" role?

>>     1. That is, in this case I did "use JSON;" and caused "from_json"
>>        and "to_json" to materialise - if I have an actual object
>>        (TestJSON->new()) I can call them but as shown the behaviour
>>        is suboptimal
>
> Your calling convention is wrong: the JSON methods need to have their
> data as the first argument, and calling them as methods means that  
> they
> don't.

I understood that much - hopefully my commentary indicated that I'd  
detected that they were being called as class methods rather than  
POPMs (Plain Old Perl Methods).

> The summary is, don't do that.  Use your wrapper methods. ;)

I was kind of hoping that Moose or the Perl Object system would  
insulate me from this type of shenanigans. For example:

package myclass;

import some.random.letus.ExplodeTheWorld;

public class myclass {
   public myclass ();
}

...that I couldn't do:

public myclass;

    public class evil {
      public static void main(int arg, string argv[]) {
  	evil.ExplodeTheWorld();
    }
}

...whereas it seems that in Perl I could.

DSL
Daniel Pittman | 4 Jan 2009 03:49
Gravatar

Re: Moose, JSON Question

David Lloyd <lloy0076 <at> adam.com.au> writes:
> On 03/01/2009, at 7:49 PM, Daniel Pittman wrote:
>> David Lloyd <lloy0076 <at> adam.com.au> writes:
>>
>>> At the recent OSDC I heard about Moose so I thought I'd take the Moose
>>> out on the hunting range to see what I could come up with.
>>
>> Your question isn't actually Moose related, but a generic Perl question,
>> as far as I can tell.
>
> That's what I thought but seeing I'd put in a module I don't have that
> much experience with, and one that probably fiddles a bit to do what
> it does I'd mentin it.

It is good to add the extra detail, and I am glad I wasn't missing
something in there. :)

[...]

>>>    DB<3> $tj->to_json({a => 'b'});
>>>    Can't locate object method "a" via package "JSON" at /Library/
>>> Perl/5.8.8/JSON.pm
>>>    line 136.
>>
>> The JSON package to_json treats the hash keys in the second argument as
>> local method calls, resulting in this error.
>
> Ah, well spotted, I didn't quite see that.

I had to go as far as reading the module code to make sure that was what
was going on, and I am disappointed that the JSON code handles invalid
arguments in such an ... unclean fashion.  Oh, well.  Error handling is
never that great across the board.

[...]

>>>     1. But the caveat is that they don't do what you expect them to
>>>        do...
>>
>> They don't do what *you* expect them to do — your examples did
>> exactly what I expected. ;) More seriously, this is the standard Perl
>> behaviour, not anything to do with Moose or otherwise.
>
> Sometimes Perl gives me the willies, to use the vernacular.

Heh.  Fair enough.  I confess I never really understood that, myself,
since the behaviour is almost always pretty consistent, but the DWIM
features can sometimes be very confusing, even to experts. :)

>>> 2. Interestingly if I remove the perl2json or json2perl class, the
>>>    class methods "to_json" and "from_json" respectively (or both)
>>>    throw a "can't be found in namespace error", i.e. Moose/Perl
>>>    can't find them
>>>     1. Which implies they're being loaded because they're used in the
>>>        module...
>>>     2. I've looked into JSON's source code and it seems to be doing
>>>        some funky stuff to figure out which backend JSON:: one is
>>>        using but other than that it looks like a standard Exporter
>>>        to me, it just has rolled its own export and import functions
>>
>> They should show up in the namespace... and a quick test here shows that
>> they do:
>>
>>    perl -e 'package Test; use JSON; package main; \
>>        print UNIVERSAL::can("Test", "to_json") ? "imported\n" : "missing\n"'
>
> I must have missed that when I did:
>
> perl -Ilib -MTestJSOn -e -d 0
> ...
> DB<?> S
> [lots of methods]

Odd.  I don't know if there is anything special that might hide them
from the debugger 'S' output—I have never actually used the Perl
debugger, to be honest, so don't know what quirks it might hide.

[...]

>>> 3. As a matter of OO style, is it "nice" to expose "used" package's
>>>    imports in the class one is making even though the behaviour if
>>>    you use them as a class method appears to be strange
>>
>> Generally, no, you wouldn't expect to import a random class into your
>> object and have it add methods.
>
> Exactly - I think my trotting about in Java lately has kind of insulated me a
> little .
>
>> With Moose this is even less common: the 'Role' type is used for the
>> purpose of class extension, in a cleaner fashion than random exports
>> into your namespace.
>
> *hmm*  A "JSON" role?

Well, you should probably think of a Moose "role" as a Java "interface",
kind of, except that it comes with implementation as well.

So, yes, a JSON role would be reasonable, along the lines of adding a
'to_json' and 'from_json' method to any Moose class, which
implementation then generated or created an instance from JSON.

>>>     1. That is, in this case I did "use JSON;" and caused "from_json"
>>>        and "to_json" to materialise - if I have an actual object
>>>        (TestJSON->new()) I can call them but as shown the behaviour
>>>        is suboptimal
>>
>> Your calling convention is wrong: the JSON methods need to have their
>> data as the first argument, and calling them as methods means that they
>> don't.
>
> I understood that much - hopefully my commentary indicated that I'd
> detected that they were being called as class methods rather than
> POPMs (Plain Old Perl Methods).
>
>> The summary is, don't do that.  Use your wrapper methods. ;)
>
> I was kind of hoping that Moose or the Perl Object system would
> insulate me from this type of shenanigans.

Those "shenanigans" are the basic ingredients of method calling in Perl;
would you really want an OO system that completely and utterly changed
the calling convention of the language?

Imagine, in Java, the effect of adding a module that changed the calling
convention so that instead of this...

   RandomClass foo = new RandomClass;
   foo.bar(1, 2.3);

...calling the 'bar' method on the 'RandomClass' class, it did this:

1. Look up a global object named 'bar'
2. Call a method on it, passing it the strings 'RandomClass', 'integer'
   'float'
3. Got an anonymous function back from back from that method call.
4. Invoked that anonymous function with the values foo, 1 and 2.3

That would be more than a little surprising, right?

That, essentially, is what you were expecting Moose to do: to completely
change the method / function calling convention into something that
behaved completely differently.

Regards,
        Daniel

Not that multiple-dispatch is in any way a bad thing, and it would
significantly improve Java to have it. :)

_______________________________________________
linux-aus mailing list
linux-aus <at> lists.linux.org.au
http://lists.linux.org.au/listinfo/linux-aus
Jack McCaw | 4 Jan 2009 08:56
Picon

Re: [LACTTE] LA application

Hi all,
As a user of linux audio, open source audio, and a proponent of open source audio software in community radio I am really happy tohave seen this.

I am currently exploring the use of linux-based audio software in the Community broadcasting sector (over 300 stations) and its support through the various user groups.

ardour and ubuntustudio have so far been the best examples I have to show to other production teams in the Australian community broadcasting sector. I am excited to see such support for linu audio!

Jack <at> !

--- On Sun, 4/1/09, Silvia Pfeiffer <silviapfeiffer1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

From: Silvia Pfeiffer <silviapfeiffer1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [Linux-aus] [LACTTE] LA application
To: "Steve Walsh" <steve-zJlWAF7fyuR+A87KsyXuhA@public.gmane.org>
Cc: linux-aus-Xh+NVF5n0LINqqZFaT1CxQ@public.gmane.org, "Sridhar Dhanapalan" <sridhar-Lk41fFsrxpKQWHG76I6BsA@public.gmane.org>, committee-Xh+NVF5n0LLsZ5Z5NtCLHQ@public.gmane.orgu
Received: Sunday, 4 January, 2009, 9:30 AM


-----Inline Attachment Follows-----

Excellent, thanks for the special vote. Now we can all get active and
make the most of this.
Regards,
Silvia.

On Sun, Jan 4, 2009 at 12:00 AM, Steve Walsh <steve-zJlWAF7fyuR+A87KsyXuhA@public.gmane.org> wrote:
> The Linux Australia Council held a special vote on this matter tonight, and
> have agreed to fund Robin's application for travel funding for FOMS/LCA,
> SLUG and LUV  as a one-off grant to a total value of $2000.
>
> The biggest factor in this decision was the contributions Robin's
> presentations at SLUG and LUV would provide to the Sydney and Melbourne
> linux communities, as well the follow-on effect from his attendance at FOMS
> and LCA.
>
> Stephen Walsh
> Vice President
> Linux Australia
>
> Robin Gareus wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hello Linux Australia,
>>
>> Date:
>>  This application: Dec 12, 2009
>>  FOMS: Jan 15,16 2009
>>  LCA:  Jan 19-24 2009
>>  SLUG workshop/talk: Jan 30 2009
>>
>>  planning to leave Amsterdam,NL: 12.01.2008
>>  planning to return: 12.02.2008
>>
>> Project Name:
>>  Linux Media Workshop, FOMS & LCA
>>
>>
>> Aim of Project:
>>  Extend developer collaborations at FOMS + LCA and present a
>>  hands-on tutorial on open-source A/V production at SLUG.
>>
>>  Besides running day to day business of linuxaudio.org, I'm author of
>>  various FLOSS software [1] and affiliated with quite some FLOSS
>>  projects around gnu/linux multimedia [2]. During my stay in AUS I'm
>>  going to focus on interoperability and consolidation with emphasis on
>>  JACK A/V sync.
>>  Indirectly your grant will support development of xjadeo.sf.net,
>>  lumiera.org and ardour.org. Directly it may affect projects of other
>>  FOMS participants and SLUGs.
>>
>>  Furthermore this trip offers the opportunity to build a deeper
>>  collaboration between developer groups in Europe and Australia.
>>  I am involved with organizing the linux-audio-conference 2009 and
>>  am exploring possibilities to organise a FOMS Europe. Attending FOMS
>>  and LCA would be beneficial as to see how you are handling it there.
>>
>>
>> Person Responsible for Request:
>>  Robin Gareus
>>
>>
>> People/Groups Supporting Request:
>>
>>  Silvia Pfeiffer (FOMS)
>>  FOMS CTTE & President Annodex Association
>>
>>  Sridhar Dhanapalan (CTTE, SLUG)
>>  President SLUG
>>
>>
>> Request:
>>  I require additional funding for travel to FOMS and meet a talk
>>  invitation at SLUG.
>>
>>  Talks to be given at FOMS, LCA Multimedia miniconf and SLUG.
>>
>>  FOMS is offering $1000 partial travel sponsorship to me.
>>  The air-fare will cost approx $3750 [3] and I would like to ask LA to
>>  contribute $2000 towards this; if possible more. I am prepared to pick
>>  up further travel expenses, including accommodation and local travels,
>>  with my private money. I will, however, not be able to take the trip
>>  without additional funding to the FOMS money.
>>
>> sincerely,
>> robin
>>
>>
>> [1] http://sf.net/users/x42 ; http://mir.dnsalias.com/gitweb/
>> http://mir.dnsalias.com/oss/
>>
>> [2] linuxaudio.org, openmovieeditor.org & libopenvideo, jackaudio.org,
>> ardour.org
>>
>> [3] with Quantas: AMS <-> SYD - 1,850 euro = 3,740$
>>    AMS <-> Sydnet|Melbourne <-> Hobart - 1955 euro = 3900$
>>
>> quantas.com.au accepts only HTTP post search requests - see here for a
>> link:
>>
>> https://lijnvluchten.cheaptickets.nl/transport/BookXpress_Hitchhiker/tarieven.cfm?parameter=k1oo3a955565007e7.N.1&Senioren=1&DES_APCODE=HBA&DES_APNAME=Hobart%2C
>>
>> ts&Studenten=1&ecobusfir=eco&nr_infants=0&nr_children=0&nr_adults=1&Roundtrip=1&DEP_APCODE=AMS&DEP_APNAME=Amsterdam&DEP_DATE=2009-01-13&filter_allowAirlines=*&DEP2_APCODE=HBA&DEP2_APNAME=Hobart%2C
>> ts&DES2_APCODE=AMS&DES2_APNAME=Amsterdam&RET_DATE=2009-02-11
>>
>> - --
>> Robin Gareus
>> Tilanusstraat 77/3
>> 1091 BG Amsterdam
>>
>> mobile: +31 643 711 283
>> mailto: robin-+VlDMftONaMdnm+yROfE0A@public.gmane.org
>>
>> Public Key at http://pgp.mit.edu/
>> Fingerprint : 7107 840B 4DC9 C948 076D 6359 7955 24F1 4F95 2B42
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>>
>> iEYEARECAAYFAklCn58ACgkQeVUk8U+VK0JNYQCeM8H+trdJ3XVXtvFmjOiwXphQ
>> ypYAoJFnV25Ox4RiYcmzsEWfyBrT4vor
>> =7mrq
>> -----END PGP SIGNATURE-----
>>
>> _______________________________________________
>> committee mailing list
>> committee-cunTk1MwBs8IRNE08O12FQ@public.gmane.orgrg.au
>> http://lists.linux.org.au/listinfo/committee
>>
>
>

_______________________________________________
linux-aus mailing list
linux-aus <at> lists.linux.org.au
http://lists.linux.org.au/listinfo/linux-aus

Stay connected to the people that matter most with a smarter inbox. Take a look.
_______________________________________________
linux-aus mailing list
linux-aus@...
http://lists.linux.org.au/listinfo/linux-aus

Gmane