[6488] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 113 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 13 21:17:22 1997

Date: Thu, 13 Mar 97 18:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 Mar 1997     Volume: 8 Number: 113

Today's topics:
     [Q] Redirection for an inline gif <jon@atwww.com.au>
     Re: Awk is better than Perl? <phantasm@webcom.com>
     Re: Awk is better than Perl? (Abigail)
     Re: basic documentation (Clay Irving)
     Re: Compiling Perl for Slackware <dan@msl.net>
     converting files to html <rvince@sprynet.com>
     Re: dupe checking and compressing in string <flg@vhojd.skovde.se>
     Re: Elegant way to strip spaces off the ^ and $ of a va <phantasm@webcom.com>
     Re: Elegant way to strip spaces off the ^ and $ of a va (Bennett Todd)
     Re: I'm scared and don't know what to do. Do you know?? (Kent Perrier)
     Re: irc bots in perl <rootbeer@teleport.com>
     Oracle process id? (Yan Lau)
     Re: parse html files to ascii db..... (Tad McClellan)
     Pointers problem (John Rowe)
     Preventing multiple copies of a script from running (Nicholas J. Leon)
     Printing with Windows NT 3.51 <arnold_gavurina@paging.mot.com>
     Problems with map and its side effects (Mik Firestone)
     random perl core dumps with obscure message <hall@imall.com>
     Re: remote to remote ftp from cgi (Clay Irving)
     Re: Resolving variables in print statement? (Tad McClellan)
     Re: Standard "Reaper" procedure doesn't work on Solaris (Bryan Miller)
     Re: suggestion for perltoot <tchrist@mox.perl.com>
     Unpack Cobol Comp-3 data <zouwu@erols.com>
     Re: Who makes more $$ - Windows vs. Unix programmers? <bsturk@nh.ultranet.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Mar 1997 10:59:04 +1000
From: Jon Hall <jon@atwww.com.au>
Subject: [Q] Redirection for an inline gif
Message-Id: <3328A2D8.4EF@atwww.com.au>

G'day,

Here's my dilemma - I've got a gif on another server that I want to log
hits to on my server, so rather than sifting through the log files and
manually adding hits to it I thought I'd be able to create a simple cgi
script that calls the gif and then the hits on the cgi file would be all
I needed.

What I've currently got is this....

<img src="http://www2.company.com/images/mypic.gif">

but this isn't going to get logged as a hit in the logfile, so I'd like
to do something like this....

<img src="/cgi-bin/getpic.cgi">

which would then log the hit on the getpic.cgi file and I'd be happy as
Larry :)

I don't particularly want to use SSIs (call me paranoid, even though
they're probably a good solution) and I'd like the network traffic kept
down (ie. send the gif directly to the client rather than sending it via
the first server).

Any ideas would be greatly appreciated.

Please cc responses to my email addr.

Regards,

Jon


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

Date: Thu, 13 Mar 1997 16:24:37 -0500
From: Thomas Winzig <phantasm@webcom.com>
To: "Randall W. Hron" <randall.hron@paranet.com>
Subject: Re: Awk is better than Perl?
Message-Id: <33287095.506E@webcom.com>

Randall W. Hron wrote:

<snip>
> Here is the problem.  I have a text file (or a process output)
> that looks like:
> 
> 1  hi (there)
>   hello
>     how are you == good
> 19 this is a new
>   paragraph.
> 0  Here is another
>    paragraph:
>   that has [more]
>    lines.
> 
> I want to break the text into paragraphs.  I wanted to
> use a line beginning with a number as the paragraph delimeter,
> but the FAQ says $/ must be a string.  Anyone know a clever way
> to split multi-line text so the input above would be three lines
> and beginning with the whatever comes after the number in the
> first column?

well  here's what I would probably do.
Assuming the above is coming from the INPUT filehandle:

$count = -1;    # because the first increment 
                # will now yield zero.

while (<INPUT>) {
    # if this line contains a digit, start
    # a new paragraph, otherwise, just add the line
    # to the current paragraph entry in @paragraphs.
    if (/^(\d+ )/) {
        $_ =~ s/^$1|\r?\n?$//g;
        $count++;
        $paragraphs[$count] = $_;
        next;
    }
    $_ =~ s/\r?\n?$//;
    $paragraphs[$count] .= " $_";
}

Now each entry in @paragraphs should be a paragraph from 
the INPUT, all on one line. Of course, I'm no perl expert,
so there is probably a better way. The output I got 
was this:

 hi (there)   hello     how are you == good
this is a new    paragraph.
 Here is another    paragraph:    that has [more]    lines.

You'll probably want to add something that converts 
multiple spaces to one space (s/\s+/ /g). You could even 
retain the paragraph format, since each paragraph is being 
stored in a separate array index.

regards,
thomas


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

Date: Thu, 13 Mar 1997 22:17:31 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: Awk is better than Perl?
Message-Id: <E705x8.Jv@nonexistent.com>

On Thu, 13 Mar 1997 13:30:00 -0500, Randall W. Hron wrote in comp.lang.perl.misc:
++ The new Perl FAQ is great, but it gives an answer I don't want.
++ Here's the FAQ question and answer:
++ 
++ I put a pattern into $/ but it didn't work. What's wrong?
++ 
++ $/ must be a string, not a pattern. Awk has to be better for something.
++ :-) 
++ 
++ Here is the problem.  I have a text file (or a process output)
++ that looks like:
++ 
++ 1  hi (there)
++   hello
++     how are you == good
++ 19 this is a new 
++   paragraph.
++ 0  Here is another
++    paragraph: 
++   that has [more]
++    lines.
++ 
++ I want to break the text into paragraphs.  I wanted to
++ use a line beginning with a number as the paragraph delimeter,
++ but the FAQ says $/ must be a string.  Anyone know a clever way
++ to split multi-line text so the input above would be three lines
++ and beginning with the whatever comes after the number in the
++ first column?
++ 

Use split (). First read in the entire file, in a single string.
Then split using a pattern. Something like:

undef $/;
my @lines = split /^\d+/m, <>;


Abigail



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

Date: 13 Mar 1997 18:50:18 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: basic documentation
Message-Id: <5ga3rq$315@panix.com>

[ mailed and posted ]

In <Pine.SOL.3.91.970312193946.6446A-100000@siu.buap.mx> Alfredo Campos <apardo@siu.cen.buap.mx> writes:

>hey! i need some help please!
>i'm a neewbie in perl... in fact i don't know how to use it ... i have it 
>in my unix account...
>Where could i find some basic guide to use this lenguage???

For hardcopy, the "bible" is: 

  Programming Perl, 2nd Edition
  http://www.ora.com/catalog/pperl2/noframes.html

This isn't a beginners guide to programming Perl, but it is a must have
in your library. A good starting point may be:

  Learning Perl
  http://www.ora.com/catalog/lperl/noframes.html

It doesn't included Perl 5.x features, but it's a good book to cut your
teeth on.

I suggest you check Tom Christiansen's reviews of Perl books before you
purchase one:

   Camel Critiques 
   http://www.perl.com/perl/critiques/index.html

There is a wealth of information online:

  Perl Language Homepage
  http://www.perl.com/perl/

  The Perl Institute
  http://www.perl.org/

and (shameless plug):

  Perl Reference
  http://www.panix.com/~clay/perl

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Thu, 13 Mar 1997 17:37:16 -0600
From: Dan <dan@msl.net>
To: "Charles F. Ritter" <critter@quack.kfu.com>
Subject: Re: Compiling Perl for Slackware
Message-Id: <33288FAC.6EE39009@msl.net>

Charles F. Ritter wrote:
> 
> I'm having trouble compiling Perl on Slackware (Aug. 96 Walnut Creek
> CD). The problem comes up if I choose "dynamic loading". I've seen a
> post to comp.os.linux.misc that said it was an incomplete gcc
> distribution that causes the problem, specifically a missing libldl.so
> file. Unfortuneately I can't find the library to find out and I've found
> no corraboration about the issue - which I find odd since Perl is
> preatty popular.
> 
> I'm trying to install the libnet-1.04 package and it complains if I
> don't have a dynamically loading Perl.
> 
> Does anyone know 1) if this is really the problem, 2) why no libldl.so
> 3) where I can get it and 4) is their another viable way to get libnet,
> libwww, MIMETools, MailTools and POP3Client packages installed?
> 
> Thanks.
> 
> please send response via email

libdl comes with all Slackware distributions, alas, the symlinks are 
incorrectly set up.  What you need to do is make a symlink from 
/usr/lib/libdl.so to the file /lib/libdl.so.??.??.  Then, you should 
have no problems compiling it.


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

Date: 14 Mar 1997 00:08:47 GMT
From: "R. Vince" <rvince@sprynet.com>
Subject: converting files to html
Message-Id: <01bc300c$12f1ab60$d2c0a6cf@isjfvklh>

Is anyone aware of a pd PERL script anywhere which would convert a Word Doc
file, or an RTF, or a Wordperfect file, into an html file? Thanks, Ralph



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

Date: Tue, 11 Mar 1997 16:08:25 +0100
From: Fredrik Lindberg <flg@vhojd.skovde.se>
To: Bertrand Le Guen <b.leguen@ctr.renault.fr>
Subject: Re: dupe checking and compressing in string
Message-Id: <33257569.7A8@vhojd.skovde.se>

Bertrand Le Guen wrote:
> $LINE="========AAAAAABBBBBBcccdddeeee******";
> i would like as result to get
> $LINE="=ABcde*";
> 
> i've take a look at the perlop man page and at the FAQ and didn't get
> any easy way to do it !

The PERLOP man page tells us this about tr//  :

"If the /s modifier is specified, sequences of characters that were
translated to the same character are squashed down to a single instance 
of the character."

and continues with the this example (among others):

tr/a-zA-Z//s;    # bookkeeper -> bokeper

Now to extend this example and include any repeated characters
you could write it like this:

tr/\001-\377//s;

Hope this helps

/Fredrik


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

Date: Thu, 13 Mar 1997 16:27:46 -0500
From: Thomas Winzig <phantasm@webcom.com>
Subject: Re: Elegant way to strip spaces off the ^ and $ of a variable containing a sentence.
Message-Id: <33287152.61C6@webcom.com>

Russ Allbery wrote:

> You can do it in one pass.  It's just slow.
> 
>         $variable =~ s/^\s+(.*?)\s+$/$1/;

Or what about this:

$variable =~ s/^\s+|\s+$//g;

that might be faster.

heck, that might be slower! dunno... :-)

-thomas


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

Date: Fri, 14 Mar 1997 00:14:21 GMT
From: bet@nospam.interactive.net (Bennett Todd)
Subject: Re: Elegant way to strip spaces off the ^ and $ of a variable containing a sentence.
Message-Id: <slrn5ih62s.7oh.bet@onyx.interactive.net>

On 13 Mar 1997 12:16:08 -0800, Russ Allbery <rra@cs.stanford.edu> wrote:
>To me, map has two interpretations; it can either be used as a filter
>function as you mention above or it can be used to apply a block of code
>to every element of an array.

Wouldn't it be nice if the Perl compiler could detect when the return value
from map is being discarded, and refrain from building the result array. Then
add extensive support for lazy evaluation, and yowza, you could make the short
and elegant-looking constructs as efficient as the slogging-through-the-mire
written-out loops. Joy! Who knows, we keep at this and we could catch up with
Lisp:-).

-Bennett


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

Date: 13 Mar 1997 17:15:52 -0600
From: kperrier@Starbase.NeoSoft.COM (Kent Perrier)
Subject: Re: I'm scared and don't know what to do. Do you know??
Message-Id: <cssp1zjsd3.fsf@Starbase.NeoSoft.COM>

In article <pCGqxEAb2GKzEwB7@resmon.demon.co.uk> 
Tom Holder <Tom@intermart.co.uk> writes:

>You obviously didn't read my original post carefully enough. I mentioned
>the word student, this means I am very skint. I can't afford a bus
>ticket let alone a CGI programmer. Thanks for your help anyway.

Then you are faced with a very very difficult task.  8 weeks is not enough
time to learn perl well enough to do everything you want.

Kent
-- 
Kent Perrier           If Bill Clinton is the answer, then it must
kperrier@neosoft.com    have been a really stupid question.
Corporations don't have opinions, people do.  These are mine.
PGP 2.6 Public Key available by request and on key servers
PGP encrypted mail preferred!



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

Date: Thu, 13 Mar 1997 14:34:42 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: James Esler <metalhead@mhv.net>
Subject: Re: irc bots in perl
Message-Id: <Pine.GSO.3.95q.970313143300.25659E-100000@kelly.teleport.com>

On Wed, 12 Mar 1997, James Esler wrote:

> I'm writing to ask if it's possible to write irc scripts and bots in
> perl.  If so, where would I find more information on this?

In a newsgroup about IRC, perhaps? :-)  

You also should probably see what 'perldoc Socket' has to say. And also,
consider making (and releasing to CPAN) a module to interact with IRC.
Hope this helps! 

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

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 13 Mar 1997 23:46:41 GMT
From: ylau@iworks.InterWorks.org (Yan Lau)
Subject: Oracle process id?
Message-Id: <5ga3l1$bpb@server05.icaen.uiowa.edu>

We're using Perl 5 with the DBD-Oracle module for Oraperl emulation.
When a query is initiated, a separate process is spawned that actually
does the query.  How do you get the process id of that process?


Yan.
ylau@iworks.interworks.org (guest)


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

Date: Thu, 13 Mar 1997 17:26:02 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: parse html files to ascii db.....
Message-Id: <ae2ag5.iq3.ln@localhost>

jpooser@gsd.harvard.edu wrote:
: I'm working on a script that looks in the current directory and all
: subdirectories for files ending in *.htm or *.html, reads these files
: in, extracts certain information, and writes the results out into a
: flat, tab delimited database (ascii file).

: Are there any public domain libraries/scripts out there that I might be
: able to use (all or parts of)- I hate to re-invent the wheel- 


It is way too simple to have a library for, if you are on Unix.

File::Find  will work if you aren't.


: Some issues I'm having are:

: 1.) I'm using the Open File Handle and an if loop to look for
: regexpression(s):

: $test_file =  "index.htm";

: open(FILE,"$test_file") || die "cannot open $test_file for reading";

: while (<FILE>) {
         ^^^^^

Read _one_ line.


: 	if ( m:<TITLE>(.*)</TITLE>:xsgi ) {

So of course this will not match if the parts are split across lines,
because you only _have_ one line!


:    print "title: $1\n";

: 	}
: }

:  but it doesn't work if the html has a \n in the tile.  What's a better
: way?


Slurp the whole file into a single string. Then use non-greedy matching.

HTML files better not be very big, so this shouldn't get you into
memory trouble.


# UNTESTED!

@file_list = `find /home/jpooser -name '*.html' -print`;
#                  ^^^^^^^^^^^^^ path to directory goes here

foreach $test_file (@file_list) {
   open(FILE,"$test_file") || 
      die "cannot open $test_file for reading";
   $_ = join '', <FILE>;   # hokey slurp, leaves $/ alone
   close(FILE);

   if ( m:<TITLE>(.*?)</TITLE>:sgi ) {  # you don't need the 'x'
   #                ^ non-greedy
 ...


: 2.) what's a good way to perform an operation on files in the current
: directory and all subdirectories?


File::Find


: 3.) There's gotta be someone who's already done this type of
: stuff...?.....


: Please respond directly:
         ^^^^^^^^^^^^^^^^

Nope.

Ask it here. Get the answer here.

--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Thu, 13 Mar 1997 18:17:27 GMT
From: rowe@excc.exeter.ac.uk (John Rowe)
Subject: Pointers problem
Message-Id: <ROWE.97Mar13181727@sga.excc.exeter.ac.uk>

I would like to use pointers as the keys to an associative array and
would hope that the following test program would do it:

#! /usr/local/bin/perl5.003
$foo->{'bar'}->{'baz'} = "Hello World";
$bar->{$foo->{'bar'}} = "This is bar";
print "$foo->{'bar'} : $foo->{'bar'}->{'baz'}\n";
foreach $pt ( keys %{$bar}) {
    print "$pt : $bar->{$pt} : $pt->{'baz'}\n";
}

I would *like* to get:
HASH(0x1001bf6c) : Hello World
HASH(0x1001bf6c) : This is bar : Hello World

I *actually* get:
HASH(0x1001bf6c) : Hello World
HASH(0x1001bf6c) : This is bar : 

I get the same if I replace the second line by:
$bar->{\%{$foo->{'bar'}}} = "This is bar";
and/or the penultimate line by:
    print "$pt : $bar->{$pt} : $pt{'baz'}\n";

Have I made some dreadful error? Is there a way of doing this?

Thanks

John


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

Date: 14 Mar 1997 00:40:39 GMT
From: nicholas@neko.binary9.net (Nicholas J. Leon)
Subject: Preventing multiple copies of a script from running
Message-Id: <slrn5ih7k6.ahp.nicholas@neko.binary9.net>

Hey folks -

I have a question that's part Perl (implementation) and part
Unix'ism. 

Let's assume this scenerio: several copies of a single Perl script are
invoked relatively simultaneously. What I would like is for them to
execute one at a time; having each one wait until the previous one is
finished before starting to execute.

Obviously, I need some sort of locking mechanism for this, probably a
file.

Consider this code:

sub mywait {
   sleep 5 while -f "/var/locks/MYLOCK";
   `touch /var/locks/MYLOCK`;
}
sub myexit {
   unlink "/var/locks/MYLOCK";
   exit 0;
}

Ok, to me this looks fine in theory except for one thing: isn't it
possible that two copies will fall out of the "sleep 5 .." loop at the
exact same time? If so, they both will touch the file and then
continue executing, violating my set of parameters for execution
(exclusive execution).

So (finally) here is my question: how should I efficiently (and
effectively) do this? I have considered using flock() on a file, but
am unsure about it. More specifically, if a file is
  flock $handle,$LOCK_EX
and another process attempts the same command, will it wait
indefinately? And is there any chance that two processes will be given
simultaneous locks (I certainly hope not).

Thanks to all the guru's that I know will just fill my mailbox with
solutions :) 

-- 
 
N!
------------------------------------------------------------------------------
Nicholas J. Leon                                        <nicholas@binary9.net>
"Elegance through Simplicity"                  http://www.binary9.net/nicholas

                           "Fear is the mind killer.
             Fear is the little death that brings total oblivion."



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

Date: Thu, 13 Mar 1997 17:55:08 -0500
From: Arnold Gavurin <arnold_gavurina@paging.mot.com>
Subject: Printing with Windows NT 3.51
Message-Id: <332885CC.6DEE@paging.mot.com>

I have an application where I need to "print" to a virtual printer that
takes an MS Word 7.0 file and converts it to postscript file. The
"virtual" printer driver can be selected as one of the printers that
appear in my printer dialog box when I issue the menu command "Print"
from MS Word. When I do it manually I "print" to the "Adobe Distiller
printer", which is not really a printer like my HP laserwriter, but a
program that saves the file as *.ps (postscript). Using the WIN32
software I have written a Perl script I can launch from  a command line
in NT. That script will watch for *.doc files to show up in a directory
and then "print" (convert) into postscript.

Does anyone know how to select the windows NT "printer" I have described
from a PERL script or Would I need some custom "C" code?

Arnold Gavurin


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

Date: 13 Mar 1997 19:19:46 GMT
From: mfiresto@vnet.ibm.com (Mik Firestone)
Subject: Problems with map and its side effects
Message-Id: <5g9k0i$ghc$1@mail.lexington.ibm.com>

On input like:
 vh=foo vh=bar vh=biteme pgp=yes confused=extremely moe

this code:
  
    #!/usr/local/bin/perl5 -w
    #                      ^^ yes, I used -w.  Who doesn't?

    use strict; 

    my $user = $ARGV[$#ARGV];
    my ( @vhost );

    print "\@ARGV = @ARGV\n";
    # process command line arguments
    @vhost = map { s/vh=//; $_ } (grep( /vh=/, @ARGV ));

    print "\@ARGV = @ARGV\n";
    print "\@vhost = @vhost\n";
    __END__

produces output like this:
@ARGV = vh=foo vh=bar vh=biteme pgp=yes confused=extremely moe
@ARGV = foo, bar, biteme, pgp=yes, confused=extremely, moe
@vhost = foo, bar, biteme

I expected it to work like this: the grep will create a temporary array
consisting of ( vh=foo,vh=bar,vh=biteme ).  The map statement with then
take this temp array, strip the 'vh=' and end up with ( foo,bar,biteme ).
I did not expect @ARGV to get hosed.  I have copied @ARGV to another list,
and used that in the map statement.  @ARGV remained untouched, but the same
thing happened to the other list.

There was some talk today ( I think ) about using the side effects ( or is
that affects?  I can never remember ) of map to strip whitespace from a
line.  What are these side effects ( if I am going to be wrong, I will be
so consistently ), how do they work and how can I avoid them?  Are they
documented anywhere?  I checked the Camel, the man pages and the new and
improved ( thanks, Tom ) FAQ, but did not see anything related to this
question.

According to the Camel, map uses a local'd $_ which should protect the
original values?  Also, shouldn't map be messing with the temporary 
list created by grep?  How does map know what the original list was?

Any help ( RTFMs included if they tell me to look somewhere I haven't
thought to look ) is greatly appreciated.

Mik
-----
Mik Firestone  mfiresto@mindspring.com
Evil Overlord Rule #29: I will keep a special cache of low-tech weapons
and train my troops in their use. That way -- even if the heroes manage
to neutralize my power generator and/or render the standard-issue energy
weapons useless -- my troops will not be overrun by a handful of savages
armed with spears and rocks.


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

Date: Thu, 13 Mar 1997 17:10:56 -0700
From: Kelly Hall <hall@imall.com>
Subject: random perl core dumps with obscure message
Message-Id: <Pine.WNT.3.96.970313165715.147I-100000@boho.imall.com>

Hello,

I have a program that seems to randomly dump core, and the error message I
get does not seem to clarify the situation.

The program runs for about 24 hours at a time, watching STDIN for data,
which it sucks in and saves to a temporary file.  Periodically, the alarm
goes off and the program rotates the disk log to a safe place, and finally
forks off a child to copy the saved logs to a different machine.

Relevant versions of stuff:
  perl 5.003 with EMBED
  freebsd 2.1.5-release
  gcc 2.6.3

here's the relevant parts of the code:  the *** flags the error line.

$rin  = $win  = $ein  = "";
$rout = $wout = $eout = "";
vec($rin, fileno(STDIN), 1) = 1;
$ein = $rin;
$tl = "";
for ( ; ; ) {
    ($nf, $tl) = select($rout=$rin, $wout=$win, $eout=$ein, undef);
    if( $TIMEOUT == 1 ) {
        $TIMEOUT = 0;
        &rotate_log();
        &alive_parent();
        alarm $delay;
    } elsif( $nf > 0 ) {
***     $log = <STDIN>;
        print SAVE $log;
    }
}

line ***, attempt to free unreferenced scalar, <STDIN> chunk 53.

TIMEOUT is set in the alarm signal handler.  alive_parent sees if our
parent is pid=1, and if so, exits.  

Thanks in advance for any insights you may offer.

Kelly
--
Kelly Hall             Lead Programmer
hall@imall.com         (rhymes with 'dead')



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

Date: 13 Mar 1997 18:58:58 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: remote to remote ftp from cgi
Message-Id: <5ga4c2$3t7@panix.com>

In <33271E5C.23CD@interactive.ibm.com> John Call <johnc@interactive.ibm.com> writes:

[ mailed and posted ]

>I need to write a program in perl that will let me ftp from one remote
>site to another. Let's say I have a ftp.html page. The user fills in the
>following:

>From: www.abcd.com/index.html
>To: www.wxyz.com

>Hit submit. The cgi program should send the file index.html from
>abcd.com to www.xyz.com/johnc. Is this possible? Is their third-party
>software that already does this? If not possible what solution can I use
>that doesn't involve third-party software?

If you are thinking "ftp and Perl," get Net::FTP -- You'll be able to do
something like:

$ftp = Net::FTP->new("$target");
$ftp->login("$user","$password");
$ftp->cwd("/somewhere");
$ftp->binary;
if (!($ftp->put("$filename"))) {
  print "ftp to $target failed! \n";
  exit 2;
}
$ftp->quit;

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: Thu, 13 Mar 1997 13:59:15 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Resolving variables in print statement?
Message-Id: <jam9g5.gq2.ln@localhost>

Subesh Ghose (sghose@tiger.lsu.edu) wrote:
:   I am having trouble resolving the variable in my print statement. Here
: are the lines of code:

: $outfile = 'g:\\htmldoc\\dc\\docs\\wkreport\\wkreport.htm';
: open (OUTFILE, ">$outfile") || die "Couldn't open #!\n";
: print OUTFILE '<dt>Report week ending <a href="/wkreprt/$week.htm">$date</a>';
                ^                                                             ^
                ^                                                             ^

:   I cannot get these variables to resolve. Is my syntax correct for the
                                    ^^^^^^^

We usually call it 'interpolate'.

It doesn't happen inside of single quotes. You have used single quotes.

Put it in double quotes (and then go backwack all the literal double
quotes), OR use qq():

print OUTFILE qq(<dt>Report week ending <a href="/wkreprt/$week.htm">$date</a>);
              ^^^                                                             ^
              ^^^                                                             ^


: print line? Any help is appreciated.
              ^^^^^^^^^^^^^^^^^^^^^^^

There ya go.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 13 Mar 1997 23:19:04 GMT
From: millerb@pt9548.ped.pto.ford.com (Bryan Miller)
Subject: Re: Standard "Reaper" procedure doesn't work on Solaris.
Message-Id: <5ga218$t391@eccws1.dearborn.ford.com>

Casper H.S. Dik - Network Security Engineer (Casper.Dik@Holland.Sun.COM) appears to have written:
>gideon@csarc.otago.ac.nz (Gideon King) writes:

>>Does anyone have any suggestions about how to solve this problem?

>$SIG{'CHILD'} = 'IGNORE';

>works fine on System V.

>hasn't perl been fixed to use safe signals on platforms that support it?

>Also, note that you can get only SIGCHLD for multiple child processes.

So everyone claims =:o  Since Digital Unix still can't decide if it's
BSD or SVR? it has yet to work for me.  The deamon runs fine but I
still get heaps of defunct processes.

Bryan


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

Date: 14 Mar 1997 00:48:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: suggestion for perltoot
Message-Id: <5ga78h$98i$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "Michael J. South" <msouth@shodor.org> writes:
:I then created a file called GDM.pm:
:
:package GDM;
:use GD;
:@ISA = ("GD");
:1;
:
:and tried to use it in a program:
:
:#!/usr/bin/perl
:use GDM;
:my $im = GDM::Image->new();
:
:This give me the message that I am trying to call method "new" in an
:empty package "GDM::Image".  I looked in perldiag, read perlref and
:perlobj, but I"m not seeing the problem.  
:
:If whatever I'm missing could be explained in a couple of lines in
:perltoot, I think it would be helpful.  My understanding was that GDM
:would "inherit" whatever GD had, and that this would imply that there
:would be a GDM::Image with a new defined in it just like
:GD::Image->new().
:
:Thanks for all the work you all do to provide such a wonderful tool.

Um, you didn't say anything about class GDM::Image.  Are you confusing
objects and classes with mere directory organization?  

Perhaps you should have said:

    package GDM;
    use GD::Image;
    @ISA = ("GD::Image");
    1;

and then

    use GDM;
    my $im = GDM->new();

instead.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in."
	--Larry Wall in <1994Jul21.173737.16853@netlabs.com>


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

Date: Thu, 13 Mar 1997 20:51:04 -0500
From: Yufang &Zhihong Zou <zouwu@erols.com>
Subject: Unpack Cobol Comp-3 data
Message-Id: <3328AF08.2691@erols.com>

Hi, there,

I was looking for some perl scripts or helps to unpack COBOL
COMP-3 data into ascii data. Any suggestion will be highly
appreciated.

Thanks,
Zhihong,


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

Date: Thu, 13 Mar 1997 17:26:37 -0500
From: Brian Sturk <bsturk@nh.ultranet.com>
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <33287F1D.163E@nh.ultranet.com>

Iggy Drougge wrote:
> 
> John Lockwood (johnl@calweb.com) skrev:
> >"Terje A. Bergesen" <terjeber@eunet.spm-protect.no> wrote:
> 
> >>> Unix appeals more to me and is more advanced technically, but I am
> >>> afraid that it is losing the market share to Windows 95.
> 
> >Unix is more advanced technically?  That's interesting.  The last time
> >I installed a modem on Windows NT the OS found it for me.  The last
> >time I tried it on Unix I read about the nine files one had to edit,
> >then gave up.   It seems to me that Unix is losing market share
> >precisely because end users never make the programmer's mistake of
> >confusing technical advancement with obtuseness.
> 
> Why would your computer detect a modem for you? Do you mean it sent out "AT" on
> the serial port and listened for "OK", or what? When I use modems, I just plug
> them in into the appropriate sockets.
> Granted, UNIX can be quite comlicated, but it still has the edge over NT in
> really power-demanding niches.
> 
> --
>     __/\________________ __ ______        _____________________________
>     \/ /_  /\__  /\_  _// //     //\  /\ / ____________________________\
>     / / / / __/ /  / / / // / / // / / // /          __   __
>    / /_/ / / __/  / / / // / / // /_/ // /  alias | | _  | _  |__|
>   /_____/ /_/    /_/ /_//_/\/_/ \_____\\ \        | |__| |__| .__|
> ________________________________________\ \        D r o u g g e
> \_________________________________________/
Where I work we're running "real time" client/server progs with custom
screens with NT and the screens provided to us by the Navy developers
using unix need to be run on a Pentium 200 to eliminate flicker.  Our
programs can be run on a low end 486.  I'm not sure to the specifics to
why this happens (I'm not a graphics programmer)but I was told that it
was a limitation of UNIX.  These are very powerful programs that are on
the being tested on the KittyHawk right now.


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

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 113
*************************************

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