Breno G. de Oliveira > Padre-0.45 > Padre::Task::Outline



Annotate this POD


View/Report Bugs
Module Version: 0.45   Source   Latest Release: Padre-0.47


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


  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;
  # 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();
  my $task2 = Padre::Task::Outline::MyLanguage->new(
      text   => Padre::Current->document->text_get,
      editor => Padre::Current->editor,


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.


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.


Steffen Mueller <>

Heiko Jansen <>


Copyright 2008-2009 The Padre development team as listed in

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

syntax highlighting: