[24982] in Perl-Users-Digest
Perl-Users Digest, Issue: 7232 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 11 18:15:23 2004
Date: Mon, 11 Oct 2004 15:05:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 11 Oct 2004 Volume: 10 Number: 7232
Today's topics:
a problem with variable interpolation.. (Kevin)
Re: How to flush a stinkin' socket? (your name here)
Re: How to flush a stinkin' socket? <Joe.Smith@inwap.com>
Re: Module Testing Question <aaa@sss.com>
Syncrhonizing local and remote directories (D. Alvarado)
Re: Syncrhonizing local and remote directories <tadmc@augustmail.com>
Re: Syncrhonizing local and remote directories <Joe.Smith@inwap.com>
Re: Syncrhonizing local and remote directories <nospam@bigpond.com>
Re: What does $base)->abs do? <Joe.Smith@inwap.com>
Re: While query <Joe.Smith@inwap.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Oct 2004 23:13:35 -0700
From: mr_vinod_desai@yahoo.co.uk (Kevin)
Subject: a problem with variable interpolation..
Message-Id: <5ae89cbb.0410102213.11fea2d3@posting.google.com>
#!/opt/perl_5.8.5/bin
# heres a peice of script which is troublin me since a while. Might as
well be # a newbee question!! The problem is,
# upon single quoting the $sentence ( see below) , and forcing
evaluation
# by putting it in double quotes while printing, the string simply
does
# not get evaluated as no evaluation is specified during its
definition
# upon forcing evaluation by defining $sentence in double quotes, the
# compiler evaluates it as a system path, and does not interpolate the
variables.
# Is there a workaround which would enable evaluation of variables,
without
# evaluating it as a path?
# and thus hopefully print '\dhdu\foo\sdjadf\bar\edjd\huh' ?
$var1 = 'foo';
$var2 = 'bar';
$var3 = 'huh';
$sentence = "\dhdu\$var1\sdjadf\$var2\edjd\$var3";
print "$sentence";
------------------------------
Date: 10 Oct 2004 19:38:51 -0700
From: hik2sanity@hotmail.com (your name here)
Subject: Re: How to flush a stinkin' socket?
Message-Id: <a794b8d.0410101838.377e335@posting.google.com>
> >
> > The message on the receiving end appears when the shutdown command is
> > issued. I am not particularly familiar with the receiving end's
> > application (a Delphi program) but I have the source and can step
> > through. The receive event is triggered when that shutdown command
> > occurs.
>
> How does the receiving application read the data? If it tries to read a
> whole line it will wait until a newline is sent (which you don't) or EOF
> of the socket (which you trigger with your shutdown).
>
> So try to send a newline after your string.
>
> Thomas
It shows up AFTER I send about 23000 newlines. None less will do it.
------------------------------
Date: Mon, 11 Oct 2004 06:22:25 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: How to flush a stinkin' socket?
Message-Id: <BEpad.448720$8_6.368061@attbi_s04>
Henry Law wrote:
> On 8 Oct 2004 07:28:03 -0700, jl_post@hotmail.com (J. Romano) wrote:
>
>I had a similar problem about a year ago,>
>
> I've no idea whether or not this post answers the question (sounds
> plausible to me ...) but I had to post my admiration at such a
> comprehensively helpful and beautifully written response. Worth a
> virtual cup of coffee, maybe even a virtual beer!
Agreed. And if it had been posted as
Content-type: text/plain
instead of
Content-Type: text/plain; charset=Big5
it would have been even better.
-Joe
------------------------------
Date: Mon, 11 Oct 2004 01:07:26 GMT
From: "Eddie" <aaa@sss.com>
Subject: Re: Module Testing Question
Message-Id: <i1lad.686778$M95.536037@pd7tw1no>
Thanks so much. Unfortunately, I dont know the inner workings of Perl as
much as I should. I guess everyday is a learning day for me.
Ed
"Christian Winter" <thepoet_nospam@arcor.de> wrote in message
news:416986c5$0$22619$9b4e6d93@newsread4.arcor-online.net...
> Eddie wrote:
>> Hi,
>>
>> I wanted to test all the subroutines in my module from a script,
>> but I have a problem. Some subroutines are called from only
>> inside the module and some are not. Therefore I have code
>> like:
>>
>> 1 my ($pkg, @args) = @_
>> and
>> 2 my @args = @_
>>
>> in other places. Unfortunately if i test my sub routine that has #2
>> above,
>> I get an error because the package name is passed into the sub and the
>> code
>> isnt
>> expecting that. Is there a way that a script can call a method in a
>> module
>> and not
>> pass the package name?
>
> Of course there is.
> Just leave away the OO-style "->" notation and call
> your sub the "conventional" way in "::" notation.
> You should propably have a look at "perldoc perloo" and
> "perldoc perltoot" as well as "perldoc perlmod".
>
> In fact, it's "->" notation that makes it possible at all
> to do OO programming in Perl.
>
> Just a little example to show the difference:
> -----------------------------------------------------
> #!perl
>
> use strict;
> use warnings;
>
> package mymod;
>
> sub displayargs {
> print "Called with:".$/;
> print " $_".$/ for( @_ );
> }
>
> 1;
>
> package main;
>
> print "Classic notation: mymod::displayargs(...)".$/;
> mymod::displayargs( 1, 2, 3 );
>
> print $/;
>
> print "OO notation: mymod->displayargs(...)".$/;
> mymod->displayargs( 1, 2, 3 );
>
> __END__
> ------------------------------------------------------
>
> HTH
> -Christian
------------------------------
Date: 10 Oct 2004 19:15:49 -0700
From: laredotornado@gmail.com (D. Alvarado)
Subject: Syncrhonizing local and remote directories
Message-Id: <ec027e73.0410101815.43f9ce41@posting.google.com>
Hello,
Does anyone know of a perl module or have a perl script handy that
takes as paramters
remote host
remote host FTP login
remote host FTP password
local directory
remote directory to update
and then copies all the contents of the local directory supplied to
the remote directory.
Thanks, -
------------------------------
Date: Sun, 10 Oct 2004 21:22:17 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Syncrhonizing local and remote directories
Message-Id: <slrncmjrip.nc4.tadmc@magna.augustmail.com>
D. Alvarado <laredotornado@gmail.com> wrote:
> Does anyone know of a perl module or have a perl script handy that
> and then copies all the contents of the local directory supplied to
> the remote directory.
I know of a well-respected and widely used program that can
do all of that, but it is not written in Perl, so I won't
mention it.
Sorry I couldn't answer your question.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 11 Oct 2004 05:40:07 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Syncrhonizing local and remote directories
Message-Id: <X0pad.448476$8_6.261896@attbi_s04>
D. Alvarado wrote:
> Does anyone know of a perl module ... FTP ...
It sounds like you haven't been looking in the most obvious place.
http://search.cpan.org - "ftp mirror"
The third match is a "simple program" that is good for pulling files.
It is a simple process to modify the program to push files instead.
-Joe
P.S. I never use FTP uploads any more; the user name and password
are send as plain text. Bad idea, when compared to SSL solutions.
------------------------------
Date: Mon, 11 Oct 2004 16:14:52 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Syncrhonizing local and remote directories
Message-Id: <2summtF1ov2teU3@uni-berlin.de>
Tad McClellan wrote:
> D. Alvarado <laredotornado@gmail.com> wrote:
>
>> Does anyone know of a perl module or have a perl script handy that
>
>> and then copies all the contents of the local directory supplied to
>> the remote directory.
>
>
> I know of a well-respected and widely used program that can
> do all of that, but it is not written in Perl, so I won't
> mention it.
>
> Sorry I couldn't answer your question.
>
Hint: http://samba.anu.edu.au/rsync/
(another great Australian invention)
gtoomey
------------------------------
Date: Mon, 11 Oct 2004 05:29:11 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: What does $base)->abs do?
Message-Id: <HSoad.104851$He1.27014@attbi_s01>
nntp wrote:
> I checked the document, but its statement means nothing. I also did the
> test, no difference at all.
Perhaps you did not use meaningful data in the test.
> my $base = $response->base;
> @output = map { $_ = url($_, $base)->abs; } @output;
>
> my $base = $response->base;
> @output = map { $_ = $base } @output;
>
> Both act the same.
They act quite differently with @output contains relative URLs,
absolute URLs on the current host, and URLs pointing to a different host.
@output = qw(img/foo.gif /cgi-bin/env http://www.example.com/index.html);
If you understand how <head><base href="http://www.example.com/q/"></head>
works, then you'll understand how $base works.
-Joe
------------------------------
Date: Mon, 11 Oct 2004 06:03:43 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: While query
Message-Id: <2npad.218274$MQ5.55709@attbi_s52>
Ben Morrow wrote:
> Something that puzzles me slightly is that if the above is modified to
>
> sub bar {
> (foo(1), foo(2), foo(3), foo(4));
> }
>
> my $q = bar;
> print '|';
>
> then we *do* get (5.8.2) '+1+2+3+4-3-2-1|-4'... it seems that 'returning
> a list from a sub called in scalar context' does something slightly
> different from 'evaluating a list in scalar context'; specifically, the
> non-terminal elements of the list get scalar rather than void context,
> and are destroyed later.
Yes, that is the behavior I've observed as well.
cat temp.pl
sub foo {
print "in foo(@_), context is ",
defined wantarray ?
(wantarray ? 'list' : 'scalar')
: 'void';
print "\n"; }
@_ = ( foo(10),foo(11),foo(12) ); print "\n";
$_ = ( foo(20),foo(21),foo(22) ); print "\n";
sub bar { ( foo(30),foo(31),foo(32) ); }
$_ = bar;
perl temp.pl
in foo(10), context is list
in foo(11), context is list
in foo(12), context is list
in foo(20), context is void
in foo(21), context is void
in foo(22), context is scalar
in foo(30), context is scalar
in foo(31), context is scalar
in foo(32), context is scalar
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7232
***************************************