[19807] in Perl-Users-Digest
Perl-Users Digest, Issue: 2002 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 24 21:05:46 2001
Date: Wed, 24 Oct 2001 18:05:09 -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: <1003971908-v10-i2002@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 24 Oct 2001 Volume: 10 Number: 2002
Today's topics:
beginner: leading zerro function <mto@kabelfoon.nl>
Re: beginner: leading zerro function <tim@vegeta.ath.cx>
Re: beginner: leading zerro function (John J. Trammell)
Re: frage zum datum <mgjv@tradingpost.com.au>
Re: GD::Graph plot keeps failing <mgjv@tradingpost.com.au>
Re: GD::Graph plot keeps failing <mgjv@tradingpost.com.au>
Hello all. <zecho@radicalmatter.com>
Re: lookingglass.pl <mgjv@tradingpost.com.au>
Re: lookingglass.pl <mgjv@tradingpost.com.au>
Memory management (Kevin J. Schmidt)
Re: Memory management (Logan Shaw)
Need script or tool to create function call lists <lk.wilson@home.com>
Re: Perl and sendmail <tintin@snowy.calculus>
Re: Perl Vs. Java <tim@vegeta.ath.cx>
Perl, MySQL, MS Access, Windows AND Linux <none@none.com>
Re: Perl, MySQL, MS Access, Windows AND Linux <jeff@vpservices.com>
PF_INET vs. AF_INET <rtrahan@monmouth.com>
Re: Plaintext to passwd file? (Logan Shaw)
Problems with B::CC <ericm@vertical.com>
syntax help? <two_wheeled@hotmail.com>
Re: Transfer to & from remote machine using telnet (Logan Shaw)
Re: What's wrong with File::Find <dtweed@acm.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Oct 2001 00:24:37 +0200
From: "MAGiC MANiAC^mTo" <mto@kabelfoon.nl>
Subject: beginner: leading zerro function
Message-Id: <9r7fb7$2qv5$1@news.kabelfoon.nl>
how can I create a function to ad leading zerros before value?...
for example:
$v=12
print lz($v,4);
result:
0012
4 is the total zerros to add before $v
is there someone who like to help me?
thanks!
------------------------------
Date: Wed, 24 Oct 2001 22:32:01 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: beginner: leading zerro function
Message-Id: <slrn9teh6r.745.tim@vegeta.ath.cx>
Me parece que MAGiC MANiAC^mTo <mto@kabelfoon.nl> dijo:
> how can I create a function to ad leading zerros before value?...
>
> for example:
>
> $v=12
> print lz($v,4);
>
> result:
>
> 0012
>
> 4 is the total zerros to add before $v
>
> is there someone who like to help me?
How 'bout printf()?
$ perl -
$v = 12; # don't forget your semicolon.
printf "%04d\n", $v;
^D
0012
$ perldoc -f printf
HTH
Tim
--
Windows - what do you want to crash today?
------------------------------
Date: Wed, 24 Oct 2001 17:40:01 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: beginner: leading zerro function
Message-Id: <slrn9tegq1.adq.trammell@haqq.el-swifto.com>
On Thu, 25 Oct 2001 00:24:37 +0200, MAGiC MANiAC^mTo <mto@kabelfoon.nl> wrote:
> how can I create a function to ad leading zerros before value?...
>
> for example:
>
> $v=12
> print lz($v,4);
>
> result:
>
> 0012
>
> 4 is the total zerros to add before $v
>
printf "%04d", $v;
See also sprintf().
--
According to the Genesis account, the tower of Babel was man's second
major engineering undertaking, after Noah's ark. Babel was the first
engineering fiasco.
- F. Brooks, _The Mythical Man-Month_
------------------------------
Date: Wed, 24 Oct 2001 23:40:57 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: frage zum datum
Message-Id: <slrn9tekc9.6ff.mgjv@verbruggen.comdyn.com.au>
On Wed, 24 Oct 2001 13:59:06 GMT,
Andrew Cady <please@no.spam> wrote:
> Andrew Cady <please@no.spam> writes:
>
>> Falk P. <paule.p-deleteme-@gmx.de> writes:
>>
>> OP asked how to convert:
>>
>> > [2001-1-4 12:1:5]
>>
>> to:
>>
>> > [2001-01-04 12:01:05]
>>
>> Here's one way:
>>
>> s/(\D|^)(\d)(\D|$)/sprintf "$1%.2d$3", $2/eg;
>>
>> HTH.
>
> Erm, or just:
>
> s/(\D|^)(\d\D|$)/${1}0${2}/eg;
or just:
s/\b(\d)\b/0$1/g;
Of course, none of these solutions generalise very easily :)
Martien
--
Martien Verbruggen |
| Make it idiot proof and someone will
Trading Post Australia Pty Ltd | make a better idiot.
|
------------------------------
Date: Wed, 24 Oct 2001 23:17:52 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD::Graph plot keeps failing
Message-Id: <slrn9tej10.2qd.mgjv@verbruggen.comdyn.com.au>
On 24 Oct 2001 14:06:39 -0700,
adam denenberg <adam@dberg.org> wrote:
> Hey,
>
> I am using GD::Graph and I am trying to plot data from 2 stored
> arrays, but it is failing
> #./testme.pl
> gd-png: fatal libpng error: Invalid number of colors in palette
> gd-png error: setjmp returns error condition
> #
This message is coming from the libgd library (not even from GD and
certainly not from GD::Graph :))
It looks like there's something wrong with your gd library, or maybe
your png library. Did you compile it yourself? Did the tests all pass?
Martien
--
Martien Verbruggen |
|
Trading Post Australia Pty Ltd | Curiouser and curiouser, said Alice.
|
------------------------------
Date: Wed, 24 Oct 2001 23:36:42 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD::Graph plot keeps failing
Message-Id: <slrn9tek4a.6ff.mgjv@verbruggen.comdyn.com.au>
On 24 Oct 2001 14:06:39 -0700,
adam denenberg <adam@dberg.org> wrote:
> Hey,
>
> I am using GD::Graph and I am trying to plot data from 2 stored
> arrays, but it is failing
Ignore my previous response:
$my_graph->plot([@labels],[@vals]) or die $my_graph->error;
tells us:
Invalid data set: 0 at ./foo.pl line 27.
The data set has to be a single reference to an array, which contains
other references to arrays, _or_ a GD::Graph::Data object.
This will work:
$my_graph->plot([\@labels, \@vals]) or die $my_graph->error;
or this, if you really want to copy the data:
$my_graph->plot([ [@labels], [@vals] ]) or die $my_graph->error;
But depending on how you need to build your actual data set, you might
prefer to use a GD::Graph::Data object:
use GD::Graph::Data;
my $data = GD::Graph::Data->new();
$data->add_point('label1', 1);
$data->add_point('label2', 2);
which is more suitable for processing od the result of database
queries, or file contents.
Martien
--
Martien Verbruggen |
| Think of the average person. Half of
Trading Post Australia Pty Ltd | the people out there are dumber.
|
------------------------------
Date: Wed, 24 Oct 2001 23:12:07 GMT
From: "Zecho" <zecho@radicalmatter.com>
Subject: Hello all.
Message-Id: <bVHB7.18218$IR4.10730942@news1.denver1.co.home.com>
Just thought I would introduce myself. I stalked Dave Cross and he led
me here (don't hold him responsible). I do have an on topic question as
well, and then I will revert back to lurking.
As a relative newbie to perl, and having way too much time on my hands, I
don't know _what_ I can do with my new skills. I have read the llama a
few times, and have participated in the perlmonks community for a number
of months.
Any suggestions as to projects to enhance what I have gathered so far? I
really need the practice.
Thanks
Don Wright.
------------------------------
Date: Wed, 24 Oct 2001 23:52:06 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: lookingglass.pl
Message-Id: <slrn9tel15.6ff.mgjv@verbruggen.comdyn.com.au>
On Wed, 24 Oct 2001 18:45:41 GMT,
Mark Jason Dominus <mjd@plover.com> wrote:
> In article <87hesuq9r1.fsf@abra.ru>, Ilya Martynov <ilya@martynov.org> wrote:
>>I never use $#array because I think it looks ugly. Of course it is my
>>'IMHO'.
>
> Mine too.
>
> But in my experience most uses of $#array become clearer when they are
> rewritten with @array instead. For example, just today someone posted
> an article (<3bd6d2ec.77079640@news) in which:
[snip examples of code where scalar @array is clearer than $#array]
for (0 .. $#array) { # Need the index here. }
for (0 .. @array - 1) { }
It also can come in handy when you have to process a (potentially very
large, so reverse() isn't an option) array backwards, or if you need
an array slice from a certain position in the array to the end (yes,
splice can do this, but it's ugly).
I really think that there are valid uses of $#array. They are
semantically different, as you explain later on. scalar @array gives
you the number of elements, $#array gives you the last index. Use them
in your code when you mean either of these. Use @array if you want to
do something to all elements of the array, or you need to know how
many elements there are. Use $#array when you need the index of the
last element of an array.
One other thing: $#array is always a scalar, @array needs to be used
in scalar context, and sometimes this needs to be forced, which
arguably is ugly as well.
> I think I'm going to add $#array to my 'Program Repair Shop and Red
> Flags' class as a red flag: Whenever you see $#array, you should stop
> and see whether you have an opportunity to write clearer code
> involving @array instead.
I think that would be going a bit too far. Opinions on this differ. I
maintain that the two have a semantic difference, and cannot just be
used interchangeably in clearly written code. Semantically,
C<@array - 1> and C<$#array> aren't the same beast.
Yes, many people use $#array where they should be using @array in
scalar context, but lets not start using scalar @array where $#array
would do a perfectly fine job.
Martien
--
Martien Verbruggen |
| Begin at the beginning and go on till
Trading Post Australia Pty Ltd | you come to the end; then stop.
|
------------------------------
Date: Wed, 24 Oct 2001 23:55:23 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: lookingglass.pl
Message-Id: <slrn9tel7b.6ff.mgjv@verbruggen.comdyn.com.au>
On Wed, 24 Oct 2001 19:21:00 GMT,
Mark Jason Dominus <mjd@plover.com> wrote:
> In article <slrn9t3pk0.2fg.tadmc@tadmc26.august.net>,
> Tad McClellan <tadmc@augustmail.com> wrote:
>>How is @array-1 "better" than $#array ?
>
> I don't think it is. In some cases, $#array really is the best
> choice:
heh. I just responded to another post by you in this thread, from
which I got the impression that you _did_ think it was.
I was obviously wrong, which means the tone of my post was probably
wrong. The content's still ok though.
Martien
--
Martien Verbruggen |
| The world is complex; sendmail.cf
Trading Post Australia Pty Ltd | reflects this.
|
------------------------------
Date: 24 Oct 2001 15:08:22 -0700
From: kschmidt@mindspring.com (Kevin J. Schmidt)
Subject: Memory management
Message-Id: <92541e99.0110241408.373e7c57@posting.google.com>
Hi,
I have a Perl application that runs as a daemon. At various times
throughout its life it populates a hash with data and, at various
other times, deletes one or more hash entries from this hash. I've
noticed that the memory usage of the Perl process steadily increases
over time. I'd like to know if there is a way for the process to give
this memory back to the OS. I've read some posts already that lead me
to believe that this is not possible at this time, but I would like
some expert opinions. Here are some things I cannot do with my
application:
1. I cannot periodically restart the process in order to give memory
back to the OS. Barring a system crash, the process must keep running
at all times, otherwise there is a chance for data loss.
2. The use of hashes, or some other data structure, is inevitable; I
need to associative aspect of a hash.
Does anyone have any suggestions?
Thanks,
-Kevin
------------------------------
Date: 24 Oct 2001 19:22:59 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Memory management
Message-Id: <9r7m13$fpf$1@charity.cs.utexas.edu>
In article <92541e99.0110241408.373e7c57@posting.google.com>,
Kevin J. Schmidt <kschmidt@mindspring.com> wrote:
>I have a Perl application that runs as a daemon. At various times
>throughout its life it populates a hash with data and, at various
>other times, deletes one or more hash entries from this hash. I've
>noticed that the memory usage of the Perl process steadily increases
>over time.
That's odd. As long as the amount of stuff you store in the hash
doesn't grow over time, the memory used for the hash itself should
eventually stabilize.
As a test, I wrote this code insert a million different keys into a
hash and then delete them again, then repeat the process another four
times:
$key = 'aaaaaaaaaaaa';
%hash = ();
foreach my $i (1 .. 5)
{
print "starting iteration $i\n";
$keycopy = $key;
print "inserting, starting with $key\n";
for ($j = 0; $j < 1_000_000; $j++)
{
$hash{$key} = 'asdf';
$key++;
}
print "deleting\n";
for ($j = 0; $j < 1_000_000; $j++)
{
delete $hash{$keycopy};
$keycopy++;
}
print "finished with iteration $i\n";
print "Hit return...\n";
$junk = <STDIN>;
}
While running this, I measured its memory usage. It rose to 89
megabytes after the first million, but stayed the same after that.
>I'd like to know if there is a way for the process to give
>this memory back to the OS.
That's not likely to happen, but what you should be able to do is to
get Perl to reuse memory so that once values have been deleted, the
storage doesn't go back to the OS, but future Perl values reuse it.
One thing that could be happening in your situation is that you could
be exposing a weakness in Perl's garbage collection, which it turns out
is not as thorough as is possible. If you have data structures that
are self-referential (i.e. have loops), then Perl will not reclaim
them. For example, in this code Perl will reclaim the storage for $x
after it leaves the block:
{
# create a variable with a huge value
my $x = "random junk" x 1_000_000;
}
But in this code it won't:
{
# create a variable with a huge value
my $x = "random junk" x 1_000_000;
# create a self referential data structure
my (@a, @b);
push (@a, \@b);
push (@b, \@a);
# put a reference to the huge valued variable into
# the self-referential data structure
push (@a, \$x);
}
That's because @a contains a reference to @b and vice versa. Even if
external references to these values are removed, Perl sees that they
still have some sort of reference to each other and it doesn't garbage
collect them.
So, if that sounds like something you're doing, you can fix it by
breaking the cycle before the variables go out of scope. In my
example, inserting the code "$b[0] = undef;" as the last line of the
block would accomplish that.
There could be other things going on, too, but as long as you're really
destroying all your data and not using any self-referential data
structures, the memory usage of the program ought to eventually level
off. There could be various things you might be doing that would cause
it to level off to a pathologically large size, but it should
eventually level off.
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Wed, 24 Oct 2001 22:16:41 GMT
From: Larry Wilson <lk.wilson@home.com>
Subject: Need script or tool to create function call lists
Message-Id: <B7FC8BD7.24A8F%lk.wilson@home.com>
Anybody know of a perl script (or other unix tool) to analyze a bunch of
C/C++ source code files to create function call diagrams or lists of
function calls automatically? Something like this (where functionFoo is
called by functionABC, which is called by funcXYZ, and so on)...
main()......................foomain.c, line xxx
funcXYZ().................sourcefile1.cpp, line xxx
functionABC()...........sourcefile9.c, line xxx
functionFoo()........sourcefileFoo.c line xxx
main()......................foomain.c line xxx
functBozo()...............foomain.c line xxx
functionFoo()........sourcefileFoo.c line xxx
functZounds()...............sourcefileGamma.cp line xxx
functionFoo()............sourcefileFoo.c line xxx
or the reverse order (where the called function is first, followed by
calling functions) ...
functionFoo() foomain.c, xxx
functBozo() foomain.c, xxx
Actual format is not particularly important.
------------------------------
Date: Thu, 25 Oct 2001 08:06:14 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Perl and sendmail
Message-Id: <AYGB7.5$X21.297021@news.interact.net.au>
"Moitz" <meuzelaj@student.dontspam.gvsu.edu> wrote in message
news:ttdmisq86rlq8e@corp.supernews.com...
> I'm not exactly sure if this is a sendmail question or a perl question.
It's a sendmail question. Try comp.mail.sendmail
[snipped sendmail specific stuff]
------------------------------
Date: Wed, 24 Oct 2001 22:29:06 GMT
From: Tim Hammerquist <tim@vegeta.ath.cx>
Subject: Re: Perl Vs. Java
Message-Id: <slrn9teh1c.745.tim@vegeta.ath.cx>
Me parece que Tim Hammerquist <tim@vegeta.ath.cx> dijo:
[ snip ]
> Ah, hell, I don't wanna do this! Lets let Java figure this out for me!
>
> $ cat > DivZero.java
> public class DivZero {
> public static void main(String[] args) {
> int x = 1/0;
Yes, a float would've been a better choice.
> System.out.println(x);
> }
> }
> ^D
> $ javac DivZero.java # and wait...
[ snip ]
--
With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
-- Peter J. Schoenster
------------------------------
Date: Wed, 24 Oct 2001 23:03:25 GMT
From: "Rubber Ducky" <none@none.com>
Subject: Perl, MySQL, MS Access, Windows AND Linux
Message-Id: <1NHB7.8711$P4.834023@news1.cableinet.net>
Is it possible to interact with both MySQL AND MS Access at the same time
with Perl? I want it to run on both on windows and on linux. Could you
please provide SOME details of how I can acomplish such a thing! Souce code
would be ideal! I appreicate this.
--
Thanks lots RD
------------------------------
Date: Wed, 24 Oct 2001 16:31:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perl, MySQL, MS Access, Windows AND Linux
Message-Id: <3BD74F35.4AEE66A8@vpservices.com>
Rubber Ducky wrote:
>
> Is it possible to interact with both MySQL AND MS Access at the same time
> with Perl?
Yes.
> I want it to run on both on windows and on linux.
No problem.
> Could you
> please provide SOME details of how I can acomplish such a thing!
Use DBI with DBD::mysql to interact with MySQL and DBD::ODBC to interact
with MS Access and DBI::Proxy to communicate between different
machines. See http://dbi.perl.org/ for details on all of those
including FAQS on each part of what you need.
--
Jeff
------------------------------
Date: Wed, 24 Oct 2001 18:46:39 -0700
From: Richard Trahan <rtrahan@monmouth.com>
Subject: PF_INET vs. AF_INET
Message-Id: <3BD76EFF.700B7ED1@monmouth.com>
What's the difference?
The Socket module and Wall p. 144 use PF_INET, but I cannot find any
description of this value in Linux man pages or 3rd party socket
tutorials.
------------------------------
Date: 24 Oct 2001 18:47:14 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Plaintext to passwd file?
Message-Id: <9r7ju2$fiq$1@charity.cs.utexas.edu>
In article <9r7c5n$jiv$05$1@news.t-online.com>,
Steffen Müller <tsee@gmx.net> wrote:
>"Mark Jason Dominus" <mjd@plover.com> schrieb im Newsbeitrag
>news:3bd6ffa8.9ba$3cf@news.op.net...
>| This uses all the possible salts in order until each one has been
>| used, and then starts over.
>I have been using a random salt in the past. (Usually only for few
>passwords, but the general issue remains valid.) Can you tell me why a
>predictable exhaustion of all possible salts is preferred over random
>selection? I bet I just don't really understand the underlying concept and
>will dig into the matter a little further anyway.
crypt() is a one-way function. This means that if A = crypt(B), it's
easy to compute A given B, but it's really hard to compute B given A.
In other words, it's easy to encrypt passwords but very difficult to
decrypt them. (I believe there's no known direct way to simply compute
B given A; you have to use brute force.)
So, most attacks against password files are dictionary attacks. A
dictionary attack in this case means you know A, and you try to find B
by making several educated guesses at B and checking to see if one of
them is correct. With password files, you try things that people
commonly use as passwords, like first names and words in the
dictionary.
What does this have to do with salts?
Well, imagine you have a whole list of users and you want to guess any
passwords you can. You could take each individual encrypted password
and try to guess it in isolation from the rest, but a more efficient
solution is to take your guess, encrypt it, and see if it matches *any*
of the encrypted passwords. That way, if you have 1000 words that you
think might have been used as a password, you only have to encrypt them
each once and you can check if any of the users used that word.
The reason salts exist is to make that optimization either useless or
at least much less useful. The salt is a piece of data that is used to
modify the encryption process, so that encrypting with two different
salts actually means you're using two different (although related)
encryption functions.
If no two passwords in your list have been encrypted with the same
salt, then to check if a string matches any of the users' passwords,
you must encrypt it again and again, once for each user. If they all
had the same salt, you'd be able to encrypt it just once and compare to
the entire list. (And comparing a fixed string to n strings can be
done in O(1) execution time (using a hash), whereas encrypting n times
is O(n).)
So the point of enumerating salts instead of picking them at random is
to ensure that there are no duplicate salts, which would make the
attacker's job easier.
As an aside, I'll point out that while random really isn't that bad,
it's not that good either. The chances of having a duplicate salt are
pretty high, even with only a small number of passwords stored in the
file. On the other hand, the chances of having all of the salts
exactly the same are really quite small...
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Wed, 24 Oct 2001 15:58:29 -0700
From: "Eric McDaniel" <ericm@vertical.com>
Subject: Problems with B::CC
Message-Id: <3bd74786$0$6202$4c41069e@reader1.ash.ops.us.uu.net>
I am trying to compile a very simple program into a Win32 executable:
print "Hello world!\n";
I've run my hello.pl source file through perlcc (I've also tried a straight
"perl -MO=CC" with the same end result). It generates the expected hello.c
file, which I can then compile into a hello.exe using MSVC 6.0 with no
warnings or errors. So far so good.
However, when I try to run hello.exe, I get an access violation at the
following line in perl_init():
av_store(CvPADLIST(PL_main_cv),0,SvREFCNT_inc((AV*)&sv_list[0]));
I realize this is a long shot, but... from the information given, can anyone
see what I'm doing wrong? My perl distribution is ActivePerl v5.6.1 build
629.
------------------------------
Date: Wed, 24 Oct 2001 23:33:21 GMT
From: "Steve in Phx" <two_wheeled@hotmail.com>
Subject: syntax help?
Message-Id: <5dIB7.45055$B72.11147718@news1.rdc1.az.home.com>
I'm new and struggling with perl. Will someone help me with this syntax?
I need to modify the following code.
Currently I'm modifying a program that pulls in fields from a file,
separates them and uses them later on.
Here is an example of what it reads in:
name:My Name
application:AppNameHere
email:myemail@mysite.com
add:filename.suf
add:myoraprc.prc ds01,p3shr;ds01,p3hmr;ds01,p3wye
I want to modify it to read in one more "server" field as a variable in the
"add:" line, like this:
name:My Name
application:AppNameHere
email:myemail@mysite.com
add:server:filename.suf
addserver::myoraprc.prc ds01,p3shr;ds01,p3hmr;ds01,p3wye
Here is my current code:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
while(<TCF_FILE>) {
$member = $_;
if ($member =~ /^\s*$/) { next; }
chomp();
$member =~ s/\s+/ /g;
$member =~ s/^\s+|\s+$//g;
($action, $member, $parms) = split(/:/,
$member);
($member, $parms) = split(/ /,
$member);
if ( $action eq "application" ) {
$self->{'TCF_APP_NAME'} =
$member;
}
if ( $action eq "name" ) {
$self->{'CONTACT_NAME'} =
$member . " " . $parms;
}
if ( $action eq "email" ) {
$self->{'CONTACT_EMAIL'} =
$member;
}
if ( $action eq "add" || $action eq "change"
|| $action eq "delete" ) {
my($type) = $member;
$type =~ s/^.*(\.\w+).*$/$1/;
$type =~ s/^\s*(\w+(?!.))/.none/;
#Adds ".none" to files wo/ ext.
my($object) = tcf_obj->new(
'SRC_FILE_NAME' => $member,
'TYPE' => $type,
'ACTION' => $action,
'PARMS' => $parms,
#'TCF_APP_NAME' => $self->{'TCF_APP_NAME'},
#'CONTACT_NAME' => $self->{'CONTACT_NAME'},
#'CONTACT_EMAIL' => $self->{'CONTACT_EMAIL'},
);
= = = = = = = = = = = = = = = = = = = = = = = = =
If you can help me, how can I modify these lines to retrieve the extra field
from my input file?
Thanks in advance!
-Steve in Phx.
------------------------------
Date: 24 Oct 2001 18:55:59 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Transfer to & from remote machine using telnet
Message-Id: <9r7kef$fki$1@charity.cs.utexas.edu>
In article <RTGB7.40672$p64.2568292@wagner.videotron.net>,
Mina Naguib <spam@thecouch.homeip.net> wrote:
>
>"Anand Ramamurthy" <anand_ramamurthy@yahoo.com> wrote in message
>news:761041e6.0110241342.32afddac@posting.google.com...
>> I have need to tansfer file(s) to & froma remote machine using through
>telnet
>> (not ftp or any other means). Is this possible? If yes, is there an
>example
>> perl script for the same.
>
>Telnet is not a file transfer protocol. The simple answer is no.
>
>However, telnet is an established tcp/ip connection between two machines, so
>theoretically with the right client pumping stuff out to STDOUT on the
>telnet server, and the right client capturing that output as the telnet
>client, and some exhausting error checking,
Aw, it's not that hard. You don't need error checking, since error
checking should be happening at the TCP stream level.
Last time I found myself in this situation, I was using two Unix
machines, so I simply did this:
1. Type "uuencode myfile myfile > myfile.uu" on the remote machine.
2. Turn on the "Log to File" option in xterm.
3. Type "cat myfile.uu".
4. Turn off the "Log to File" option in xterm.
5. Edit the logfile, delete extra stuff at beginning/end,
and type "uudecode logfile".
Probably the easiest way to pull this off these days would be to use
something like Z-Modem or Kermit, which we used to use on modems back
before PPP existed (and when SLIP was not yet popular).
In fact, C-Kermit is still being actively maintained. See
http://www.columbia.edu/kermit/ .
None of this really helps with a Perl solution, but since Kermit should
do the job and since it has already been implemented (and since
searches at CPAN don't turn up anything kermit-related), that's the
tool I'd use.
And if I chose to implement something myself in Perl, I'd try to
implement a minimal version of Kermit, since they've been working the
bugs out of it for 17 years now...
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Wed, 24 Oct 2001 23:14:42 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: What's wrong with File::Find
Message-Id: <3BD74A01.C3A62D5B@acm.org>
Mark Jason Dominus wrote:
> >find(sub { mysub(@myargs) }, '/', '/tmp');
>
> It has the same effect because it is the same suggestion. You are
> using a closure, as Alexander suggested.
Not all anonymous subs are closures. In this case, there's no binding
to a lexical variable outside any caller's scope; @myargs is passed
by value.
-- Dave Tweed
------------------------------
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.
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 2002
***************************************