[7328] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 953 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 31 07:07:14 1997

Date: Sun, 31 Aug 97 04:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 31 Aug 1997     Volume: 8 Number: 953

Today's topics:
     A module to my cgi-bin dir <dmedia@vzc.servicom.es>
     cgi ( disk space available ) ---> html <thomasdj@wam.umd.edu>
     Re: changing dir of parent shell (Tad McClellan)
     Re: changing dir of parent shell <godzilla@futuris.net>
     Re: changing dir of parent shell <rra@stanford.edu>
     Re: How can execute system executable on NT? (Eric Bohlman)
     Re: Is this a permissions problem Opening and reading a <petri.backstrom@icl.fi>
     Re: MAIL question <thomasdj@wam.umd.edu>
     Re: NT 4.0 Server ans Perl5 307 <pegit.swedmap@mbox300.swipnet.se>
     Re: nvi with Perl extensions compile (solution) (Eric Arnold)
     Re: Perl for DOS: How do I reference long filenames? (Eric Bohlman)
     Re: Perl Pipes and FileHandles (Tad McClellan)
     Re: perl/win95/Long File Names <petri.backstrom@icl.fi>
     Re: Problem with win32 system() function (Simon Hyde)
     Re: Problem with win32 system() function (Nim Chu)
     Problems installing new Perl5 Modules in Win95 <derosa9@idt.net>
     Re: Problems installing new Perl5 Modules in Win95 (Gurusamy Sarathy)
     Question: Returning false/zero to shell... alex@inova.net
     Re: Question: Returning false/zero to shell... <rra@stanford.edu>
     Re: Questions about passing by reference. <peterv@valkieser.nl>
     Reading a data file <jimison@vision.net.au>
     Re: Reading a data file <jjmarkha@mailhost.ecn.ou.edu>
     Re: renaming long files with WIN32 Perl <petri.backstrom@icl.fi>
     Re: Some Assistance Please... <gwhassan@prodigy.net>
     Re: SSH and Perl Steve_Kilbane@cegelecproj.co.uk
     Re: SSH and Perl <david@vortex.more.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 31 Aug 1997 12:23:04 +0200
From: Aitor <dmedia@vzc.servicom.es>
Subject: A module to my cgi-bin dir
Message-Id: <34094607.5679@vzc.servicom.es>

How may I upload a module (CGI.pm & libwww) to my cgi-bin directory?

I've got a mac. Upload to a unix server.

TIA


------------------------------

Date: Sat, 30 Aug 1997 20:17:03 -0400
From: "David J. Thomas" <thomasdj@wam.umd.edu>
Subject: cgi ( disk space available ) ---> html
Message-Id: <3408B7FF.A93@wam.umd.edu>

I have a cgi generated webpage that shows various stats. I would like to
show how much disk space I have available as well. I need the cgi
"command" that returns how much space is available. For unix people,
something exactly like "quota" is what I need. If you can help I would
definitely appreciate it.   

Thanks
david


------------------------------

Date: Sat, 30 Aug 1997 08:00:15 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: changing dir of parent shell
Message-Id: <vg59u5.7n.ln@localhost>

Les Schaffer (godzilla@futuris.net) wrote:
: How do i get a perl script to change the directory i was just in to another one. 

: for example, i am in /home/foo.

[snip]

: when i had unpack written as a bash script, i could go

: /home/foo: > . unpack
:    [ blah blah blah ] 
: /home/foo/bar: >

: is there an equivalent for perl?


This is a Frequently Asked Question.

I guess you missed it when you checked the Perl FAQ before posting to
the Perl newsgroup.


from Perl FAQ, part 8:

   "I {changed directory, modified my environment} in a perl script.  
    How come the change disappeared when I exited the script?  
    How do I get my changes to be visible?"


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: 31 Aug 1997 00:33:25 -0400
From: Les Schaffer <godzilla@futuris.net>
Subject: Re: changing dir of parent shell
Message-Id: <m2sovr55uy.fsf@futuris.net>

tadmc@flash.net (Tad McClellan) writes:

> I guess you missed it when you checked the Perl FAQ before posting to
> the Perl newsgroup.

i guess you havent read that part of the FAQ yourself, or you'd know
how little info there is there.

so fella, do you have a better answer? i figured out one way to solve
the problem after getting a helpful hint from another poster.

( i guess there are all kinds of people in the world )

Anybody else have something intelligent to say on the issue?

Les Schaffer


------------------------------

Date: 30 Aug 1997 22:00:59 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: changing dir of parent shell
Message-Id: <m3lo1j6j5g.fsf@windlord.Stanford.EDU>

Les Schaffer <godzilla@futuris.net> writes:
> tadmc@flash.net (Tad McClellan) writes:

>> I guess you missed it when you checked the Perl FAQ before posting to
>> the Perl newsgroup.

> i guess you havent read that part of the FAQ yourself, or you'd know how
> little info there is there.

The reason why there's so little information there is because in the
strict sense of the term it can't be done.  Unless your parent shell is
actively cooperating by doing something like sourcing your output, there's
no way for you to change its current directory.

The FAQ *does* give a reference to the comp.unix.questions FAQ, and in
fact question 2.8 of that FAQ is:

      2.8)  How do I {set an environment variable, change directory}
              inside a program or shell script and have that change affect
              my current shell?

which appears to be precisely what the person is asking.  And, in fact,
that FAQ contains a very complete and detailed answer to that question
which I won't reproduce here because it's a waste of space.  You can
obtain that FAQ from rtfm.mit.edu or any mirror thereof, or in
comp.unix.questions, comp.answers, or news.answers, as well as a variety
of other places.

Hope this helps!

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: Sun, 31 Aug 1997 07:57:52 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How can execute system executable on NT?
Message-Id: <ebohlmanEFrq4G.J9v@netcom.com>

Michael D. Schleif (mike.schleif@aquila.com) wrote:
: I have just inherited several NT boxes with Perl v4.0 (perl for NT
: $$Revision: 4.0.1.8; Patch Level 36; (c) 89,90,91 Larry Wall; NT (c)
: 1993, Intergraph Corp.)

How can you stand the smell of all those dead camels?  You really want to
upgrade to v5.004_02, which Gurusamy Sarathy has kindly ported to Win32
and compiled for you.  It's available at your nearest CPAN mirror. 

: I need to run some rather simple Perl programs on these boxes; but, I
: cannot seem to execute system executables by:
: 	backticks
: 	system()
: 	open(X, "dir |")

: When I call system "dir", it returns 65535; otherwise, all else is blank
: and no error code/message.

The first two work correctly under 5.004.  You do realize, don't you, 
that system() returns the exit status of the process it invokes, *not* 
the output from the process?  Opening a pipe *may* be problematic because 
under Windows, certain commands like "dir" are actually implemented by 
the command processor (shell) rather than their own executables.  If the 
Perl version you're using doesn't provide shell processing for such 
commands, you'll need to get the shell's name (it's in $ENV{'COMSPEC'}; 
don't hardwire a name, because the name is different between NT and 95) 
and incorporate it into your command.



------------------------------

Date: Sat, 30 Aug 1997 23:54:16 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Is this a permissions problem Opening and reading a URL
Message-Id: <34088878.6A0C@icl.fi>

Mark Worsdall wrote:
> 
> OK, well after experimetnation I definetely know I am using the wrong
> type of thingy to read the contents of a webpage, eg below:-
> 
> # With the variable $visitorshome set to either of these:-
> # $visitorshome = 'http://www.worsdall.demon.co.uk/index.html';
> 
> So how? using what?

By using the LWP (libwww) modules that you can locate
on CPAN (Comprehensive Perl Archive Network): 

   http://www.perl.com/CPAN/ 

or
   ftp://ftp.funet.fi/pub/languages/perl/CPAN/ 

or other locations. 

Use it somewhat like this:

   use LWP::Simple;
   $file = get 'http://www.domain.com/file.html';

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


------------------------------

Date: Sat, 30 Aug 1997 20:23:15 -0400
From: "David J. Thomas" <thomasdj@wam.umd.edu>
To: Jeff Stampes <stampes@xilinx.com>
Subject: Re: MAIL question
Message-Id: <3408B973.723C@wam.umd.edu>

How are you trying to send it to more than one person.

Have you tried
$youmail = 'burt@ici.net user1@one.net user2@two.net';

djthomas


------------------------------

Date: Thu, 28 Aug 1997 10:44:54 +0200
From: Pinne <pegit.swedmap@mbox300.swipnet.se>
Subject: Re: NT 4.0 Server ans Perl5 307
Message-Id: <34053A86.5335@mbox300.swipnet.se>

Changuk Sohn wrote:
> 
> Hello, People?
> I'm having problem with Perl and NT.
> Since, When I installed Perl5, my computer's CPU and MEM usage goes crazy
> (100%)
> Please help me....
> 
The same has happened to me too, but that was caused
by a logical error in one of my Perl-scripts.
Check them out first.
(Wonder what would have happened if I hadn't killed the Perl process ?)


------------------------------

Date: 31 Aug 97 01:25:23 GMT
From: eric.arnold@sun.com (Eric Arnold)
Subject: Re: nvi with Perl extensions compile (solution)
Message-Id: <ERIC.97Aug31012523@m-e-ir1.sun.com>




Does anybody use this?  Are there examples?  I'm finding the nvi Perl
API kinda buggy.  (i.e. FindScreen returns a string instead of a ref;
EndScreen causes delayed removal; flakeyness if you SwitchScreen from
a non-current screen, which is only documented in the code; wierdness
with SetLine instead of AppendLine on to empty file; Run() behaves
inconsistently; etc.).

-Eric

In article <5tsldu$bgj@bali.seg.wj.com>
	alan@wj.com writes:
  >In article <5tnn1i$945@bali.seg.wj.com>, Alan Strassberg <alan@wj.com> wrote:
  >>       nvi (an updated vi) has an option to build with a Perl
  >>       interpeter built-in. (nvi-1.79.tar.gz is on CPAN under misc)
  >>       It's has some really nice extensions to write code. Grab it!
  >
  >	In case anyone's interested here's the fix ...
  >
  >	Hand apply the below (all you need to do is move one line of code).
  >
  >alan@wj.com


------------------------------

Date: Sun, 31 Aug 1997 08:08:31 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl for DOS: How do I reference long filenames?
Message-Id: <ebohlmanEFrqM7.Jr3@netcom.com>

peterarm@r2tech.com wrote:
: Hi,
: I'm using a port of Perl 4.19 for DOS.

: I have a problem: How do I reference the long filenames that Win 95
: uses?

You give your dead camel a proper burial and then go to your nearest CPAN 
mirror and download and install Gurusamy Sarathy's excellent Win32 port 
of Perl 5.004, which comes pre-compiled.  Since it's a Win32 application, 
it understands long filenames and you don't have to do anything special 
to use them.




------------------------------

Date: Fri, 29 Aug 1997 20:21:18 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl Pipes and FileHandles
Message-Id: <eis7u5.43h.ln@localhost>

Michael McGrattan (mcgrattm@cts.com) wrote:
: I have a question regarding the 'piping' of output
: via an 'open' command.  Essentially I am invoking a
: database connection using the database's proprietary command line
: utility and I will be passing SQL commands through
: the file handle.  My problem lies in effeciently capturing
: to database output into a buffer or filehandle.  Presently


Maybe this from the Perl FAQ, part 8, would be helpful?

I guess you missed it when you checked the Perl FAQ before
posting to the Perl newsgroup.


---------------------
=head2 How can I open a pipe both to and from a command?

The IPC::Open2 module (part of the standard perl distribution) is an
easy-to-use approach that internally uses pipe(), fork(), and exec()
to do the job.  Make sure you read the deadlock warnings in its
documentation, though (see L<IPC::Open2>).
---------------------


: Any comments/suggestion/solutions on a better method
: of capturing output would be very much appreciated.


You are not supposed to ask FAQs on Usenet, that could take hours
to get an answer.

You are supposed to look up the answers in about 30 seconds instead  ;-)


If you still have a question after snooping around in the free 
documentation that is included with the perl distribution, post
'em here ;-)


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 31 Aug 1997 00:08:56 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: perl/win95/Long File Names
Message-Id: <34088BE8.3E4@icl.fi>

Brian P. Moffatt wrote:
> 
> I am using perl5 on my win95 machine and I need to "opendir" a LFN
> directory.
> Any suggestions.
> /program files/netscape/navigator/program/...................etc. you
> get the point.
> how do I get in there??

Well, maybe with something like this:

    opendir( DIRHANDLE, 'c:/program files/netscape/navigator/program' )
or
        die "error opening directory: $!";

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


------------------------------

Date: Sat, 30 Aug 1997 22:29:36 GMT
From: shyde@poboxes.com (Simon Hyde)
Subject: Re: Problem with win32 system() function
Message-Id: <340a9e68.29964650@news.uni-stuttgart.de>

On Sat, 30 Aug 1997 22:47:13 GMT, nimchu@hal-pc.org (Nim Chu) wrote:

>After installing perl for win32 on a win95 system, everything seems to
>work fine, including the debugger. However the following perl codes:
>
>system("dir");
>print "Error_msg=",$!;
>
>gives the error message:
>
>Error creating cmd file (2)
>Error_msg=cannot find file or directory

The cmd file is a temporary batch file (.bat file) that perl for win32 creates and then
runs through it's own special version of command.com, this is created in your temporary
directory specified by your TEMP environment variable, so my guess is that you either
haven't got a TEMP env var or it points to a directory that doesn't exist, a drive that is
full, or a disk that is write protected, try this:

add the following to your autoexec.bat (if there isn't already a similar line there):
set TEMP=c:\temp

Then create a temporary directory:
mkdir c:\temp
(from the Dos Prompt)

Hope that solves your problem,
Simon Hyde


------------------------------

Date: Sun, 31 Aug 1997 04:32:16 GMT
From: nimchu@hal-pc.org (Nim Chu)
Subject: Re: Problem with win32 system() function
Message-Id: <5uahlp$a5r$1@news.hal-pc.org>

shyde@poboxes.com (Simon Hyde) wrote:

>On Sat, 30 Aug 1997 22:47:13 GMT, nimchu@hal-pc.org (Nim Chu) wrote:

>>After installing perl for win32 on a win95 system, everything seems to
>>work fine, including the debugger. However the following perl codes:
>>
>>system("dir");
>>print "Error_msg=",$!;
>>
>>gives the error message:
>>
>>Error creating cmd file (2)
>>Error_msg=cannot find file or directory

>The cmd file is a temporary batch file (.bat file) that perl for win32 creates and then
>runs through it's own special version of command.com, this is created in your temporary
>directory specified by your TEMP environment variable, so my guess is that you either
>haven't got a TEMP env var or it points to a directory that doesn't exist, a drive that is
>full, or a disk that is write protected, try this:

>add the following to your autoexec.bat (if there isn't already a similar line there):
>set TEMP=c:\temp

>Then create a temporary directory:
>mkdir c:\temp
>(from the Dos Prompt)

>Hope that solves your problem,
>Simon Hyde

Thanks a lot, your solution works. I created the c:\temp directory and
add the TEMP env var to the autoexec.bat and the error message is
gone. I appreciate your help.



------------------------------

Date: Sat, 30 Aug 1997 18:58:13 -0500
From: Brian DeRosa <derosa9@idt.net>
Subject: Problems installing new Perl5 Modules in Win95
Message-Id: <3408B395.5D69@idt.net>

I've been trying to add new libraries to my current distribution of Perl
(Perl5_4).
perl Makefile.pl works fine, but when I try to do a "make" I get the
following errors:
Error makefile 122: Colon expected
Error makefile 135: Colon expected

Line 121 is:
 .USESHELL :
(line 122 is blank)

Line 135 is:
 .PHONY: all config static dynamic test linkext manifest
(line 136 is blank)

I'm using Borland C++ 5.0, and have done a full install of it.
I'm also using the pre-compiled binaries from the CPAN site.
Any help you can give me would be greatly appreciated.
If you could post and e-mail me a copy of the post, I would also greatly
appreciate it (I don't get a chance to check the news groups very
often).
Thanks.

Brian
-- 
Brian De Rosa               | "We accept arguments as a drunken man 
derosa9@idt.net             |  leans against a lamp post... for support,
                            |  not illumination."


------------------------------

Date: 31 Aug 1997 01:24:10 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Problems installing new Perl5 Modules in Win95
Message-Id: <5uah3q$nbl@srvr1.engin.umich.edu>

  [ mailed and posted ]

In article <3408B395.5D69@idt.net>, Brian DeRosa  <derosa9@idt.net> wrote:
>I've been trying to add new libraries to my current distribution of Perl
>(Perl5_4).
>perl Makefile.pl works fine, but when I try to do a "make" I get the
>following errors:
>Error makefile 122: Colon expected
>Error makefile 135: Colon expected
>
>Line 121 is:
>.USESHELL :
>(line 122 is blank)

Type "dmake" instead of "make" (that's what perl will have been
configured for).  Borland's "make" has many inadequacies, and cannot be
used with perl.

Since you say you're running on Win95, I think you'll also need 4dos
to make it work (from what I've heard).

 - Sarathy.
   gsar@umich.edu



------------------------------

Date: 30 Aug 1997 12:14:48 -0700
From: alex@inova.net
Subject: Question: Returning false/zero to shell...
Message-Id: <5u9rf8$cna@drn.zippo.com>

Hello friends,

I am trying to get a script to return a zero or false that can be interpreted
by a bash shell script.

example:

test.pl || echo "Hi"

How should the script exit in order for it to be evaluated as false? Die worked
but left a STDERR message. Is there a cleaner way?

While am at it. If I did want the script to return something, how would that be
done?

Any help would be greatly appreciated.

Thanks,
Alex Panagides
Ceara, Brazil


------------------------------

Date: 30 Aug 1997 15:50:14 -0700
From: Russ Allbery <rra@stanford.edu>
To: alex@inova.net
Subject: Re: Question: Returning false/zero to shell...
Message-Id: <m3k9h39tg9.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

alex <alex@inova.net> writes:

> I am trying to get a script to return a zero or false that can be
> interpreted by a bash shell script.

When it comes to Unix process status, false isn't zero.  False is
non-zero; a true exit status is zero.

> example:

> test.pl || echo "Hi"

> How should the script exit in order for it to be evaluated as false? Die
> worked but left a STDERR message. Is there a cleaner way?

        exit 1;

(Or any other exit status you want.)

> While am at it. If I did want the script to return something, how would
> that be done?

What do you mean by "return something"?

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: Sun, 31 Aug 1997 12:08:50 +0200
From: Peter de Vroomen <peterv@valkieser.nl>
Subject: Re: Questions about passing by reference.
Message-Id: <340942B2.87861F1C@valkieser.nl>

Tom Phoenix wrote:
> 
> [ Stop! You've posted this at least three times! :-)  Also, the copy
> which I got by email didn't indicate that it was also posted; with
> that information, I wouldn't have replied privately and then again in
> the newsgroup. ]

Sorry, I think our mail-server had a hiccup. I replyed to the group and
to you personally, but when I sent the message, my e-mailer seemed to
hang, so I tried again. As three copy's were posted in the messagegroup,
and you only had one personal copy, the problem must have been lying in
our mail-server.

It was wholly unintentional, I just hope it won't happen again.

Peter
-- 
Peter de Vroomen (e-mail: peterv@valkieser.nl), Software Engineer,
Valkieser Solutions, 's Gravelandseweg 80a, 1217 EW Hilversum,
The Netherlands, +31-(0)35-6714300, fax: +31-(0)35-6714333


------------------------------

Date: 31 Aug 1997 01:27:29 GMT
From: "John" <jimison@vision.net.au>
Subject: Reading a data file
Message-Id: <01bcb5ac$9b619fc0$a01711cb@jimison.vision.net.au>

Hello,

I was wondering, how do I read a data file?

Say I have a file called: data.txt and it contains

1101|Book of RA|24.95|IN
1102|Fnord Hunting|12.95|OUT

How could I read for example, 24.95 in the first line? Or
1102 in the second line?

Please reply via mail.

Thanks,
John



------------------------------

Date: Sun, 31 Aug 1997 00:02:04 -0500
From: Jesse Markham <jjmarkha@mailhost.ecn.ou.edu>
Subject: Re: Reading a data file
Message-Id: <3408FACC.5D46@mailhost.ecn.ou.edu>

John

   If you were wanting to read a text file...the best thing to do is as
follows...
    $file = data.txt; #gives variable $file the value data.txt
    open(dummy,$file);  #opens data.txt and associates dummy 
@lines = <dummy>; #dumps the contents of the file into an array of lines
    close(dummy); #closes dummy or data.txt
    for($i==0;$i<@lines;$i++)
     {
       if($lines[$i] =~ /24\.95/g) 
{ print "24.95 is located in line $i";}
       if($lines[$i] =~ /1102/g)
{ print "1102 is located in line $i";}
     } 
       







> Hello,
> 
> I was wondering, how do I read a data file?
> 
> Say I have a file called: data.txt and it contains
> 
> 1101|Book of RA|24.95|IN
> 1102|Fnord Hunting|12.95|OUT
> 
> How could I read for example, 24.95 in the first line? Or
> 1102 in the second line?
> 
> Please reply via mail.
> 
> Thanks,
> John


------------------------------

Date: Sun, 31 Aug 1997 00:20:41 +0300
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: renaming long files with WIN32 Perl
Message-Id: <34088EA9.28E5@icl.fi>

Matthew Glogowski wrote:
> 
> is there any way to rename long file names and directories in win32 perl
> under NT?

Yes there is. 

Does it surprise you that it is the exact same way 
you'd use to rename short filenames and directories?

If so, why?

Here's a sample that you can modify to taste:

    $long  = 'c:/long directory name/long file name';
    $short = 'short';
    rename( $long, $short ) or 
        die "error renaming $long to $short: $!";

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


------------------------------

Date: Sun, 31 Aug 1997 02:44:39 -0400
From: Greg Hassan <gwhassan@prodigy.net>
To: Tadd Bryan <tbryan@ghz.com>
Subject: Re: Some Assistance Please...
Message-Id: <340912D7.9811D970@prodigy.net>

Tadd Bryan wrote:

> I'm putting together a simple little perl program for a CGI script,
> and I
> need to know how to put " inside a print statement.
>
> ex:  print "John said "hi, Alice," and the date went on";
>
>

  I think most people on this group would just say go to perl.com
and find the FAQ which would tell you the answer to this question
along with many other questions you may have.

But I am feeling generous today so I will save you the trouble.

ex:  print "John said \"hi, Alice,\" and the date went on";

or

ex:  print 'John said "hi, Alice," and the date went on';

-Greg
--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
           http://www.hassan.com/, 1-701-235-3239
===============================================================
 Want to sell stuff on the web?  http://www.hassan.com/shopcart/
     Or Add your url to all of the Search Engines for FREE:
           http://www.hassan.com/superlinkadder/
===============================================================




------------------------------

Date: Fri, 29 Aug 1997 18:51:37 GMT
From: Steve_Kilbane@cegelecproj.co.uk
Subject: Re: SSH and Perl
Message-Id: <81d7cd$123325.2c2@news.cegelecproj.co.uk>

In article <5u6en2$q2a@mozo.cc.purdue.edu>, laird@freedom.ecn.purdue.edu (Kyler Laird) writes:
> I don't see any reason to use a kludge like Expect
> for this application.

Calling Expect a kludge is going a little far IMHO, but...

> I use ssh as a general-purpose pipe for lots of
> applications.

Fair enough, if ssh is well-behaved enough to play
nicely if its input comes from a pipe instead of a terminal.
I assumed that it was similar to a host of other programs
which are a little more dogmatic about their source of
data.
-- 
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.



------------------------------

Date: 31 Aug 1997 03:55:25 GMT
From: David Drum <david@vortex.more.net>
Subject: Re: SSH and Perl
Message-Id: <5uapvd$p3q$1@news.more.net>

In comp.security.ssh jjune@midway.uchicago.edu wrote:
> 	1)  Copy files to many different servers automatically;
> 	2)  Execute commands on many different servers automatically;

I have included the scripts I use below, in the same order you list above.

------------------------------------------------------------------------------
#!/usr/local/bin/perl

# $Id: dist,v 1.10 1997/06/09 16:22:50 root Exp $

$file = shift @ARGV;
die "No file specified." if ($file eq "");
@hosts = @ARGV;
die "No hosts specified." if (!@hosts);
${cwd} = `/usr/bin/pwd`;
chomp ${cwd};
die "Could not get current working directory." if (${cwd} eq "");
${cwd} = "" if ($file =~ /^\//);
${cwd} .= "/" unless ($file =~ /^\//);
die "Could not find target file." if (! -e "${cwd}$file");
$scp = `which scp`;
chomp $scp;
$scp = "/usr/local/bin/scp" if ($scp eq "");
die "Could not find scp." if (! -e "$scp");
$ssh = `which ssh`;
chomp $ssh;
$ssh = "/usr/local/bin/ssh" if ($ssh eq "");
die "Could not find ssh." if (! -e "$ssh");

foreach $host (@hosts) {

	if (-e "${cwd}RCS/$file,v") {

		print "$scp ${cwd}RCS/$file,v $host:${cwd}RCS/$file,v\n";
		system "$scp", "${cwd}RCS/$file,v", "$host:${cwd}RCS/$file,v";
		print "$ssh $host co -f ${cwd}$file\n";
		system "$ssh", "$host", "co", "-f", "${cwd}$file";

	} # if
	else {

		print "$scp ${cwd}$file $host:${cwd}$file\n";
		system "$scp", "${cwd}$file", "$host:${cwd}$file";

	} # else

} # foreach
------------------------------------------------------------------------------
#!/usr/local/bin/perl

# $Id: dossh,v 1.3 1997/04/22 18:06:13 root Exp $

$sshopt = shift @ARGV;

if ($sshopt !~ /^-/) {

	unshift @ARGV, $sshopt;
	$sshopt = "";

} # if

@sshopt = split (/\s+/, $sshopt);
$command = shift @ARGV;
die "No command specified." if ($command eq "");
@machines = @ARGV;
die "No machines specified." if (!@machines);
$ssh = `which ssh`;
chomp $ssh;
die "Could not find ssh." if ($ssh eq "");

foreach $machine (@machines) {

	print STDERR "$ssh @sshopt $machine $command\n";
	system "$ssh", ($#sshopt > -1 ? @sshopt : ()), "$machine", "$command";

} # foreach
------------------------------------------------------------------------------

Regards,

David K. Drum
david@more.net
-- 
It's hard to be bored when you're as stupid as a line. [1]
Reality has a tendency to be so uncomfortably real. [2]
You can only measure the size of your head from the inside. [3]
When you proceed deliberately, mistakes don't cascade, they instruct. [4]
[1] Vernor Vinge [2] Neil Peart [3] Larry Wall [4] Stewart Brand


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 953
*************************************

home help back first fref pref prev next nref lref last post