1package Goo::Editor;
2
3###############################################################################
4# Nigel Hamilton
5#
6# Copyright Nigel Hamilton 2005
7# All Rights Reserved
8#
9# Author:       Nigel Hamilton
10# Filename:     Goo::Editor.pm
11# Description:  Edit a program interactively as fast as possible
12#
13# Date          Change
14# -----------------------------------------------------------------------------
15# 23/06/2005    Version 1
16# 01/08/2005    Simplified due to new architecture
17#
18###############################################################################
19
20use strict;
21
22use Goo::Object;
23use Goo::TextEditor;
24use Goo::ThereDocManager;
25
26use base qw(Goo::Object);
27
28
29###############################################################################
30#
31# run - execute
32#
33###############################################################################
34
35sub run {
36
37    my ($this, $thing, $line_number) = @_;
38
39    # sometimes we need to make an intelligent jump
40    # maybe this will be handled by the JumpManager
41    # in the future - in the shortterm this provides
42    # some magic
43    # need to provide a line number here
44    # so we can jump directly
45    Goo::TextEditor::edit($thing->get_full_path(), $line_number);
46
47    # analyse for ThereDocs > > >
48    my ($theredoc_line_number, $target_thing, $target_action, $target_line_number) =
49        Goo::ThereDocManager->new()->process($thing->get_full_path());
50
51    if ($target_thing) {
52        $target_thing->do_action($target_action, $target_line_number);
53    }
54
55}
56
571;
58
59
60__END__
61
62=head1 NAME
63
64Goo::Editor - Call an external editor like vi or nano to edit a file.
65
66=head1 SYNOPSIS
67
68use Goo::Editor;
69
70=head1 DESCRIPTION
71
72Wrap an external editor like vi or nano.
73
74Editor is a top level action handler.
75
76=head1 METHODS
77
78=over
79
80=item run
81
82edit the file
83
84=back
85
86=head1 AUTHOR
87
88Nigel Hamilton <nigel@trexy.com>
89
90=head1 SEE ALSO
91
92