0

I am trying to invoke a perl script from slickedit..through a .e file which i will use to create a macro.The perl script basically is a xml parser which parses a .xml file whose structure is defined according to a .dtd file.

here goes the .e file i am using for invoking the perl script

_command void invoke(){

shell("C:\\Users\\anits\\Desktop\\trial.pl");
}

the perl script which is to be invoked looks like this

use XML::Simple;
use Data::Dumper;
open logfile,">test.txt";
#sub process{
$xml = new XML::Simple (KeyAttr=>[]);# read XML file
my $error =$xml->XMLin("trial.xml");
print "There are " . scalar(@{$error->{problem}}) . " problems.\n";
foreach my $var (@{$error->{problem}}) {
print logfile $var->{name}."\n";
}
close logfile;
@args = ("C:/Program Files (x86)/SlickEdit 2009/win/vs.exe","C:/Users/anits/Desktop/test.txt");
system(@args) == 0  or die "system @args failed: $?";

As you can see my perl script should open a txt file back in slickedit..but i dont get any output.So please help me on that.

If the xml parsing can be done using slickc please suggest a way to do it. Thanks and i hope my question is clear now

anit
  • 5
  • 2
anit
  • 1
  • What's the question? [Edit your posting](http://stackoverflow.com/posts/6269935/edit) and improve the explanation: Clearly separate each step. Add some example data. Say specifically what you attempted to do, what result you expected, and if different, what result you actually got. – daxim Jun 08 '11 at 09:18

1 Answers1

0

As daxim pointed out your question is not exactly clear, so my answer is going to be somewhat general

I am not sure if its the cleanest way (as it uses a fixed temp file), but I have written (in a past job) slickedit code that invoked scripts ... had the external scripts output to a well-known temp file, then have the temp file be parsed by the slick edit code after

don't remember exactly why but under windows I also wrapped execution of the script in a batch file (which implemented redirection to a named file, maybe I had quoting issues)

this is generally what it would look like ...

static str mytmp='somepath'
 <construct command_string, which will direct output to the well known file location 'somepath'>
shell(command_string, 'qp');

get(mytmp);
top();
get_line(line);
do work with line;
nhed
  • 5,774
  • 3
  • 30
  • 44