| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi All, I am stuck with problem of, I want to browse files in remote machine using "getOpenFile". How Can I Use?? Here is my Sample Code, use IO::Ftp; use Tk; my $server = 'blahblahblah'; my $user = 'blahblah'; my $pwd = '123'; my $ftp = Net::FTP->new($server); $ftp->login($user,$pwd); $ftp->binary(); my @files= $ftp->ls() or die "Can't List Files\n"; my $mw = new MainWindow; my $Types = [ ['mpg files',['*.mpg']] ]; my $open = $mw->getOpenFile( -filetypes => $Types, -initialdir => $ftp->ls()); if($open) { print "\$open = $open\n"; } __________________________________________________ ____________________________________ I am getting Error as, Tk::Error: Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/local/lib/perl/5.8.8/Tk/FBox.pm line 439. and so on... How Can I Solve this. Any Help will be appreciated.......... |
|
#2
| |||
| |||
| g.vikramkumar@gmail.com wrote: > Hi All, > I am stuck with problem of, I want to browse files in remote machine > using "getOpenFile". > How Can I Use?? > > Here is my Sample Code, > > > use IO::Ftp; > use Tk; > > my $server = 'blahblahblah'; > my $user = 'blahblah'; > my $pwd = '123'; > > > my $ftp = Net::FTP->new($server); > $ftp->login($user,$pwd); > $ftp->binary(); > > > my @files= $ftp->ls() or die "Can't List Files\n"; > > > my $mw = new MainWindow; > my $Types = [ ['mpg files',['*.mpg']] ]; > > > my $open = $mw->getOpenFile( > -filetypes => $Types, > -initialdir => $ftp->ls()); > > if($open) > { > print "\$open = $open\n"; > } > > __________________________________________________ ____________________________________ > > > I am getting Error as, > > Tk::Error: Can't use string ("") as a subroutine ref while "strict > refs" in use at /usr/local/lib/perl/5.8.8/Tk/FBox.pm line 439. > and so on... > > How Can I Solve this. By checking whether the various object initializers succeed: my $ftp = Net::FTP->new($server) or die "Failed to connect to $server: $@"; .... my $mw = new MainWindow or die "Cannot open Window: $@"; -- These are my personal views and not those of Fujitsu Siemens Computers! Josef Möllers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize (T. Pratchett) Company Details: http://www.fujitsu-siemens.com/imprint.html |
|
#3
| |||
| |||
| On Mon, 8 Sep 2008 03:10:19 -0700 (PDT), g.vikramkumar@gmail.com wrote: >Hi All, >I am stuck with problem of, I want to browse files in remote machine >using "getOpenFile". >How Can I Use?? >Here is my Sample Code, Besides the other errors in your script, I don't think you can use getOpenFile on remote filesystems. getOpenFile is meant for locally mounted filesystems, like your own machine, or (guessing) possibly network mounted filesystems, like thru Samba or NFS on linux. Ftp connections are done thru a remote server. What you need to do, is after the my @files = $ftp->ls(), $ftp->get($your_file), then open the file once you get it locally. >my @files= $ftp->ls() or die "Can't List Files\n"; get all files in @files with $ftp->get Now they are local >my $mw = new MainWindow; >my $Types = [ ['mpg files',['*.mpg']] ]; > > >my $open = $mw->getOpenFile( > -filetypes => $Types, > -initialdir => $ftp->ls()); > >if($open) >{ > print "\$open = $open\n"; >} > >_________________________________________________ _____________________________________ > > >I am getting Error as, > >Tk::Error: Can't use string ("") as a subroutine ref while "strict >refs" in use at /usr/local/lib/perl/5.8.8/Tk/FBox.pm line 439. >and so on... > >How Can I Solve this. > >Any Help will be appreciated.......... > > > > -- I'm not really a human, but I play one on earth. http://zentara.net/Remember_How_Lucky_You_Are.html |
|
#4
| |||
| |||
| On Sep 8, 6:10 am, g.vikramku...@gmail.com wrote: > Hi All, > I am stuck with problem of, I want to browse files in remote machine > using "getOpenFile". > How Can I Use?? > > Here is my Sample Code, > > use IO::Ftp; > use Tk; > > my $server = 'blahblahblah'; > my $user = 'blahblah'; > my $pwd = '123'; > > my $ftp = Net::FTP->new($server); > $ftp->login($user,$pwd); > $ftp->binary(); > > my @files= $ftp->ls() or die "Can't List Files\n"; > > my $mw = new MainWindow; > my $Types = [ ['mpg files',['*.mpg']] ]; > > my $open = $mw->getOpenFile( > -filetypes => $Types, > -initialdir => $ftp->ls()); > > if($open) > { > print "\$open = $open\n"; > > } > > __________________________________________________ ____________________________________ > > I am getting Error as, > > Tk::Error: Can't use string ("") as a subroutine ref while "strict > refs" in use at /usr/local/lib/perl/5.8.8/Tk/FBox.pm line 439. > and so on... > > How Can I Solve this. > > Any Help will be appreciated.......... Only works on mounted filesystems, which is possible to do. You can mount filesystems over FTP, just like over SMB or NFS. On Linux, it requires curlftpfs. Then you don't need the FTP module. --S |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.