sourCEntral - mobile manpages

pdf

Padre::Task::Outline

NAME

Padre::Task::Outline − Generic background processing task to gather structure info on the current document

SYNOPSIS

  package Padre::Task::Outline::MyLanguage;
  use base 'Padre::Task::Outline';
  sub run {
          my $self = shift;
          my $doc_text = $self−>{text};
          # black magic here
          $self−>{outline} = ...;
          return 1;
  };
  1;
  # elsewhere:
  # by default, the text of the current document
  # will be fetched as will the document's notebook page.
  my $task = Padre::Task::Outline::MyLanguage−>new();
  $task−>schedule;
  my $task2 = Padre::Task::Outline::MyLanguage−>new(
      text   => Padre::Current−>document−>text_get,
      editor => Padre::Current−>editor,
  );
  $task2−>schedule;

DESCRIPTION

This is a base class for all tasks that need to do expensive structure info gathering in a background task.

You can either let "Padre::Task::Outline" fetch the Perl code for parsing from the current document or specify it as the ""text"" parameter to the constructor.

To create a outline gatherer for a given document type "Foo", you create a subclass "Padre::Task::Outline::Foo" and implement the "run" method which uses the "$self−>{text}" attribute of the task object for its nefarious structure info gathering purposes and then stores the result in the "$self−>{outline}" attribute of the object. The result should be a data structure of the form defined in the documentation of the "Padre::Document::get_outline" method. See Padre::Document.

This base class requires all logic necessary to update the GUI with the structure info in a method "update_gui" of the derived class. That method is called in the "finish()" hook.

SEE ALSO

This class inherits from "Padre::Task" and its instances can be scheduled using "Padre::TaskManager".

The transfer of the objects to and from the worker threads is implemented with Storable.

AUTHOR

Steffen Mueller <smueller AT cpan DOT org>

Heiko Jansen <heiko_jansen AT web DOT de>

COPYRIGHT AND LICENSE

Copyright 2008−2010 The Padre development team as listed in Padre.pm.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

pdf