Sponsored Content
Special Forums Windows & DOS: Issues & Discussions Batch file to login to putty and list directory Post 302494641 by Corona688 on Tuesday 8th of February 2011 12:46:52 AM
Old 02-08-2011
Nope.
 

10 More Discussions You Might Find Interesting

1. Linux

resticting user to login using putty on port 21(ftp)

Hi, I am having small query and wheather it is possible ? that user can transfer the files using ftp client examples (filezilla) , but he can not use putty to login using ftp and run the commands, Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

2. UNIX for Dummies Questions & Answers

Can't login through putty

I am changing root password by passwd. Now I can directly log into the system but I can not log in using puttytel. It will show an error "Incorrect Password":rolleyes: (1 Reply)
Discussion started by: arrs
1 Replies

3. UNIX for Dummies Questions & Answers

Putty Login - with Batch?

Hello Everybody, I have a question on the UNIX server login with putty. Can this login procedure into PUTTY be automated with a macro or vbs or batch file? Kindly help me in directing me for the above. Thanks for the help, Regards, (3 Replies)
Discussion started by: swame_sp
3 Replies

4. Fedora

can't login via GUI but can via Putty

Hi all, I am able to login via putty to a fedora 10 workstation. But when i try to login via physical screen connected to workstation, it just gives me a blank screen and i cant see any options to enter username and passwd. How do i get the physical GUI to work. $ who -r ... (4 Replies)
Discussion started by: lramsb4u
4 Replies

5. UNIX for Advanced & Expert Users

Login putty automatically

Hi Guys , I am using putty.exe file to login to servers . I heard that there is way to save my username and password in putty so that i no need to give my creds while logging into putty . If so please provide me th way to do so . Please note : I am not talking about keyfile . Thanks in... (6 Replies)
Discussion started by: radha254
6 Replies

6. UNIX for Dummies Questions & Answers

Putty Auto Login

Hello All , Requiremnt : i want to login to putty automatically and change the settings like i want , for ex : changing the "lines of scrollback" , " under colors , want to check to checkmark the option use system colors" . Like this i want to do . I have a bash file created to login . But... (2 Replies)
Discussion started by: radha254
2 Replies

7. Ubuntu

Login from putty in wndows7 to connect ubuntu machine

hi, i have ubuntu installed on windows 7. I am trying to connecting to ubuntu from windows 7 using putty but it is giving network problem. I am trying to connect with ip address Thanks (9 Replies)
Discussion started by: diehard
9 Replies

8. Shell Programming and Scripting

Some automatic process to login in putty. install some patch

Hello, I was wondering, we have multiple servers where we login from Putty. Is there some way we get automatically loged in after giving server name and password(by saving it in some file or like that) Just a thought (2 Replies)
Discussion started by: mirwasim
2 Replies

9. UNIX for Dummies Questions & Answers

[Solved] Is it possible to use PuTTY psftp.exe to move file from one directory to another?

Hello All, I am running a script (power shell) from my desktop (Windows). The script needs to sftp a file(using PuTTY psftp.exe ) from my desktop to a server(UNIX server). Then, as a second step, the script needs to move (or copy and delete) this file from one directory on the server (UNIX server)... (3 Replies)
Discussion started by: scampi
3 Replies

10. AIX

Able to ping the server but not able to login through putty it says network timeout

Able to ping the server but not able to login through putty it says network timeout Please assist (3 Replies)
Discussion started by: Vishal_dba
3 Replies
IO::WrapTie(3pm)					User Contributed Perl Documentation					  IO::WrapTie(3pm)

NAME
IO::WrapTie - wrap tieable objects in IO::Handle interface This is currently Alpha code, released for comments. Please give me your feedback! SYNOPSIS
First of all, you'll need tie(), so: require 5.004; Function interface (experimental). Use this with any existing class... use IO::WrapTie; use FooHandle; ### implements TIEHANDLE interface ### Suppose we want a "FooHandle->new(&FOO_RDWR, 2)". ### We can instead say... $FH = wraptie('FooHandle', &FOO_RDWR, 2); ### Now we can use... print $FH "Hello, "; ### traditional operator syntax... $FH->print("world! "); ### ...and OO syntax as well! OO interface (preferred). You can inherit from the IO::WrapTie::Slave mixin to get a nifty "new_tie()" constructor... #------------------------------ package FooHandle; ### a class which can TIEHANDLE use IO::WrapTie; @ISA = qw(IO::WrapTie::Slave); ### inherit new_tie() ... #------------------------------ package main; $FH = FooHandle->new_tie(&FOO_RDWR, 2); ### $FH is an IO::WrapTie::Master print $FH "Hello, "; ### traditional operator syntax $FH->print("world! "); ### OO syntax See IO::Scalar as an example. It also shows you how to create classes which work both with and without 5.004. DESCRIPTION
Suppose you have a class "FooHandle", where... o FooHandle does not inherit from IO::Handle; that is, it performs filehandle-like I/O, but to something other than an underlying file descriptor. Good examples are IO::Scalar (for printing to a string) and IO::Lines (for printing to an array of lines). o FooHandle implements the TIEHANDLE interface (see perltie); that is, it provides methods TIEHANDLE, GETC, PRINT, PRINTF, READ, and READLINE. o FooHandle implements the traditional OO interface of FileHandle and IO::Handle; i.e., it contains methods like getline(), read(), print(), seek(), tell(), eof(), etc. Normally, users of your class would have two options: o Use only OO syntax, and forsake named I/O operators like 'print'. o Use with tie, and forsake treating it as a first-class object (i.e., class-specific methods can only be invoked through the underlying object via tied()... giving the object a "split personality"). But now with IO::WrapTie, you can say: $WT = wraptie('FooHandle', &FOO_RDWR, 2); $WT->print("Hello, world "); ### OO syntax print $WT "Yes! "; ### Named operator syntax too! $WT->weird_stuff; ### Other methods! And if you're authoring a class like FooHandle, just have it inherit from "IO::WrapTie::Slave" and that first line becomes even prettier: $WT = FooHandle->new_tie(&FOO_RDWR, 2); The bottom line: now, almost any class can look and work exactly like an IO::Handle... and be used both with OO and non-OO filehandle syntax. HOW IT ALL WORKS
The data structures Consider this example code, using classes in this distribution: use IO::Scalar; use IO::WrapTie; $WT = wraptie('IO::Scalar',$s); print $WT "Hello, "; $WT->print("world! "); In it, the wraptie() function creates a data structure as follows: * $WT is a blessed reference to a tied filehandle $WT glob; that glob is tied to the "Slave" object. | * You would do all your i/o with $WT directly. | | | ,---isa--> IO::WrapTie::Master >--isa--> IO::Handle V / .-------------. | | | | * Perl i/o operators work on the tied object, | "Master" | invoking the TIEHANDLE methods. | | * Method invocations are delegated to the tied | | slave. `-------------' | tied(*$WT) | .---isa--> IO::WrapTie::Slave V / .-------------. | | | "Slave" | * Instance of FileHandle-like class which doesn't | | actually use file descriptors, like IO::Scalar. | IO::Scalar | * The slave can be any kind of object. | | * Must implement the TIEHANDLE interface. `-------------' NOTE: just as an IO::Handle is really just a blessed reference to a traditional filehandle glob... so also, an IO::WrapTie::Master is really just a blessed reference to a filehandle glob which has been tied to some "slave" class. How wraptie() works 1. The call to function "wraptie(SLAVECLASS, TIEARGS...)" is passed onto "IO::WrapTie::Master::new()". Note that class IO::WrapTie::Master is a subclass of IO::Handle. 2. The "IO::WrapTie::Master::new" method creates a new IO::Handle object, reblessed into class IO::WrapTie::Master. This object is the master, which will be returned from the constructor. At the same time... 3. The "new" method also creates the slave: this is an instance of SLAVECLASS which is created by tying the master's IO::Handle to SLAVECLASS via "tie(HANDLE, SLAVECLASS, TIEARGS...)". This call to "tie()" creates the slave in the following manner: 4. Class SLAVECLASS is sent the message "TIEHANDLE(TIEARGS...)"; it will usually delegate this to "SLAVECLASS::new(TIEARGS...)", resulting in a new instance of SLAVECLASS being created and returned. 5. Once both master and slave have been created, the master is returned to the caller. How I/O operators work (on the master) Consider using an i/o operator on the master: print $WT "Hello, world! "; Since the master ($WT) is really a [blessed] reference to a glob, the normal Perl i/o operators like "print" may be used on it. They will just operate on the symbol part of the glob. Since the glob is tied to the slave, the slave's PRINT method (part of the TIEHANDLE interface) will be automatically invoked. If the slave is an IO::Scalar, that means IO::Scalar::PRINT will be invoked, and that method happens to delegate to the "print()" method of the same class. So the real work is ultimately done by IO::Scalar::print(). How methods work (on the master) Consider using a method on the master: $WT->print("Hello, world! "); Since the master ($WT) is blessed into the class IO::WrapTie::Master, Perl first attempts to find a "print()" method there. Failing that, Perl next attempts to find a "print()" method in the superclass, IO::Handle. It just so happens that there is such a method; that method merely invokes the "print" i/o operator on the self object... and for that, see above! But let's suppose we're dealing with a method which isn't part of IO::Handle... for example: my $sref = $WT->sref; In this case, the intuitive behavior is to have the master delegate the method invocation to the slave (now do you see where the designations come from?). This is indeed what happens: IO::WrapTie::Master contains an AUTOLOAD method which performs the delegation. So: when "sref()" can't be found in IO::Handle, the AUTOLOAD method of IO::WrapTie::Master is invoked, and the standard behavior of delegating the method to the underlying slave (here, an IO::Scalar) is done. Sometimes, to get this to work properly, you may need to create a subclass of IO::WrapTie::Master which is an effective master for your class, and do the delegation there. NOTES
Why not simply use the object's OO interface? Because that means forsaking the use of named operators like print(), and you may need to pass the object to a subroutine which will attempt to use those operators: $O = FooHandle->new(&FOO_RDWR, 2); $O->print("Hello, world "); ### OO syntax is okay, BUT.... sub nope { print $_[0] "Nope! " } X nope($O); ### ERROR!!! (not a glob ref) Why not simply use tie()? Because(1) you have to use tied() to invoke methods in the object's public interface (yuck), and(2) you may need to pass the tied symbol to another subroutine which will attempt to treat it in an OO-way... and that will break it: tie *T, 'FooHandle', &FOO_RDWR, 2; print T "Hello, world "; ### Operator is okay, BUT... tied(*T)->other_stuff; ### yuck! AND... sub nope { shift->print("Nope! ") } X nope(*T); ### ERROR!!! (method "print" on unblessed ref) Why a master and slave? Why not simply write FooHandle to inherit from IO::Handle? I tried this, with an implementation similar to that of IO::Socket. The problem is that the whole point is to use this with objects that don't have an underlying file/socket descriptor.. Subclassing IO::Handle will work fine for the OO stuff, and fine with named operators if you tie()... but if you just attempt to say: $IO = FooHandle->new(&FOO_RDWR, 2); print $IO "Hello! "; you get a warning from Perl like: Filehandle GEN001 never opened because it's trying to do system-level i/o on an (unopened) file descriptor. To avoid this, you apparently have to tie() the handle... which brings us right back to where we started! At least the IO::WrapTie mixin lets us say: $IO = FooHandle->new_tie(&FOO_RDWR, 2); print $IO "Hello! "; and so is not too bad. ":-)" WARNINGS
Remember: this stuff is for doing FileHandle-like i/o on things without underlying file descriptors. If you have an underlying file descriptor, you're better off just inheriting from IO::Handle. Be aware that new_tie() always returns an instance of a kind of IO::WrapTie::Master... it does not return an instance of the i/o class you're tying to! Invoking some methods on the master object causes AUTOLOAD to delegate them to the slave object... so it looks like you're manipulating a "FooHandle" object directly, but you're not. I have not explored all the ramifications of this use of tie(). Here there be dragons. VERSION
$Id: WrapTie.pm,v 1.2 2005/02/10 21:21:53 dfs Exp $ AUTHOR
Primary Maintainer David F. Skoll (dfs@roaringpenguin.com). Original Author Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). perl v5.12.4 2011-09-18 IO::WrapTie(3pm)
All times are GMT -4. The time now is 03:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy