[19969] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2164 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 20 14:06:01 2001

Date: Tue, 20 Nov 2001 11:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006283112-v10-i2164@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 20 Nov 2001     Volume: 10 Number: 2164

Today's topics:
        Absolute newbie question: Which book? <davidw@bainbridge.net>
    Re: Absolute newbie question: Which book? <vfoitzik@gmx.net>
    Re: Absolute newbie question: Which book? <camerond@mail.uca.edu>
    Re: Absolute newbie question: Which book? (Tad McClellan)
    Re: Absolute newbie question: Which book? <echang@netstorm.net>
        Can I avoid 2 passes? (Drew Myers)
    Re: Can I avoid 2 passes? <echang@netstorm.net>
    Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
        elsif problems (Matt)
        EOF testing <ericd_@hotmail.com>
    Re: EOF testing <vfoitzik@gmx.net>
    Re: EOF testing <cp@onsitetech.com>
    Re: EOF testing <Laocoon@eudoramail.com>
    Re: EOF testing <ericd_@hotmail.com>
        File locking question <J.E.J.opdenBrouw@st.hhs.nl>
    Re: File locking question <Laocoon@eudoramail.com>
    Re: Generating graphs using Perl for Windows <andrew_harton@agilent.com>
    Re: Generating graphs using Perl for Windows <simon.oliver@umist.ac.uk>
        how to calculate the CRC of a string... <no_mto@hotmail.com>
    Re: how to calculate the CRC of a string... <ilya@martynov.org>
    Re: Just wondering ... why is there no "since" informat <mgjv@tradingpost.com.au>
        LWP documentation gap: URL-encoded parameters? <kj345@lycos.com>
    Re: LWP documentation gap: URL-encoded parameters? <flavell@mail.cern.ch>
    Re: LWP documentation gap: URL-encoded parameters? nobull@mail.com
        multi platform perl-tcp/ip <robsjobs@hotmail.com>
        MX records. <rvdb@comweb.nl>
    Re: Newbie module problem <dover@nortelnetworks.com>
    Re: Newbie question regarding date manipulation <no@email.com>
    Re: Newbie question regarding date manipulation <andrew_harton@agilent.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 20 Nov 2001 07:30:25 -0800
From: "David Warren" <davidw@bainbridge.net>
Subject: Absolute newbie question: Which book?
Message-Id: <tvktlk1upibcc6@corp.supernews.com>

I want to learn Perl. I have the ActiveShare distribution installed on my
Windows system. Now I'd like to know whether to buy Learning Perl, 3rd Ed.
(pub. 2000) or Learning Perl on Win32 Systems (pub. 1997). Thanks for any
helpful advice.




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

Date: Tue, 20 Nov 2001 17:06:00 +0100
From: Victor Foitzik <vfoitzik@gmx.net>
Subject: Re: Absolute newbie question: Which book?
Message-Id: <MPG.16649dd353c22885989687@news.cis.dfn.de>

In article <tvktlk1upibcc6@corp.supernews.com>, David Warren wrote:

> I want to learn Perl. I have the ActiveShare distribution installed on my
> Windows system. Now I'd like to know whether to buy Learning Perl, 3rd Ed.
> (pub. 2000) or Learning Perl on Win32 Systems (pub. 1997). Thanks for any
> helpful advice.

IMHO it is better to buy the Camel-Book first (Learning Perl, 3rd 
Edition). It contains a lot of platform independent information and it 
is a good overall introduction to programming in Perl. The platform 
dependent stuff is quite good hidden in perl, so you'll not run in many 
troubles. If you become familiar with Perl, The ActiveState 
documentation will then help you finding out the Win32 specific issues.

HTH
Vic


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

Date: Tue, 20 Nov 2001 10:22:14 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Absolute newbie question: Which book?
Message-Id: <3BFA8336.A122DB41@mail.uca.edu>

Sorry, I haven't seen the original article yet, so I'm just replying to
the followup.

Victor Foitzik wrote:
> 
> In article <tvktlk1upibcc6@corp.supernews.com>, David Warren wrote:
> 
> > I want to learn Perl. I have the ActiveShare distribution installed on my
> > Windows system. Now I'd like to know whether to buy Learning Perl, 3rd Ed.
> > (pub. 2000) or Learning Perl on Win32 Systems (pub. 1997). Thanks for any
> > helpful advice.
> 
> IMHO it is better to buy the Camel-Book first (Learning Perl, 3rd
> Edition). It contains a lot of platform independent information and it
> is a good overall introduction to programming in Perl. The platform
> dependent stuff is quite good hidden in perl, so you'll not run in many
> troubles. If you become familiar with Perl, The ActiveState
> documentation will then help you finding out the Win32 specific issues.

I beg to differ. If you're just starting out, and particularly if you
just have experience on Windows, get LPW32S (the Gecko book), because
there is a good bit of stuff in the LLama (not the Camel) that is
confusing to a Window$ user, and it is NOT pointed out that is it
specific to *x. The newer stuff in 5.6 can be discovered after you have
mastered the basics.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Tue, 20 Nov 2001 16:52:39 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Absolute newbie question: Which book?
Message-Id: <slrn9vkvv4.ksl.tadmc@tadmc26.august.net>

Victor Foitzik <vfoitzik@gmx.net> wrote:

>IMHO it is better to buy the Camel-Book first (Learning Perl, 3rd 
>Edition).


"Learning Perl" is the Llama book.

"Programming Perl" is the Camel book.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Tue, 20 Nov 2001 17:17:31 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Absolute newbie question: Which book?
Message-Id: <Xns915F7E189AE0Fechangnetstormnet@207.106.93.86>

"David Warren" <davidw@bainbridge.net> wrote in
news:tvktlk1upibcc6@corp.supernews.com: 

> I want to learn Perl. I have the ActiveShare distribution installed
> on my Windows system. Now I'd like to know whether to buy Learning
> Perl, 3rd Ed. (pub. 2000) or Learning Perl on Win32 Systems (pub.
> 1997). Thanks for any helpful advice.

_Learning Perl_, 3rd Edition, is a sound introduction to Perl basics. 
It still has a hint of a Unix flavor to it, but not enough to be a 
problem.

_Elements of Programming with Perl_ (Andrew Johnson, Manning press) is 
also an excellent introduction.  It starts off gently yet leads into 
some of the advanced topics such as references and objects.

If it's an option, get both.

-- 
EBC


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

Date: 20 Nov 2001 06:54:27 -0800
From: bh_ent@hotmail.com (Drew Myers)
Subject: Can I avoid 2 passes?
Message-Id: <d1b6a249.0111200654.40aceba@posting.google.com>

I'm writing a small perl program to parse the contents of a Unix
/etc/passwd file into a hash.  I'm using a split to separate the
fields in /etc/passwd, but I actually just want to split the first one
(the login name), and then dump the remaining fields into a scalar to
form the value portion of the hash.

#!/usr/bin/perl -w
use strict;

my $userlist = &BuildUserList();

sub BuildUserList {
  open (EP,"</etc/passwd") || die "Can't fork open EP: $!\n";
  my %users = ();
  while (<EP>) {
    chomp;
    my ($user,$pass,$uid,$gid,$gecos,$home,$shell) = (split':');
    $users{$user} = join(':',$pass,$uid,$gid,$gecos,$home,$shell);
  }
  close (EP) || die "Can't fork close EP: $!\n";
  return \%users;
}

Effectively, I'd like to combine the split and join statements above,
but I'm not sure exactly how to do that, or if it's even a viable
solution.

TIA,
Drew Myers


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

Date: Tue, 20 Nov 2001 15:50:37 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Can I avoid 2 passes?
Message-Id: <Xns915F6F5C66FF9echangnetstormnet@207.106.93.86>

bh_ent@hotmail.com (Drew Myers) wrote in
news:d1b6a249.0111200654.40aceba@posting.google.com: 

> I'm writing a small perl program to parse the contents of a Unix
> /etc/passwd file into a hash.  I'm using a split to separate the
> fields in /etc/passwd, but I actually just want to split the first
> one (the login name), and then dump the remaining fields into a
> scalar to form the value portion of the hash.

[snip]

>     my ($user,$pass,$uid,$gid,$gecos,$home,$shell) = (split':');
>     $users{$user} = join(':',$pass,$uid,$gid,$gecos,$home,$shell);

[snip]

> Effectively, I'd like to combine the split and join statements
> above, but I'm not sure exactly how to do that, or if it's even a
> viable solution.

split takes an optional third argument that limits the number of 
fields.  

my ($user, $rest) = split (/:/, $_, 2);
$users{$user} = $rest;

-- 
EBC


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

Date: Tue, 20 Nov 2001 08:05:38 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3BFA7F52.3E855AAA@stomp.stomp.tokyo>

Drew Myers wrote:

(snipped)

 
> I'm writing a small perl program to parse the contents of a Unix
> /etc/passwd file into a hash.  I'm using a split to separate the
> fields in /etc/passwd, but I actually just want to split the first one
> (the login name), and then dump the remaining fields into a scalar to
> form the value portion of the hash.

 
>   while (<EP>) {
>     chomp;
>     my ($user,$pass,$uid,$gid,$gecos,$home,$shell) = (split':');
>     $users{$user} = join(':',$pass,$uid,$gid,$gecos,$home,$shell);
>   }

> I'd like to combine the split and join statements above


You will discover my test script below my signature to
be relatively quick and efficient for your task. However,
a simple associative array would be more efficient. A
hash should be a second choice to an array method for
most programming circumstances. What you do later in 
your program would be a deciding factor on which, 
an array or a hash, would be best to use.

Preparative logic should be foremost in your mind when
programming. I often, almost always, see a failure of
regulars here to use, less understand, preparative logic.
This is the nature of Language Lawyers rather than the
nature of real programmers.


Godzilla!
--

TEST SCRIPT:
____________

#!perl

while (<DATA>)
 { $Users{substr ($_, 0, index ($_, ":"))} = substr ($_, index ($_, ":") + 1); }

print "@{[ %Users ]}";


__DATA__
user1:pass1:uid1:gid1:gecos1:home1:shell1
user2:pass2:uid2:gid2:gecos2:home2:shell2



PRINTED RESULTS:
________________

 user1 pass1:uid1:gid1:gecos1:home1:shell1
 user2 pass2:uid2:gid2:gecos2:home2:shell2


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

Date: 20 Nov 2001 10:51:59 -0800
From: linuxnb@yahoo.com (Matt)
Subject: elsif problems
Message-Id: <429a5a3b.0111201051.2aaf3df@posting.google.com>

OK, I just don't get it. What am I missing here. I'm a total newbie to
PERL. I have a script with some nested if-elsif-else statements. The
script fails when I use elsif, but works fine if I change them all to
if's. Here are the two almost identicle scripts(actually this file is
called from another script using 'require'). Thanks in advance for any
help.

###############################################################################
sub mytrdt 
{
my ($dt,$type)=@_;

if ($type ne "d" && $type ne "t")
{
      $RE="mytrdt: second argument must be 'd' or 't'\n\n";	
} 
else 
{      
	if ($type eq "d") 
	{  
		my @d=split(/-/,$dt);
		$RD="$d[1]/$d[2]/$d[0]";
	}
	else
	{
		my @t=split(/:/,$dt);
		my $h=$t[0];
		my $ampm;
		if ( $h > 0  && $h < 12 ) 
		{
	     		$ampm="AM";
	     		$h=~s/0//;	
	     	}
	  	elsif ( $h > 12 ) 
		{
	     		$ampm="PM";
	     		$h-=12;
	     	}
	  	elsif ( $h == 12 ) 
		{
	     		$ampm="PM";
	     	}
	  	else ( $h == 0 ) 
		{
	     		$ampm="AM";
	     		$h=12;
	     	}
	
	$RT="$h:$t[1] $ampm";
        
	}
}
}      
1;
##############################################################################
##############################################################################
sub mytrdt 
{
my ($dt,$type)=@_;

if (($type ne "d") && ($type ne "t"))
{
      $RE="mytrdt: second argument must be 'd' or 't'\n\n";	
} 
else 
{      
	if ($type eq "d") 
	{  
		my @d=split(/-/,$dt);
		$RD="$d[1]/$d[2]/$d[0]";
	}
	else
	{
		my @t=split(/:/,$dt);
		my $h=$t[0];
		my $ampm;
		if (($h > 0) && ($h < 12)) 
		{
	     		$ampm="AM";
	     		$h=~s/0//;	
	     	}
	  	if ( $h > 12 ) 
		{
	     		$ampm="PM";
	     		$h-=12;
	     	}
	  	if ( $h == 12 ) 
		{
	     		$ampm="PM";
	     	}
	  	if ( $h == 0 ) 
		{
	     		$ampm="AM";
	     		$h=12;
	     	}
	
	$RT="$h:$t[1] $ampm";
        
	}
}
}      
1;
##############################################################################

The second one works fine, but the first gets me this:

syntax error at mytrdt4.pl line 47, near "else ("
syntax error at mytrdt4.pl line 57, near "}"
Compilation failed in require at follow.pl line 4.

HUH???

Thanks -- Matt


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

Date: Tue, 20 Nov 2001 11:07:08 -0500
From: "Eric D." <ericd_@hotmail.com>
Subject: EOF testing
Message-Id: <W6vK7.8921$i61.1796753@news20.bellglobal.com>

I use this line to read a line:

$line = <FILE>;

and I want to test $line to see if it's End of File.

How do I do that?

if ($inline eq ????????)

Note I don't want to use

while ($line = <FILE>)

to do the testing. (There is a reason).

I tried

if (!eof())

and that doesn't seem to work.





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

Date: Tue, 20 Nov 2001 17:17:25 +0100
From: Victor Foitzik <vfoitzik@gmx.net>
Subject: Re: EOF testing
Message-Id: <MPG.1664a07de5c2bb25989689@news.cis.dfn.de>

In article <W6vK7.8921$i61.1796753@news20.bellglobal.com>, Eric D. 
wrote:

> I use this line to read a line:
> 
> $line = <FILE>;
> 
> and I want to test $line to see if it's End of File.
> 
> How do I do that?
> 
> if ($inline eq ????????)
> 
> Note I don't want to use
> 
> while ($line = <FILE>)
> 
> to do the testing. (There is a reason).
> 
> I tried
> 
> if (!eof())
> 
> and that doesn't seem to work.

the line you read will be undefined at eof, you need something like:

while (1) {
	$line = <FILE>;
	last unless defined $line;
	# ...
}

see perldoc perlop, section I/O Operators

HTH
Vic


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

Date: 20 Nov 2001 16:23:55 GMT
From: "Curtis Poe" <cp@onsitetech.com>
Subject: Re: EOF testing
Message-Id: <9te02r$idi@dispatch.concentric.net>

"Eric D." <ericd_@hotmail.com> wrote in message
news:W6vK7.8921$i61.1796753@news20.bellglobal.com...
> I use this line to read a line:
>
> $line = <FILE>;
>
> and I want to test $line to see if it's End of File.
>
> How do I do that?
>
> if ($inline eq ????????)
>
> Note I don't want to use
>
> while ($line = <FILE>)
>
> to do the testing. (There is a reason).
>
> I tried
>
> if (!eof())
>
> and that doesn't seem to work.

This should work:

if ( ! eof FILE )

See 'perldoc -f eof'.

Incidentally, you wrote that there was a reason you wanted to use this
method, but you didn't mention the reason.  May I ask what it is?  Only once
have I ever seen anyone use eof() as the best solution.
--
Cheers,
Curtis Poe
Senior Programmer
ONSITE! Technology
www.onsitetech.com
503.233.1418




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

Date: Tue, 20 Nov 2001 17:24:25 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: EOF testing
Message-Id: <Xns915FB117860C7Laocooneudoramailcom@62.153.159.134>

Read 
perldoc -f eof

if(!eof) 


Note missing brackets!

Lao


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

Date: Tue, 20 Nov 2001 12:52:36 -0500
From: "Eric D." <ericd_@hotmail.com>
Subject: Re: EOF testing
Message-Id: <NFwK7.9035$i61.1841131@news20.bellglobal.com>

Thanks a lot guys!

Reason I use $line = <FILE> instead of while ($line = <FILE>) is I need to
do something before I read the line.

Thanks again,
Eric




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

Date: Tue, 20 Nov 2001 15:55:56 +0100
From: "J.E.J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl>
Subject: File locking question
Message-Id: <3BFA6EFC.DE0C41C9@st.hhs.nl>


Hi,

does anyone know how to lock a file move?

file A -> file B

File A is read and then removed, file B is written.
A simple 'mv' is not sufficient, is it?

-- 
--jesse
----------------------------------------------------------------------
J. op den brouw                             Johanna Westerdijkplein 75
Haagse Hogeschool                                    2521 EN  DEN HAAG
Sector Techniek                                        The Netherlands
Opleiding Elektrotechniek                               +31-70-4458936
----------------------------------------------------------------------

"Programmers are busy writing the next best idiot-proof software.
 The universe, in the meantime, is busy making the best idiot.
 The universe is winning"
   -- Linux Journal


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

Date: Tue, 20 Nov 2001 17:33:46 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: File locking question
Message-Id: <Xns915FB2AE029D2Laocooneudoramailcom@62.153.159.134>

Is this a Perl question? If it is..

example :

open(IN,"input") or die "Input : $!";
open(OUT,">output") or die "Output : $!";
$in = join "" , <IN>;
close(IN);
`del input`;
print OUT $in;
close(OUT);



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

Date: Tue, 20 Nov 2001 15:44:37 -0000
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Re: Generating graphs using Perl for Windows
Message-Id: <1006271093.981053@cswreg.cos.agilent.com>


"Simon Oliver" <simon.oliver@umist.ac.uk> wrote in message
news:3BFA5CFC.4BF0104B@umist.ac.uk...
> Try GD and GD::Graph
>
> Here's an example:
>
> use GD::Graph::bars;
> my @data = ( [('a'..'j')], [(1..10)] );
> my $graph = GD::Graph::bars->new(200, 200);
> my $gd = $graph->plot(\@data);
> binmode STDOUT;
> print "Content-type: image/jpeg\n\n";
> print $gd->jpeg(100);
>
> Save this as /cgi-bin/graph.pl and then add this to your html:
>
> <IMG src="/cgi-bin/graph.pl">
>

One problem with that is that it requires the GD libraries, which in turn
require png libraries, zlib libraries, and jpeg libraries (and so on, it
seems).  I was hoping to steer clear of all of that, since
1) I have no real experience of installing and linking libraries
and
2) I was hoping for something that could be easily sent out to others
without requiring them to do anything more than put one or two files in the
appropriate places - the simpler the better.

If there isn't a more straightforward way to do it, though, I will try to
get your suggestion working.

Thanks,

Andrew




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

Date: Tue, 20 Nov 2001 16:57:55 +0000
From: Simon Oliver <simon.oliver@umist.ac.uk>
To: Andrew Harton <andrew_harton@agilent.com>
Subject: Re: Generating graphs using Perl for Windows
Message-Id: <3BFA8B93.B4B36672@umist.ac.uk>

Andrew Harton wrote:
> One problem with that is that it requires the GD libraries, which in turn
> require png libraries, zlib libraries, and jpeg libraries (and so on, it
> seems).  I was hoping to steer clear of all of that, since
> 1) I have no real experience of installing and linking libraries

But GD is available from ActiveState via ppm.  No linking, no compiling:

>ppm search GD
Packages available from
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer:
GD          [1.27.2] Interface to Gd Graphics Library
GD-Barcode  [1.13  ] Create barcode image with GD
GDGraph     [1.33  ] Graph Plotting Module for Perl 5
GDGraph-Map [1.03  ] generate HTML map text for GD::Graph diagramms.
GDGraph3d   [0.55  ] Create 3D Graphs with GD and GD::Graph
GDTextUtil  [0.80  ] text utilities for GD

--
  Simon Oliver


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

Date: Tue, 20 Nov 2001 19:02:25 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: how to calculate the CRC of a string...
Message-Id: <9te65e$2jn4$1@news.kabelfoon.nl>


Hi there,

How can I calculate the CRC of a string?...
(it doesn't matter if it is a crc16 or crc32)




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

Date: 20 Nov 2001 21:25:42 +0300
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: how to calculate the CRC of a string...
Message-Id: <87r8qtl2op.fsf@abra.ru>

>>>>> On Tue, 20 Nov 2001 19:02:25 +0100, "MAGiC MANiAC^mTo" <no_mto@hotmail.com> said:

MAGiC> Hi there,
MAGiC> How can I calculate the CRC of a string?...
MAGiC> (it doesn't matter if it is a crc16 or crc32)

Have you tried to look on CPAN?

    http://search.cpan.org/search?mode=module&query=CRC

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)          TIV.net (http://tiv.net/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Wed, 21 Nov 2001 00:56:17 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Just wondering ... why is there no "since" information in the man   pages?
Message-Id: <slrn9vko80.mfo.mgjv@martien.heliotrope.home>

On Tue, 20 Nov 2001 13:03:04 +0100,
	Edwin Günthner <edgue@web.de> wrote:
> Martien Verbruggen wrote:
> 
>> While I can see how it could be useful to have some of this history in
>> the documentation, I am afraid it would make the documentation also
>> quite messy. Many features/functions/syntactical sugar crept in in
>> various versions and subversions of Perl. 
> 
> Isnt that a very good argument FOR providing this information in ONE
> place? What is more complicated:
> * to develop a feature and document its history through time (in 
>   the place where the feature itself is documented) OR

$ man perldelta perl5005delta perl5004delta

:)

Wat I meant to say is that the documentation would get very messy with
interruptions every 10 sentences in the order of 'first appeared in
version 3, added more arguments in version 4, semantics changed in
version 5.004_01, deprecated as of version 5.6.0'. There would be quite
a few of these, even though they wouldn't all be as verbose.

> * to create this information AFTERWARDS - when the whole stuff is
>   already messed up?

I'd probably prefer to have separate documentation about changes. Perl
isn't like Java, where the language and the JDK are separate, and where
there have only been two releases of the language, and only a few
releases of the JDK and its classes. There have only been two releases
of the C standard and the standard libraries. C++ has only seen one
standard release (IIRC). Even the venerable fortran hasn't seen that
many. 

Perl is a much more gradually, slowly, and most of all organically
evolving language tied in very tightly with its API and functionality.
There is no language specification that gets heavily and formally
discussed by people and written down and submitted to some standards
body (be it national, international or internal to a company).  The
documentation of Perl is also not as neatly structured as the
documentation of the JDK or the specification of C's standard libraries.
It's more a mix of various aspects of the language spread out over
various documents, intermingled with examples, API discussions, platform
specific digressions, pointers to other documents etc.

To annotate every change in the documention, even if you did it at the
moment that it happened, would make it very hard to read. The only place
where I can see this would work would be perlfunc. Oh, and maybe in the
standard modules that appear with the Perl distribution. But I still say
that a quick one-line test with the appropriate binary is just as easy.
History in the documentation would be mainly interesting for the
curious.

Martien
-- 
                        | 
Martien Verbruggen      | 
                        | The gene pool could use a little chlorine.
                        | 


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

Date: 20 Nov 2001 12:57:10 -0500
From: kj <kj345@lycos.com>
Subject: LWP documentation gap: URL-encoded parameters?
Message-Id: <9te5hm$42a$1@panix3.panix.com>





In the LWP doc it says:

  The library supports ftp ASCII transfer mode by specifying the
  "type=a" parameter in the URL.

 ...but nowhere it says the exact syntax of this URL-encoding of
parameters.  I looked everywhere I could think of for the answer to
this question and found nothing.  I tried several "obvious" ones, such
as

  HTTP::Request->new(GET => 'ftp://some.site.com/pub/foobar.txt/type=a');

and

  HTTP::Request->new(GET => 'ftp://some.site.com/pub/foobar.txt?type=a');

but they all failed.

Where is the right format for these URL-encoded parameters documented?

Is it just my imagination, or the LWP modules are in fact very poorly
documented?  Have I missed some major documentation stash somewhere?
I realize that the LWP modules are user-written and user-supported, so
my intent is not to rag on the documentation; I just want to confirm
that my inability to find the answer to such a simple question doesn't
just reflect great ignorance on my part.

Thanks,

KJ


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

Date: Tue, 20 Nov 2001 19:08:37 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: LWP documentation gap: URL-encoded parameters?
Message-Id: <Pine.LNX.4.30.0111201907430.6241-100000@lxplus023.cern.ch>

On Nov 20, kj inscribed on the eternal scroll:

> In the LWP doc it says:
>
>   The library supports ftp ASCII transfer mode by specifying the
>   "type=a" parameter in the URL.
>
> ...but nowhere it says the exact syntax of this URL-encoding of
> parameters.

http://www.google.com/search?q=URL+RFC+type%3Da  wasn't so hard.

(One wonders what made you suppose this to be a Perl language
question?)



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

Date: 20 Nov 2001 18:47:38 +0000
From: nobull@mail.com
To: kj <kj345@lycos.com>
Subject: Re: LWP documentation gap: URL-encoded parameters?
Message-Id: <u98zd1s2id.fsf@wcl-l.bham.ac.uk>

"Alan J. Flavell" <flavell@mail.cern.ch> writes:

> On Nov 20, kj inscribed on the eternal scroll:
> 
> > In the LWP doc it says:
> >
> >   The library supports ftp ASCII transfer mode by specifying the
> >   "type=a" parameter in the URL.
> >
> > ...but nowhere it says the exact syntax of this URL-encoding of
> > parameters.
> 
> http://www.google.com/search?q=URL+RFC+type%3Da  wasn't so hard.
> 
> (One wonders what made you suppose this to be a Perl language
> question?)

More specifically KJ supposed this to be a Perl language question not
covered by any more specific group within comp.lang.perl.* and yet at
the same time, but independantly a Perl module question and therefore
on-topic in comp.lang.perl.modules.

KJ, you can be forgiven for a lapse of brain function that made you
think that the structure of URLs would appropriately be documented in
the LWP documentation.

You _cannot_ be forgiven for posting the same question, separately, to
multiple groups (spamming).

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 20 Nov 2001 18:41:56 GMT
From: "Rob" <robsjobs@hotmail.com>
Subject: multi platform perl-tcp/ip
Message-Id: <UtxK7.113771$zK1.29050665@typhoon.tampabay.rr.com>

I have a need to monitor a running perl program so I can periodically (every
~ 2 mins) report it's status (runnning, hung, dead, etc.) via servers alive.

The program interacts with (insert your DB here ie. Oracle, Sybase, Sql
Server etc.) and obtains a list of files to push via ftp to client machines.
This program is in perl using DBI.  I am changing this to run as a full time
process with configurable timing for each iteration of the processing.  This
would be like running the program, which spawns a child which does the work,
sleeps, does the work, sleeps, etc...  During each step in doing the work,
it would communicate with the parent about it's status.  The parent process
would then be queried from time to time by the servers alive agent (which I
am writing also.)  I am thinking that IPC and TCP/IP would work well but I
may have a need for the agent to be on another machine in future
deployments.  Thus, I am leaning toward TCP/IP for the communications.  This
is currently running in a winblows 2k AS environment.  I am trying my best
to code this so I can 'drop' it into a running unix installation and have it
run the exact same.

Is programming for IPC easier with regards to cross platform?  Is TCP/IP
easier?  Am I going to have major issues spawning and managing child
processes in Winblows?

Any words of caution?

Thanks,

Rob




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

Date: Tue, 20 Nov 2001 19:49:08 +0100
From: "RJHM van den Bergh" <rvdb@comweb.nl>
Subject: MX records.
Message-Id: <tvl9eclft74mf0@corp.supernews.com>

How do I determine the MX record of a domain with Perl on NT servers.

The problem is the user only does have an account with a Perl but he can't
install things on the server.
I'm not that familiar with Perl only some simple CGI script writing.

On UNIX it isn't a problem simply call the standard dig (or nslookup)
program and read its output through a pipe.
Or simply call sendmail (perhaps with simply using bacticks)

However I don't know a way to do it on Windows NT.

Thanks for any reply
Rob,
rvdb@comweb.nl







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

Date: Tue, 20 Nov 2001 10:15:24 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: Newbie module problem
Message-Id: <9tdvlp$a9n$1@bcarh8ab.ca.nortel.com>

"Perry Wheeler" wrote...
>
> OK I understand that it's a path problem and you're right - the @INC I
> get as a scheduled job is totally different to the one I get when
> running it in a shell it clearly refers back to a much earlier perl
> version.
>
>  use lib '/usr/local/lib/perl5/site_perl/5.6.1';
>
> This works for the call to finance::quote but falls ...

I'm sure someone will provide a better solution, but something you COULD do
is print out the contents of @INC and then include 'use' statements for each
path not included in the scheduled task.

Good luck!

-Bob




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

Date: Tue, 20 Nov 2001 14:27:58 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: Newbie question regarding date manipulation
Message-Id: <RLtK7.470$6W6.134324@news2-win.server.ntlworld.com>


"Brian Wakem" <no@email.com> wrote in message
news:4ItK7.459$6W6.131480@news2-win.server.ntlworld.com...
>
> --
> Brian Wakem


Whoops.  Forgot to set my clock back.

--
Brian Wakem




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

Date: Tue, 20 Nov 2001 15:17:28 -0000
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Re: Newbie question regarding date manipulation
Message-Id: <1006269460.62009@cswreg.cos.agilent.com>

"Eduard de Vries" <edevries@footlocker.com> wrote in message
news:tvknnpsbj0gm3b@corp.supernews.com...
> Hi all,
>
> I am a beginner, so excuse me if my question is simple.
> I have attached my script.
>
> What I do is generate a text file which copies various files (when run as
> the command file
>
> for an FTP-session),
> the names of the files are FOOT and then yesterdays date YYYYMMDD, that
> works.
> And on monday I download the last three days, as in today -1, -2 and -3.
>
> This works like a charm, but on the first (and second, third if it is a
> monday) it obviously
>
> goes wrong.
>
> Has anyone ever written a sequence such as if day =1 then $datum-1 = last
> day of the month.
> Last day of the month is, if month is 10 = 31, if month is 11 = 30, if
month
> is 12 =31, etc.
>
> Can anyone provide an example or point me to the right track?
>
> Thanks in advance,
>
> Eduard
>
> (Monday) script:
>
[script deleted]

Why not approach it the opposite way around?

Instead of converting the time to days, months and years and then trying to
compare it to other days, months and years it might be easier to convert the
date string of the files to seconds and then do a numerical compare on the
results.  If you want the last 3 days, you would make sure that there is
less than 3x24x60x60 (or 259200) seconds between the current date & time and
the file creation date & time.

Check out the documentation for the Time::Local module to see how to do
this.

Andrew






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

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


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