Embed Perl or execute perl script

K

Kai Thorsrud

Hi

I'm currently into converting a perl linux app into a .Net windows service.
The application monitors our syslog log files to capture i.p adress changes
on some of our routers having dynamic i.p. In the syslog logfile i capture
the new IP adress of the router. I then need to telnet to that i.p adress
and fetch the hostname. A list of these routers will be presented on a
webpage.

I've created the application in vb.net and most parts of it is working fine
except for the telnet module. I've created a TCPClient class that takes care
of this. However with my limited .Net experience this is gonna take some
time to implement the Telnet protocol to handle all sorts of stuff :)

However time is limited and i need to get this app up and running. I have a
perlscript doing this for me returning the routerconfig to stdout (the dos
window). I've tried to do a:

Shell(Me.FileToExecute, AppWinStyle.Hide, True, 3000) where Me.FiletoExecute
= C:\Perl\bin\Perl.exe C:\files\syslog\telnet.pl >
C:\files\syslog\SmallOffice93Config.txt

however the shell doesn't like piping to a file and outputs this to the
command window. Is there a way i can fetch the data from the command window,
or a way to pipe the data to a file ? Or is it possible to embed a
perlscript directly into .net ?

I use the Perl ppm module Net-Telnet-Cisco to send my telnet command.

Help is appreciated

Best Regards
Kai Thorsrud
 
T

Tom Shelton

Hi

I'm currently into converting a perl linux app into a .Net windows service.
The application monitors our syslog log files to capture i.p adress changes
on some of our routers having dynamic i.p. In the syslog logfile i capture
the new IP adress of the router. I then need to telnet to that i.p adress
and fetch the hostname. A list of these routers will be presented on a
webpage.

I've created the application in vb.net and most parts of it is working fine
except for the telnet module. I've created a TCPClient class that takes care
of this. However with my limited .Net experience this is gonna take some
time to implement the Telnet protocol to handle all sorts of stuff :)

However time is limited and i need to get this app up and running. I have a
perlscript doing this for me returning the routerconfig to stdout (the dos
window). I've tried to do a:

Shell(Me.FileToExecute, AppWinStyle.Hide, True, 3000) where Me.FiletoExecute
= C:\Perl\bin\Perl.exe C:\files\syslog\telnet.pl >
C:\files\syslog\SmallOffice93Config.txt

however the shell doesn't like piping to a file and outputs this to the
command window. Is there a way i can fetch the data from the command window,
or a way to pipe the data to a file ? Or is it possible to embed a
perlscript directly into .net ?

I use the Perl ppm module Net-Telnet-Cisco to send my telnet command.

Help is appreciated

Best Regards
Kai Thorsrud

You might want to try calling the EzPerl API if your using ActiveState
Perl...

I played with this a bit a long time ago with VB5/6, so I don't remember
all of the details. But, it maybe worth a try. Also, you could buy a
telnet component...
 
T

Tom Shelton

Hi

I'm currently into converting a perl linux app into a .Net windows service.
The application monitors our syslog log files to capture i.p adress changes
on some of our routers having dynamic i.p. In the syslog logfile i capture
the new IP adress of the router. I then need to telnet to that i.p adress
and fetch the hostname. A list of these routers will be presented on a
webpage.

I've created the application in vb.net and most parts of it is working fine
except for the telnet module. I've created a TCPClient class that takes care
of this. However with my limited .Net experience this is gonna take some
time to implement the Telnet protocol to handle all sorts of stuff :)

However time is limited and i need to get this app up and running. I have a
perlscript doing this for me returning the routerconfig to stdout (the dos
window). I've tried to do a:

Shell(Me.FileToExecute, AppWinStyle.Hide, True, 3000) where Me.FiletoExecute
= C:\Perl\bin\Perl.exe C:\files\syslog\telnet.pl >
C:\files\syslog\SmallOffice93Config.txt

however the shell doesn't like piping to a file and outputs this to the
command window. Is there a way i can fetch the data from the command window,
or a way to pipe the data to a file ? Or is it possible to embed a
perlscript directly into .net ?

I use the Perl ppm module Net-Telnet-Cisco to send my telnet command.

Help is appreciated

Best Regards
Kai Thorsrud

Oh, yeah... I thought I better mention - ActiveState creates a .NET
version of Perl. Visual Perl. That would let you convert most of your
Perl code directly to .NET :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top