in reply to Building custom routines with Sub-Exporter using the "-m" flag in a perl one-liner

Can't test it, don't have perl10 on this machine, so untested guess is:

-mCommunicate=greet,"{greeting => 'Well-done',-as => 'say_to'}"

UPDATE: Which is probably not the answer because of the split I guess. If that is the case, the commas in the string need to be substituted by \x... equivalents

  • Comment on Re: Building custom routines with Sub-Exporter using the "-m" flag in a perl one-liner
  • Download Code

Replies are listed 'Best First'.
Re^2: Building custom routines with Sub-Exporter using the "-m" flag in a perl one-liner
by j1n3l0 (Friar) on Aug 21, 2008 at 16:00 UTC
    Thanks for that. I tried it out and got the following output:

    $ perl -IWorkspace/sub-exporter -mCommunicate=greet,"{ greeting => q{W +ell-done},-as => q{say_to} }" -e 'say_to(q{Nelo})' group "as => q{say_to} }" is not exported by the Communicate module at + -e line 0 BEGIN failed--compilation aborted. $

    When you said:

    ... the commas in the string need to be substituted by \x... equivalents

    I assume that has something to do with unicode ... but I don't know quite how I would use that in this situation I'm afraid =(


    Smoothie, smoothie, hundre prosent naturlig!

      "\x2c" in an interpolated ascii string is the same as ",". But my idea was a idea borne from fast talking, no thinking. Won't work, because it will not be interpolated once it reaches perl code.

      Actually I don't know a way to make it work, I tried a few things but no success. My guess is that while Sub::Exporter wants to get a hash reference, it only gets a string that would generate a hash reference if it were executed as perl. So instead of {-as =>something} it gets a string "{-as =>something}"

        Okay, thanks for your input =)


        Smoothie, smoothie, hundre prosent naturlig!