Hi,
What you can do with Win32 and Win32::NetResource and Win32::Lanman.
is pretty much all you want. Don't spend time on writing perl
as a wrapper interface to cmd, but dig into the modules.
(they all come with ActiveState)
Just a hint:
Win32::Login(); # gives you the loging name
Win32::NetResource::AddConnection() # add connection
I hope this helps
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium
| [reply] [d/l] |
my ($me)=`net config`=~/^User name\s+(.*)$/m;
to run net config, search it for the string User name, and grab the stuff from the other end of that line (which is put back into your variable). (The m modifier makes ^ and $ match the start and end of lines, rather than the start and end of strings.)
--
Tommy
Too stupid to live.
Too stubborn to die.
| [reply] [d/l] |
The perlpack pod file, in the 5.8 standard distribution offers an interesting alternative, specifically fur such aligned data.
The approach is to use ($field,$value) = unpack("A[] A*",$line) for each of the lines. Inside the brackets place the running length of the spaces, and the text in the field, and the A packing template automatically strips the trailing spaces. It may be a bit more efficient than the above mentioned regexp, but i make note of mainly just because TMTOWTDI.
-nuffin zz zZ Z Z #!perl | [reply] [d/l] |