[17116] in Perl-Users-Digest
Perl-Users Digest, Issue: 4528 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 5 09:10:26 2000
Date: Thu, 5 Oct 2000 06:10:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970751413-v9-i4528@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 5 Oct 2000 Volume: 9 Number: 4528
Today's topics:
Re: How? Read a file from another server? <godzilla@stomp.stomp.tokyo>
Re: How? Read a file from another server? <bart.lateur@skynet.be>
Re: Limiting Form Field Input? <ebenezer@mosi.is>
Re: LWP ->How to stop a redirect and work with cookies (Wolfgang Schauer)
LWP::UserAgent using GET to pass form variables <bruce_phipps@my-deja.com>
Re: NetResource Share Problems. <carvdawg@patriot.net>
Re: Newbie help please <simonis@myself.com>
Perl and MySQL <atul.patel@uk.sun.com>
perl variables <swebster@telnet.ca>
Re: perl variables (Bernard El-Hagin)
Re: printing a postscript file directly joseph7971@my-deja.com
problem with a perl modules for apache aweeraman@my-deja.com
Re: Reverse by paragraphs - NOT! (Anno Siegel)
Re: Reverse by paragraphs - NOT! (Michel Dalle)
Re: Searching for spaces in a string only getting the b nobull@mail.com
Segmentation faults in Perl/Tk <mathiasb@uni-paderborn.de>
Re: sort <lr@hpl.hp.com>
Re: System call works at command line but not within CG <mflaherty2@earthlink.net>
Re: Using a comparison routine in another package nobull@mail.com
Re: Win32::SerialPort Tutorial? <mc@backwoods.org>
Re: Win32::SerialPort Tutorial? <korthner@hotmail.nospam.com>
Re: Win32API::File [was: WinewAPI::File] <carvdawg@patriot.net>
Re: Win32API::File [was: WinewAPI::File] (Helgi Briem)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 05 Oct 2000 00:52:48 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How? Read a file from another server?
Message-Id: <39DC3350.D5A59B8B@stomp.stomp.tokyo>
leonardz wrote:
(snippage)
> > The point is that you should *ALWAYS* check the result of open, like
> > this:
> > open (DATAFILE, "<$FileName") or die "Couldn't open file: $!";
> Thanks very much for taking the time and effort to help me understand
> this point. It is greatly appreciated.
* laughs *
A lot of troll articles in this thread.
There are better ways, more efficient ways to check
not only a file open, but to also check for other
errors as well. This standard issue Perl 5 Cargo
Cultist *ALWAYS* do this is totally lame brain.
Watch how a programmer handles this compared to
these Perl 5 Copy & Paste Technicians.
open (FILEHANDLE, "file.ext");
@Array = <FILEHANDLE>;
close (FILEHANDLE);
if ($Array[$#Array] ne "my last element")
{ &Error_Handling; }
For this example above, I know what my last
element should be. This code of mine performs
three tests; open file, array creation and,
by inference, an uncorrupted array. This can
be pinned down even better by hard coding in
the last element reference number for a known
created fixed array,
if ($Array[86] ne "my known element")
{ &Blow_Up_My_Monitor; }
Should I not know my last element,
if (!(@Array))
{ &Error_Handling; }
This checks for both file open and array creation.
Same principle can be applied for slurping a single
line string. Use of rindex to check a last character,
or a certain character near the end of a read string,
will error check just like my first example; file
open, a read and a suggestion of a good string. Toss
in length (), you have some darn good error checking.
Exacto Mundo error checking applies to a while loop
just as well. A program can check for existence of
$_ first line read, even check for the correct line,
or, if not, initiate an error response.
Alternative data is usable for some circumstances.
A file is to be opened, an array is to be created,
but something goes wrong.
if (!(@Array))
{ @Array = @Rescue_Array; &Special_Message; }
For this example, a hard coded rescue array holds
just enough data, just the right data, for a program
to continue on and successfully complete, along with
printing a special message or even emailing a note
about a problem.
A Perl 5 Cargo Cultist will kill his program at
the drop of a hat. A programmer will do all she
can to keep her program alive and functioning.
This *ALWAYS* check for file open this way, is quite
candidly, mule manure and often written by a troll.
Silly Perl 5 Cargo Cultists, they just don't know
diddly squat about writing programs.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Thu, 05 Oct 2000 09:07:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How? Read a file from another server?
Message-Id: <46hots423e03lg4d8lhd9te9q14mbtor7i@4ax.com>
Godzilla! wrote:
>A Perl 5 Cargo Cultist will kill his program at
>the drop of a hat. A programmer will do all she
>can to keep her program alive and functioning.
According to you, a "Cargo Cultist" is male, and a "porgrammer" is
female.
Sexist.
--
Bart.
------------------------------
Date: Thu, 5 Oct 2000 12:03:45 -0000
From: "Ebenezer Bodvarsson" <ebenezer@mosi.is>
Subject: Re: Limiting Form Field Input?
Message-Id: <39dcd2dc.0@news.isholf.is>
After the user submits the form there you have a script that handles the
data. In that script
for example
if (length(text)>=250){
print error and stop processing the text.
}
Ebenezer Bodvarsson
Iceland
<xlr6drone@my-deja.com> wrote in message news:8rfm8h$5hu$1@nnrp1.deja.com...
> HI,
>
> Thank you for your reply. I tried using maxlength in the input field but
> this only works on "text" fields not "textarea" area fields. This is what
> I found on documentation for the length() function:
>
> length function
>
> Return the number of bytes in a string
>
> length EXPR
> length
>
> Returns the length in bytes of the value of EXPR. If EXPR is omitted,
> returns length of $_.
>
> I have no idead on how to apply this into the context of my script?
>
> Any suggestions?
>
> thanks,
>
> Tim
>
> ----------
> -------
>
>
> In article <Pine.GSO.4.21.0010031421430.14163-100000@crusoe.crusoe.net>,
> japhy@pobox.com wrote:
> > [posted & mailed]
> >
> > On Oct 3, xlr6drone@my-deja.com said:
> >
> > >I have a resume form and I want to prevent the user from inputting more
> > >than 250 characters in any of the fields. For example I need to
prevent
> > >people from pasting in text that will exceed 250 characters.
> >
> > Um, <input type="text" maxlength=250 ...>
> >
> > >Would it be possible to create a regular expression to handle this?
> >
> > This doesn't need to be done on the Perl side of things. If you wanted
> > to, though, why not use the length() function?
> >
> > --
> > Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
> > PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
> > The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
> > CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 5 Oct 2000 12:39:00 GMT
From: w-s@gmx.de (Wolfgang Schauer)
Subject: Re: LWP ->How to stop a redirect and work with cookies
Message-Id: <8rhsp4$i71pe$1@fu-berlin.de>
littlemanjohn@my-deja.com wrote in <8rh1bg$acr$1@nnrp1.deja.com>:
>Is there an opposite to $ua->redirect_ok? I am trying to work cookies
>of pages that have 301 and 302 redirects.
>I've been trying various combinations using HTTP::Cookies and
>LWP::UserAgent but can't get them to work together without being
>redirected.
>one of the many variations I've tried is below. Any help would be very
>appreciated.
you have to override the redirect_ok method in UserAgent:
BEGIN {
use LWP::UserAgent;
@MyAgent::ISA = qw(LWP::UserAgent);
$ua = MyAgent->new;
}
sub MyAgent::redirect_ok { 0 }
{
## MAIN
}
now LWP won't handle any redirects itself anymore.
Hope that helps.
Regards,
Wolfgang
------------------------------
Date: Thu, 5 Oct 2000 12:27:41 +0100
From: "Bruce Phipps" <bruce_phipps@my-deja.com>
Subject: LWP::UserAgent using GET to pass form variables
Message-Id: <8rhokp$fvp$1@sshuraaa-i-1.production.compuserve.com>
Trying a simple script to post some values to a form using LWP::UserAgent
and GET
=================
use LWP::UserAgent;
use HTTP::Request;
$TheAgent = new LWP::UserAgent;
$Req = new HTTP::Request;
$BaseURL = 'http://Elvis/cgi-bin/tester.pl';
$Value1 = 'hello';
$Value2 = 'goodbye';
#request
$Req->method(GET);
$Req->url($BaseURL);
$Req->content('first=$Value1&second=$Value2');
#reponse
$Resp = $TheAgent->request($Req);
if ($Resp->is_success) {
print $Resp->content;
} else {
print "script failed\n"; }
================================
Logs show the $Req->content fields aren't passed to the GET request.
So I don't get: tester.pl?first=hello&second=goodbye
just: tester.pl
Any ideas on this?
Thanks
Bruce
------------------------------
Date: Thu, 05 Oct 2000 06:05:44 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: NetResource Share Problems.
Message-Id: <39DC5278.320DE736@patriot.net>
Use Win32::Lanman instead. There is a script called 'null.pl'...go to
http://www.forixnt.com, and then to the Tools section. You'll find it
there. The script contains code for checking for shares (and other
code that you can modify to access shares...).
Greg Scher wrote:
> Has anyone established a successful way of checking for the existance
> or non-existance of a share using either NetShareGetInfo (which bombs
> completly if the share doesn't exist) or NetShareCheck (which seems to
> not like hidden _USER$ shares). I am running 5.005_02 of Activestate
> and I am sick of this crap ;) Please let me know if you can help.
>
> Regards,
>
> Greg
>
> --
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++
> Gregory Scher Perot
> Systems Corporation
>
> --
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++
> Gregory Scher Perot
> Systems Corporation
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.
------------------------------
Date: 05 Oct 2000 09:07:58 GMT
From: Drew Simonis <simonis@myself.com>
Subject: Re: Newbie help please
Message-Id: <39DC4258.F166C6F@myself.com>
suma@secondring.com wrote:
>
> Please help me out
> bigsuma@home.com
Your problem is obvious. Can't you see it?
------------------------------
Date: Thu, 05 Oct 2000 13:31:00 +0100
From: Atul <atul.patel@uk.sun.com>
Subject: Perl and MySQL
Message-Id: <39DC7484.ABFA880A@uk.sun.com>
Folks,
are there any example perl scripts which makes
use of MySQL ?? ... just to help me get started.
A.
------------------------------
Date: Thu, 5 Oct 2000 08:36:46 -0400
From: "web" <swebster@telnet.ca>
Subject: perl variables
Message-Id: <hs_C5.35953$Z2.521632@nnrp1.uunet.ca>
Can i create a variable with a value that has a space between characters?
eg. $fromaddr = $in{'E-mail Address'};
Or does it all have to be one word?
cheers
------------------------------
Date: 5 Oct 2000 12:52:30 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: perl variables
Message-Id: <slrn8toucc.f8v.bernard.el-hagin@gdndev25.lido-tech>
On Thu, 5 Oct 2000 08:36:46 -0400, web <swebster@telnet.ca> wrote:
>Can i create a variable with a value that has a space between characters?
>eg. $fromaddr = $in{'E-mail Address'};
It would have taken less effort to try it than it did to post your
question.
Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'
------------------------------
Date: Thu, 05 Oct 2000 10:29:01 GMT
From: joseph7971@my-deja.com
Subject: Re: printing a postscript file directly
Message-Id: <8rhl5a$p81$1@nnrp1.deja.com>
Hi Brendon,
Thanks for the reply. I tried to do this using a system command but it
didn't work for me, I don't know why. I would prefer though to be able
to print to all printer types, any other suggestions?
Thanks,
Joe
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 05 Oct 2000 09:49:57 GMT
From: aweeraman@my-deja.com
Subject: problem with a perl modules for apache
Message-Id: <8rhis4$nl3$1@nnrp1.deja.com>
Hi,
I recompiled mod_perl 1.24 and Apache 1.3.11 on my Slackware 7.0 system
and I get the following error :
Constant subroutine XHTML_DTD redefined at /usr/lib/perl5/constant.pm
line 175.
/bin/apachectl start: httpd could not be started.
this was basically the reason that I recompiled it. It was working fine
earlier. I installed all the perl modules required for slashcode prior
to getting this error and configured my system to run slash. I would be
grateful if you could help me out with this. thanx in advance.
anuradha.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 5 Oct 2000 10:15:11 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reverse by paragraphs - NOT!
Message-Id: <8rhkbf$aul$1@lublin.zrz.tu-berlin.de>
<ollie_spencer@my-deja.com> wrote in comp.lang.perl.misci, still stubbornly
posting jeopardy style:
>Thanks for the reply. I believe you might actually have read my original
>posting! Many seem to have not.
Did you read the replies you got?
>Thanks again! I'll post my results-I never thought to slurp a para at a
>time!
How about the half-dozen or so postings that suggested just that?
Anno
------------------------------
Date: Thu, 05 Oct 2000 10:28:11 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Reverse by paragraphs - NOT!
Message-Id: <8rhl5n$bro$1@news.mch.sbs.de>
In article <8rggnl$tjv$1@nnrp1.deja.com>, ollie_spencer@my-deja.com wrote:
>Thanks for the reply.
>
>I've had a few thoughts on the situation since my original post.
>Writing the array out to file and reading it in in reversed manner is
>OK, I just wondered why it couldn't be done directly on array that is
>written out.
>
>I now think that's becaue the file is written-out as one long string
>on disk, which on read-in can be dilineated on something other than used
>to delineate it on writing. A file in an array has ALREADY been
>delineated!
>
>Hmm.. Perhaps writing it to one long string variable and splitting it on
>the desired dilineating pattern will work... Back to the salt mines!
Well, you seem to have grasped the underlying problem, indeed :)
You can't go from an array that looks like this :
@array_byline = (
'this is the first line',
'of the first paragraph',
'',
'this is the first line',
'of the second paragraph',
);
to an array that looks like this :
@array_byparagraph = (
"this is the first line\nof the second paragraph",
"this is the first line\nof the first paragraph",
);
without pulling out all elements of @array_byline
and recombining them in another way into
@array_byparagraph. Reversing won't work.
Now you seem to have chosen to write @array_byline
to a file, and then read back that file by paragraph
to put it in @array_byparagraph. It's obviously not an
ideal solution.
One way to do this would be to put the file back together
in a string, and then split it again by paragraph.
A better approach would be to make sure you fill your
original array directly with paragraphs instead of lines.
Sample code for both approaches has already been
given by other people in this thread, so your problem
is solved :)
HTH,
Michel.
------------------------------
Date: 05 Oct 2000 08:36:59 +0100
From: nobull@mail.com
Subject: Re: Searching for spaces in a string only getting the beginning of the string
Message-Id: <u9lmw37jnk.fsf@wcl-l.bham.ac.uk>
Ron Hill <hillr@ugsolutions.com> writes:
> I am trying to count the number of spaces in a string.
FAQ: "How can I count the number of occurrences of a substring within
a string?"
> I have the code below.
Eeek!
> my $indent = length sub {$_[0] =~s/(\s+)//; $1} -> ($_);
> #my $indent=length $1 if /(\s+)/;
> However it only works at the beginning of the string not the
> whole string.
Untrue. What those do is count the number of characters in the _first_
sequence of whitespace (not necessarily spaces, could be tabs) in the
string. Oh, and the first one removes them too... and earns bonous
points for obfuscation.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 05 Oct 2000 13:35:08 +0200
From: Mathias Biere <mathiasb@uni-paderborn.de>
Subject: Segmentation faults in Perl/Tk
Message-Id: <39DC676C.4E79CDCD@uni-paderborn.de>
Hi,
sometimes I'm getting segmentation faults in a Perl/Tk program I´m
working
on. They often do appear without any obvious reason, for example while
using
a menu or after clicking a button. I don`t know where to look for errors
because the programs seems to be correct and works well unless it
crashes.
I verified this behaviour on different Linux boxes, so I don`t think it
is
caused by a broken installation. The more the program grows the more
stability
decreases.
Does anyone know reasons, why a Perl program might crash with a
segmentation fault?
Thanks for your help,
Mathias
------------------------------
Date: Thu, 5 Oct 2000 00:13:52 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sort
Message-Id: <MPG.1445ca0effc210498ae0b@nntp.hpl.hp.com>
In article <VdSC5.7379$6O5.619018@news1.rdc1.mb.home.com>,
jrutled@home.com says...
> I would like to create a flat file in UNIX with one or more ' ls -al'
> commands and alphabetically sort each line by the right-most field example:
>
> /../../../.../filename
>
> Some directories will be deeper than others so I will not be able to specify
> a field number. My objective is determine whether or not there are
> duplicate files in a file system. Any help would be greatly appreciated.
Instead of an external command, I recommend you use opendir and readdir.
In a thread I posted to today, you will find several ways to extract the
basename from a filepath.
As for uniqueness, don't sort. Use a hash. See perlfaq4.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 05 Oct 2000 11:01:50 GMT
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: Re: System call works at command line but not within CGI
Message-Id: <ycZC5.18445$TP6.436331@newsread2.prod.itd.earthlink.net>
I have run the script interactively as webuser and it worked fine. In fact,
now it's working fine via CGI. I have no idea why it is working now because
I didn't make any changes. Perhaps a coworker is messing with me. It
wouldn't be the first time.
Anyway, I would like to thank everyone who helped me out but I could have
done without the wise ass remarks.
Best,
Mike
------------------------------
Date: 05 Oct 2000 08:51:29 +0100
From: nobull@mail.com
To: stdenton@my-deja.com
Subject: Re: Using a comparison routine in another package
Message-Id: <u9k8bn7izm.fsf@wcl-l.bham.ac.uk>
stdenton@my-deja.com writes:
> After looking long and hard at CPAN, I'm trying to implement a Merge
> module, analogous to the built-in sort routine. Rather than describe
> it here, let me point you to the POD below. The biggest "problem" that
> I'm facing right now is that I want to be able to share comparison
> routines between sort and merge. Unfortunately, the magical
> variables "$a" and "$b" are giving me headaches.
Been there, done that - posted a possible solution for peer review to
comp.land.perl.moderated under the title "Passing sort subroutine into
File::Find module - good idea?" back in May. Nobody commented.
Here's the jist of my post.
The code fragment below is not actually File::Find
but illustrates the how is could be done.
#!/usr/bin/perl -w
use strict;
package FOO;
sub sorter;
sub do_stuff {
my ($args,@list) = @_;
local *sorter = $args->{sort} || *sorter;
local (*a,*b);
{
my $pkg = caller;
no strict 'refs';
*a = \*{"${pkg}::a"};
*b = \*{"${pkg}::b"};
}
@list = sort sorter @list if defined &sorter;
return @list;
}
package main;
# No sorting
print join ' ' => FOO::do_stuff({},2,3,60,1,17,5);
# Pass sort in call.
print join ' ' => FOO::do_stuff({sort => sub { $a <=> $b
}},2,3,60,1,17,5);
# An alternative way.
*FOO::sorter = sub{ $b cmp $a};
print join ' ' => FOO::do_stuff({},2,3,60,1,17,5);
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 05 Oct 2000 08:10:47 -0400
From: MC <mc@backwoods.org>
Subject: Re: Win32::SerialPort Tutorial?
Message-Id: <39DC6FC7.D34B1466@backwoods.org>
David Efflandt wrote:
>
> On Mon, 02 Oct 2000 21:45:46 -0400, MC <mc@backwoods.org> wrote:
> >Can anyone point me to a tutorial or reference on the Win32::SerialPort module
> >other than the POD material. The POD material just ~barely~ covers the bones of
> >it and is rather less than clear as to the usage of many of the functions. I've
> >managed, ~finally~, to make a basic script work, but thats as far as I can go
> >w/o better documentation.
>
> Device::SerialPort for Unix based on Win32::SerialPort comes with numerous
> examples in an 'eg' subdir of the module source. I wonder where similar
> examples end up when you install Win32::SerialPort:
>
> eg/any_os.plx - cross-platform "conditional use" demo
> eg/demo1.plx - talks to a "really dumb" terminal
> eg/demo2.plx - "poor man's" readline and chatV
> eg/demo3.plx - looks like a setup menu - but only looks :-(
> eg/demo4.plx - simplest setup: "new", "required param"
> eg/demo5.plx - "waitfor" and "nextline" using lookfor
> eg/demo6.plx - basic tied FileHandle operations, record separators
> eg/demo7.plx - a Perl/Tk based terminal, event loop and callbacks
> eg/demo8.plx - command line terminal emulator with Term::Readkey
> eq/options.plx - post-install test that prints available options
> eg/example1.txt - examples from The Perl Journal #13
> eg/example2.txt - (minimal mods for cross-platform use)
> eg/example3.txt
> eg/example4.txt
> eg/example5.txt
> eg/example6.txt
> eg/example7.txt
> eg/example8.txt
>
> --
> David Efflandt efflandt@xnet.com http://www.de-srv.com/
No such animal anywhere on my system. Installed via ppm/ppd from Activestate.
.... next idea?
MC
--
---------------------------------------------------------------------
I haven't lost my mind!!! It's backed up on disk.
"The world wont end with a bang, or even a whimper, but with an error
message." -- format C:
------------------------------
Date: 05 Oct 2000 21:28:18 +0900
From: Kent Orthner <korthner@hotmail.nospam.com>
Subject: Re: Win32::SerialPort Tutorial?
Message-Id: <wkem1vjwv1.fsf@hotmail.nospam.com>
After reading your post, I started stumbling around the Perl Website,
and laded on the Author's web page. If you go there, it has a .zip
file with all the examples.
http://members.aol.com/Bbirthisel/alpha.html
HTH, -kent.
------------------------------
Date: Thu, 05 Oct 2000 06:01:54 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Win32API::File [was: WinewAPI::File]
Message-Id: <39DC5192.C7788C77@patriot.net>
> i'm trying to create a script to access a file on a remote machine on an NT
> enviornment over a Lan connection. I have full access so access is not an
> issue. I need to see and connect to a specific file on a remote machine
> (NT).
Go to http://www.forixnt.com. In the Tools section, there is a script called
null.pl. That
script contains code that shows how to make a null session connection, but it
can be
very easily modified to connect to the the 'C$' share of the remote system. If
the file
in question is, for example, 'c:\winnt\system32\funstuff.dll' on the remote
system, then
you can access it via '\\$server\c$\winnt\system32\funstuff.dll'...
> Both or any situation would be ideal. Ultimately would be nice not to have
> it mapped to get it working, but if requires me to be mapped then so be it.
> Just to get it working would be nice. It is a shared folder though,
There you go! Use the code from the null.pl script to connect to the share,
and
access your file...
> but
> what if situation arrives where I am not mapped or it is not shared. How
> would I go around that?
If the share is not available, and you turn off the Server service on the
remote
machine, then you can either use another service of some sort, or use
sneakernet.
------------------------------
Date: Thu, 05 Oct 2000 12:16:39 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Win32API::File [was: WinewAPI::File]
Message-Id: <39dc7091.704378893@news.itn.is>
On Wed, 4 Oct 2000 11:45:16 -0700, "J Joseph Yusko"
<boogiemonster@usa.net> wrote:
>
>"jason" <elephant@squirrelgroup.com> wrote in message
>news:MPG.144523003c0372f59897e9@localhost...
>> J Joseph Yusko wrote ..
>> >Objective: to access the remote machine's file with permission rights
>> >
>> >Problematic: Can't access a remote machine. No problem with local file
>> >permission.
>> >
>> >Solution: Shoot myself?
Why do you need the WinAPI?
This works fine on my machine
$server = 'servername';
$share = 'share';
$filename = 'dir/subdir/file.txt';
$file = "\\\\$server/$share/$filename";
open FILE, $file or die "Cannot open $file :$!\n";
while (<FILE>) { s/\s+/\n/g; print; }
close FILE or die "Cannot close $file :$!\n";
Regards,
Helgi Briem
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4528
**************************************