[Pharo-project] Scripting with Pharo?

Igor Stasenko siguctua at gmail.com
Wed May 12 17:38:22 EDT 2010


Something like that:

process := [

[ [
     | now when |
     now := Time now.
     when := 1 hour + 24 minutes.  "past midnight"
     now = when
  ] whileFalse: [ 30 seconds asDelay wait ].

  ... do your stuff here .....

  2 minutes asDelay wait. "make sure we're not repeat the same thing
within same day"
] repeat

]  newProcess.

process name: 'My periodic stuff'.
process resume


2010/5/12 Andrei Stebakov <lispercat at gmail.com>:
> Could you please give me an example of that usage?
>
> On Wed, May 12, 2010 at 4:48 PM, Igor Stasenko <siguctua at gmail.com> wrote:
>>
>> its a bit heawyweight to use VM as command-line tool.
>> you could, intead run pharo in persistent mode,
>> and schedule the same piece of code to run periodically as background
>> process in it.
>>
>> 2010/5/12 Andrei Stebakov <lispercat at gmail.com>:
>> > I think that scripting support is essential for any interpreted language
>> > and
>> > if Pharo had it, its community would grow much faster.
>> > Let's say, I learned now how to use HTML parsing in the GUI version of
>> > Pharo.
>> > I went ahead and created my own class (or set of classes) in the image
>> > which
>> > can say retrieve a dollar rate from some bank web page.
>> > Now I should be able to run Pharo in a "batch mode" saying something
>> > like...
>> > "./pharo -batch "DollarRateInfo :getAndSendEmail 'myaddress at domain.com".
>> > This way I could schedule this command using cron to send me this dollar
>> > rate via email every day at 2 pm. Having this functionality I could
>> > really
>> > spend more time using Pharo for different needs and get better at using
>> > it.
>> >
>> > I don't think it should be too hard to implement (please correct me if I
>> > am
>> > wrong). In the batch mode pharo would start in a "headless mode", read
>> > some
>> > input from a standard input (or from command line), execute it in a
>> > 'hidden'
>> > Workspace and send the output of the evaluation to the standard output.
>> >
>> > Thank you,
>> > Andrei
>> >
>> >
>> > On Wed, May 12, 2010 at 4:15 PM, Stéphane Ducasse
>> > <stephane.ducasse at inria.fr> wrote:
>> >>
>> >> unfortunately I did not find the time to continue working on it but I
>> >> would love to.
>> >>
>> >> On May 12, 2010, at 9:50 PM, Gabriel Brunstein wrote:
>> >>
>> >> > What about coral?
>> >> > http://scg.unibe.ch/wiki/projects/bachelorsprojects/coral
>> >> >
>> >> > 2010/5/12 Andrei Stebakov <lispercat at gmail.com>
>> >> > Is it possible to start Pharo headless and execute some command (say
>> >> > to
>> >> > get some info from a web page)?
>> >> >
>> >> > _______________________________________________
>> >> > Pharo-project mailing list
>> >> > Pharo-project at lists.gforge.inria.fr
>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >> >
>> >> > _______________________________________________
>> >> > Pharo-project mailing list
>> >> > Pharo-project at lists.gforge.inria.fr
>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >>
>> >>
>> >> _______________________________________________
>> >> Pharo-project mailing list
>> >> Pharo-project at lists.gforge.inria.fr
>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>> >
>> > _______________________________________________
>> > Pharo-project mailing list
>> > Pharo-project at lists.gforge.inria.fr
>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> >
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list