[23673] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5880 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 2 00:06:00 2003

Date: Mon, 1 Dec 2003 21:05:09 -0800 (PST)
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, 1 Dec 2003     Volume: 10 Number: 5880

Today's topics:
    Re: cannot match pattern <GlgAs@netscape.net>
        count of items in a hash <eddGallary2@hotmail.com>
    Re: count of items in a hash <nobody@dev.null>
    Re: count of items in a hash <REMOVEsdnCAPS@comcast.net>
        Display error message if an error occurs on "open" comm <nospam@nospam.com>
        First Perl Question - about sorting numeric arrays (BKennedy)
        Generating Day of Week in Pure Perl <rev@TheWaterCooler.com>
    Re: Generating Day of Week in Pure Perl <nospam@bigpond.com>
    Re: Generating Day of Week in Pure Perl <glex_nospam@qwest.invalid>
    Re: Generating Day of Week in Pure Perl <noreply@gunnar.cc>
    Re: Generating Day of Week in Pure Perl <ict@eh.org>
    Re: hash key evaluation creates an entry ! <REMOVEsdnCAPS@comcast.net>
        installing perl modules <eddGallary2@hotmail.com>
    Re: installing perl modules <jwillmore@remove.adelphia.net>
        Is there a command that will return the version of perl <someone@somewhere.nb.ca>
    Re: Is there a command that will return the version of  (Sam Holden)
    Re: Is there a command that will return the version of  (William Herrera)
    Re: Is there a command that will return the version of  <jurgenex@hotmail.com>
        net::scp::expect error (Chandrashekar Tippur)
    Re: pack, Win32 registry & binary data (Jay Tilton)
    Re: Perl et Telnet <glex_nospam@qwest.invalid>
    Re: Perl et Telnet <uri@stemsystems.com>
    Re: Perl unicode and :crlf, was Re: regexp: \x0a => \x0 <flavell@ph.gla.ac.uk>
    Re: Perl unicode and :crlf, was Re: regexp: \x0a => \x0 <usenet@morrow.me.uk>
    Re: question about installation of GD::Text on cygwin ( <mgjv@tradingpost.com.au>
    Re: question about installation of GD::Text on cygwin ( (Upstart)
    Re: redirect using location header does not work from a (Will)
    Re: redirect using location header does not work from a (Will)
        Session Management? <zmonteca@zmonteca.com>
        Starting Perl Script at Bootup <nospam@yahoo.com>
    Re: Starting Perl Script at Bootup <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 01 Dec 2003 19:05:24 GMT
From: gilgames <GlgAs@netscape.net>
Subject: Re: cannot match pattern
Message-Id: <UhMyb.8051$aw2.3437514@newssrv26.news.prodigy.com>

my $ex = '\$Conflict: ';
my $a = "field1:  test1\n\$Conflict:  1\nfield 3:  test3\x0c";
print "[$a]\n";

if ( $a =~ /$ex/ ) {
  print "found\n";
} else {
  print "not found\n";}

This is the correct. The change is in the first line here :

my $ex = '\$Conflict: ';

This way returns

[field1:  test1
$CONFLICT:  1
field 3:  test3]
found




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

Date: Tue, 02 Dec 2003 12:23:20 +1100
From: Edo <eddGallary2@hotmail.com>
Subject: count of items in a hash
Message-Id: <3FCBE988.3060006@hotmail.com>

Hello
I cann't get the count of items in %set, what am I doing wrong?

  DB<15> p %set
0.911111111111111ARRAY(0x85e30a0)1ARRAY(0x85e46e8)0.955555555555556ARRAY(0x85e4628)0.933333333333333ARRAY(0x85e3160)
   DB<16> p $#$set
-1
   DB<17> p $#%set
Operator or semicolon missing before %set at (eval 
36)[/usr/local/lib/perl5/5.8.2/perl5db.pl:618] line 2, <FL> line 7415.
         eval '($@, $!, $^E, $,, $/, $\\, $^W) = @saved;package main; 
$^D = $^D | $DB::db_stop;
print {$DB::OUT}  $#%set;

;' called at /usr/local/lib/perl5/5.8.2/perl5db.pl line 618
         DB::eval called at /usr/local/lib/perl5/5.8.2/perl5db.pl line 3314
         DB::DB called at prog/0.1-trend line 36
Ambiguous use of % resolved as operator % at (eval 
36)[/usr/local/lib/perl5/5.8.2/perl5db.pl:618] line 2, <FL> line 7415.
         eval '($@, $!, $^E, $,, $/, $\\, $^W) = @saved;package main; 
$^D = $^D | $DB::db_stop;
print {$DB::OUT}  $#%set;

;' called at /usr/local/lib/perl5/5.8.2/perl5db.pl line 618
         DB::eval called at /usr/local/lib/perl5/5.8.2/perl5db.pl line 3314
         DB::DB called at prog/0.1-trend line 36
Illegal modulus zero at (eval 
36)[/usr/local/lib/perl5/5.8.2/perl5db.pl:618] line 2, <FL> line 7415.

   DB<18>

thanks



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

Date: Tue, 02 Dec 2003 01:39:08 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: count of items in a hash
Message-Id: <3fcbed39$1@bandit2.georgetown.edu>



Edo wrote:
> Hello
> I cann't get the count of items in %set, what am I doing wrong?

scalar keys %set will give you the number of keys %set has.



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

Date: Mon, 01 Dec 2003 20:10:31 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: count of items in a hash
Message-Id: <Xns9444D7A1DA34Fsdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Edo <eddGallary2@hotmail.com> wrote in
news:3FCBE988.3060006@hotmail.com: 

> Hello
> I cann't get the count of items in %set, what am I doing wrong?
> 
>   DB<15> p %set
> 0.911111111111111ARRAY(0x85e30a0)1ARRAY(0x85e46e8)0.955555555555556ARRA
> Y(0x85e4628)0.933333333333333ARRAY(0x85e3160) 
>    DB<16> p $#$set
> -1
>    DB<17> p $#%set

I'm impressed with your creativity, anyhow.  The $# notation only works 
for arrays.  And (as you have been told before), it does NOT give you the 
count of items in an array.  It gives the index of the last item in the 
array.  There is no corresponding concept for hashes.

If you want to know how many keys there are in %set, do this:

    $count = keys %set;

or:

    print "There are ", scalar %set, " keys in %set.\n";

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP8v032PeouIeTNHoEQLCKwCfYZVyZmvjEBwF6ZW87jwNqwb3aYUAnA2V
z52YdHtZ1+aPG72TT0JmOJ2C
=yyG5
-----END PGP SIGNATURE-----


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

Date: Mon, 1 Dec 2003 18:41:51 -0800
From: "Geek" <nospam@nospam.com>
Subject: Display error message if an error occurs on "open" command
Message-Id: <3fcb8b78$1@cpns1.saic.com>

How can I get the following code to display a meaningful error message if
the "open" command doesn't succeeed?

    $blatString = "\|C:\WINNT\SYSTEM32\blat.exe
\"d:\temp\message_body.txt\" -t \"nobody@nowhere.com\" -s \"This is a
test\" -f \"nobody@nowhere.com\" -i \"Web Server\" -server mail.nowhere.com
> d:\temp\~blatoutput.txt";

    open (MAIL2, $blatString));

I'd like something that displays the actual error encountered, not just
something like this:

     $blatString = "\|C:\WINNT\SYSTEM32\blat.exe
\"d:\temp\message_body.txt\" -t \"nobody@nowhere.com\" -s \"This is a
test\" -f \"nobody@nowhere.com\" -i \"Web Server\" -server mail.nowhere.com
> d:\temp\~blatoutput.txt";

    unless (open (MAIL2, $blatString)) {
        print "<p>Can't execute Blat</p>";
        $BlatError = 1;
    }




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

Date: 1 Dec 2003 21:01:32 -0800
From: b_t_k@hotmail.com (BKennedy)
Subject: First Perl Question - about sorting numeric arrays
Message-Id: <53240d5a.0312012101.2b261184@posting.google.com>

Hello,

Well here goes my first newbie PERL question for the gurus of this
group.  My issue is with using the SORT instruction.  Below you'll
find the printed contents of 5 element array before and after a
'sorting'.  Is the 'sorting' being performed on the references and not
the contents?  I don't understand why the numbers are sometimes not in
proper sequence after the SORT. (Shouldn't the second printing of the
first array read : 5 9 13 13 14 ?)

   for $a(0..3)
   {
     for($i=0;$i<5;$i++)
       {
   	$array[$i] = int(rand(19) +1);
       }
     print("$a\t @array \n");
     @array = sort @array;  
     print("$a\t @array \n"); 
   }

Results:
  0        14 13 13 9 5 
  0        13 13 14 5 9 
  1        11 10 5 12 15 
  1        10 11 12 15 5 
  2        8 16 7 14 13 
  2        13 14 16 7 8 
  3        12 6 12 5 4 
  3        12 12 4 5 6 

Any help is appreciated.  Thanks.

-Bkennedy


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

Date: Mon, 01 Dec 2003 21:30:43 GMT
From: rev <rev@TheWaterCooler.com>
Subject: Generating Day of Week in Pure Perl
Message-Id: <7qOyb.28801$2y3.5045@newssvr29.news.prodigy.com>

I have a date formatted like so MM/DD/YYYY (e.g. 12/01/2003) and I need 
to get the day of the week from this (Monday).  But, this is occurring 
on my hosting vendor so whatever does it needs to be pure Perl.

I cannot use the POSIX package.
I cannot install any package that requires compilation.
Anything I use needs to work through the year 2100.

Any suggestions on this?

-rev



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

Date: Tue, 02 Dec 2003 07:57:32 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Generating Day of Week in Pure Perl
Message-Id: <1387280.uESWzeUTAd@gregs-web-hosting-and-pickle-farming>

It was a dark and stormy night, and rev managed to scribble:

> I have a date formatted like so MM/DD/YYYY (e.g. 12/01/2003) and I need
> to get the day of the week from this (Monday).  But, this is occurring
> on my hosting vendor so whatever does it needs to be pure Perl.
> 
> I cannot use the POSIX package.
> I cannot install any package that requires compilation.
> Anything I use needs to work through the year 2100.
> 
> Any suggestions on this?
> 
> -rev


Here's a quick solution (works for years 1900-2100) :

The two routines below work out days between dates and days of the week
Q.How may days between 15-jan-1999 and 5-jul-2003
A. date_ymd("20030715") - date_ymd("19990105");
Q . What day is 21-mar-2003.
A. weekday(date_ymd("20030321"));

sub date_ymd { my($year)=substr($_[0],0,4); my($month)=substr($_[0],4,2);
my($day)=substr($_[0],6,2); my(@months) = (0,31,59,90,120,151,181,212,243,273,304,334);
return $year*365+int(($year-1)/4)+$months[$month-1]+$day($year%4==0&&$month>=3?1:0) +5; }

sub weekday { my ($offset)=@_; my(@wday) = ( "Sun", "Mon", "Tue", "Wed", "Thu",
"Fri", "Sat" );

return $wday[$offset%7]; }


gtoomey


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

Date: Mon, 01 Dec 2003 16:06:00 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Generating Day of Week in Pure Perl
Message-Id: <pTOyb.1476$eD2.39897@news.uswest.net>

rev wrote:
> I have a date formatted like so MM/DD/YYYY (e.g. 12/01/2003) and I need 
> to get the day of the week from this (Monday).  But, this is occurring 
> on my hosting vendor so whatever does it needs to be pure Perl.
> 
> I cannot use the POSIX package.
> I cannot install any package that requires compilation.
> Anything I use needs to work through the year 2100.
> 
> Any suggestions on this?

Find Epoch seconds, using Time::Local

	perldoc Time::Local

Then use localtime() to find the day of the week

	perldoc -f localtime

Then you should easily be able to come up with Monday-Sunday by using 
that as an index on a simple array.





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

Date: Mon, 01 Dec 2003 22:59:29 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Generating Day of Week in Pure Perl
Message-Id: <bqge6i$22gimb$1@ID-184292.news.uni-berlin.de>

rev wrote:
> I have a date formatted like so MM/DD/YYYY (e.g. 12/01/2003) and I
> need to get the day of the week from this (Monday).  But, this is
> occurring on my hosting vendor so whatever does it needs to be pure
> Perl.
> 
> I cannot use the POSIX package.
> I cannot install any package that requires compilation.
> Anything I use needs to work through the year 2100.

This solution makes use of the pure Perl (and standard) module
Time::Local and the localtime() function:

     sub day {
         use Time::Local;
         my @t = split /\//, shift;
         my $time = timelocal(0,0,0,$t[1],$t[0]-1,$t[2]-1900);
         my @days = qw/Sunday Monday Tuesday
           Wednesday Thursday Friday Saturday/;
         return $days[ (localtime $time)[6] ];
     }

     my $date = '12/01/2003';
     print day($date);

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 2 Dec 2003 11:18:18 +1000
From: Iain Truskett <ict@eh.org>
Subject: Re: Generating Day of Week in Pure Perl
Message-Id: <slrnbsnmgt.ojv.ict@dellah.org>

* rev <rev@TheWaterCooler.com>:

> I cannot use the POSIX package.

Why?


cheers,
-- 
Iain.


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

Date: Mon, 01 Dec 2003 16:48:15 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: hash key evaluation creates an entry !
Message-Id: <Xns9444B557DC508sdn.comcast@216.196.97.136>

"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in 
news:Xns9443B42F5FE8Fsdn.comcast@216.196.97.136:

> Edo <eddGallary2@hotmail.com> wrote in
> news:3FCA4164.1000502@hotmail.com: 
> 
>> after 2 1/2 hr of playing around with the debugger and the code I 
>> finally got it.
>> I know some of you could have done this in 2 1/2 minuts. but I am
>> learning. the show sub below, is there a module to print out any of
>> this kind of data structure sorted already with out having to write a
>> 100 times foreach loops?   thanks
> 
> Yes, look at the Dumper module.

Er, Data::Dumper.

-- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print


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

Date: Tue, 02 Dec 2003 08:04:57 +1100
From: Edo <eddGallary2@hotmail.com>
Subject: installing perl modules
Message-Id: <3FCBACF9.5000803@hotmail.com>

Hello
I am not sure if this is ok and there is no problems

# /usr/local/bin/perl -MCPAN -e 'install "Bundle::CPAN"'
 .
 .
 .
   /usr/bin/make install  -- OK

Recursive dependency detected:
     Bundle::CPAN
  => Digest::MD5
  => G/GA/GAAS/Digest-MD5-2.31.tar.gz
  => Digest::base
  => G/GA/GAAS/Digest-1.04.tar.gz
  => Digest::MD5.
Cannot continue.
~#

that means there is a problem but why I am not getting that in the 
following command return in a way of not a complete installaion of the 
module. and if so, what should I do?  thanks

# /usr/local/bin/perl -MCPAN -e 'install "Bundle::CPAN"'
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
   Database was generated on Mon, 01 Dec 2003 06:46:40 GMT
File::Spec is up to date.
Digest::MD5 is up to date.
Compress::Zlib is up to date.
Archive::Tar is up to date.
Data::Dumper is up to date.
Net::Telnet is up to date.
Net::Cmd is up to date.
Term::ReadKey is up to date.
Term::ReadLine::Perl is up to date.
CPAN is up to date.
:~#



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

Date: Tue, 02 Dec 2003 01:11:23 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: installing perl modules
Message-Id: <20031201201122.5939d651.jwillmore@remove.adelphia.net>

On Tue, 02 Dec 2003 08:04:57 +1100
Edo <eddGallary2@hotmail.com> wrote:

> Hello
> I am not sure if this is ok and there is no problems
> 
> # /usr/local/bin/perl -MCPAN -e 'install "Bundle::CPAN"'
> .
> .
> .
>    /usr/bin/make install  -- OK
> 
> Recursive dependency detected:
>      Bundle::CPAN
>   => Digest::MD5
>   => G/GA/GAAS/Digest-MD5-2.31.tar.gz
>   => Digest::base
>   => G/GA/GAAS/Digest-1.04.tar.gz
>   => Digest::MD5.
> Cannot continue.
> ~#
> 
> that means there is a problem but why I am not getting that in the 
> following command return in a way of not a complete installaion of
> the module. and if so, what should I do?  thanks

I've gotten the same message.  If all tests during 'make test'
succeed, I've just forced the install.  

I've taken the message to indicate diamond inheritance.  In other
words, Digest::MD5 is imported twice somewhere and is done in such a
way that Perl doesn't know what else to do.  

I could be wrong.

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
The right half of the brain controls the left half of the body.  
This means that only left handed people are in their right mind. 


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

Date: Tue, 02 Dec 2003 04:26:40 GMT
From: "Guy" <someone@somewhere.nb.ca>
Subject: Is there a command that will return the version of perl?
Message-Id: <4wUyb.2716$IF6.127554@ursa-nb00s0.nbnet.nb.ca>

I am writing a perl script for someone. They gave me the address to one of
their unix servers and they created a couple of directories for me including
a cgi-bin where I can save my .cgi files (actually I was used to .pl files
but I guess they have to be .cgi on this server).

I upload my files to the server using FTP.
I can telnet to it but I think the only access I have is to my directories.

The server is about 3 hours away from here.

I was wondering, if my perl script can detect what version of perl it's
running on. whether it's perl 5.004, 5.6, or whatever.

Or is there an ENV value that I can pick up on it.

Thanks for all,

Guy Doucet




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

Date: 2 Dec 2003 04:35:16 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Is there a command that will return the version of perl?
Message-Id: <slrnbso5k4.7vc.sholden@flexal.cs.usyd.edu.au>

On Tue, 02 Dec 2003 04:26:40 GMT, Guy <someone@somewhere.nb.ca> wrote:
> 
> I was wondering, if my perl script can detect what version of perl it's
> running on. whether it's perl 5.004, 5.6, or whatever.

perldoc perlvar

Particularly the descriptions of the $] and $^V variables.

-- 
Sam Holden


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

Date: Tue, 02 Dec 2003 04:36:17 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: Is there a command that will return the version of perl?
Message-Id: <3fcc1655.179721854@news2.news.adelphia.net>

On Tue, 02 Dec 2003 04:26:40 GMT, "Guy" <someone@somewhere.nb.ca> wrote:

>I am writing a perl script for someone. They gave me the address to one of
>their unix servers and they created a couple of directories for me including
>a cgi-bin where I can save my .cgi files (actually I was used to .pl files
>but I guess they have to be .cgi on this server).
>
>I upload my files to the server using FTP.
>I can telnet to it but I think the only access I have is to my directories.
>
>The server is about 3 hours away from here.
>
>I was wondering, if my perl script can detect what version of perl it's
>running on. whether it's perl 5.004, 5.6, or whatever.
>
>Or is there an ENV value that I can pick up on it.
>
>Thanks for all,
>
>Guy Doucet
>
>

I use this one once in a while. I don't know who write it originally (anybody
else know)? I only modified it a little.


<<<<<<<<<<<<<
#!/usr/bin/perl
##  printenv -- demo CGI program which prints the cgi environment

use strict;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';

my $q = new CGI;
my $var;
my $val;

print $q->header, $q->start_html;

foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print $q->p("${var}=\"${val}\"\n");
}

print $q->p(`perl -v`);

print $q->end_html;

<<<<<<<<<<<<<
---
Use the domain skylightview (dot) com for the reply address instead.


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

Date: Tue, 02 Dec 2003 04:41:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Is there a command that will return the version of perl?
Message-Id: <YJUyb.14795$n4.12235@nwrddc01.gnilink.net>

Guy wrote:
What about a simple "perl -v"?
[...]
> I was wondering, if my perl script can detect what version of perl
> it's running on. whether it's perl 5.004, 5.6, or whatever.

Well, you can always call "perl -v" from a Perl script using backticks to
capture the output..

jue




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

Date: 1 Dec 2003 20:51:34 -0800
From: ctippur@msn.com (Chandrashekar Tippur)
Subject: net::scp::expect error
Message-Id: <629c1390.0312012051.69ccbe27@posting.google.com>

All,

I am having some trouble with the module net::scp::expect. I am able
to scp manually.

The error that I am getting is:

 Error - last line returned was: pp                                   
|    3B |    3B/s | TOC: 0 at
/tmp/.itverify-1038/perl/lib/perl5/site_perl/5.6.1/Expect.pm line 733


Here is the snippet of code:

        $scpe = Net::SCP::Expect->new(host=>"$Host", user=>"$Login",
password=>"$Passwd", port=>"$sshport", protocol=>2, auto_yes=>1) ||
die "Incorrect Login or password\n";
        $scpe->scp("$line",'$remotepwd') || die "Hello";

Please help.

Thanks,
Shekar


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

Date: Mon, 01 Dec 2003 22:57:17 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: pack, Win32 registry & binary data
Message-Id: <3fcbc67e.754755255@news.erols.com>

drubnone@yahoo.com (woof) wrote:

: I need an example on how to collect and process REG_BINARY data
: in a Win32 registry.  The registry value in question reads:
: 
: TimeOfLastScan   REG_BINARY   21 0a 1e 0d 00 1e 00 00

[snip]

: But have been unable to feed localtime() anything that gets
: me my date string.  I know I'm not packing this correctly.

There's no guarantee that a sensible date can be backed out from the binary
value.  The function that creates the binary value is not yet known to be
symmetric.  If we assume that the function is symmetric, we should state
that assumption.

The problem is one of determining what function creates the binary value
from a date.  We have one binary value, but we have no idea what date it
represents.  If we knew that date, we might have a starting point on
figuring out the function.  Even better would be a bunch of binary values
and the date each represents.

It's a complete WAG, but each octet of the binary value might stand for a
different numeric portion of the date/time.

    year    0x21 => 33   (Assuming a 1970 epoch, 1970 + 33 = 2003)
    month   0x0a => 10   (October?  November?)
    day     0x1e => 30   (30th?  31st?)
    hour    0x0d => 13   (1 pm)
    minutes 0x00 => 0    (:00)
    seconds 0x1e => 30   (:30)
    ?       0x00 => 0
    ?       0x00 => 0



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

Date: Mon, 01 Dec 2003 13:16:16 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Perl et Telnet
Message-Id: <ioMyb.1396$eD2.26066@news.uswest.net>

ThERiZla wrote:
> Hi,
> 
> I do a connection on the server witn Telnet.
> My problem is when I execute a command on command prompt. 
> This is my command : my @outputcreateUser = $telnet->cmd($createUser);
> I want obtain the result of the command but when I print the array
> @outputCreateUser there is nothing in the array.

ahhh... so your code looks exactly like:

my @outputcreateUser = $telnet->cmd($createUser);
print @outputCreateUser;

Case is important in variable names.



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

Date: Mon, 01 Dec 2003 19:18:49 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl et Telnet
Message-Id: <x7smk4cpnr.fsf@mail.sysarch.com>

>>>>> "JG" == J Gleixner <glex_nospam@qwest.invalid> writes:

  JG> ahhh... so your code looks exactly like:

  JG> my @outputcreateUser = $telnet->cmd($createUser); print
  JG> @outputCreateUser;

  JG> Case is important in variable names.

another reason why StuDlyCaps is such a bad idea. it is tricky enough
getting long names correct (and strict is a must anyway) but adding case
issues makes it just annoying. i created a copy-word func in emacs long
ago in my personal perl mode that copies a name and preceding sigil so i
can paste it elsewhere. makes life lots easier when using vars multiple
times.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Mon, 1 Dec 2003 20:55:55 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Perl unicode and :crlf, was Re: regexp: \x0a => \x0d\x0a
Message-Id: <Pine.LNX.4.53.0312012052210.18361@ppepc56.ph.gla.ac.uk>

On Mon, 1 Dec 2003, Ben Morrow wrote:

> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> > Given that the layers architecture is absolutely broken (especially
> > :crlf stuff), I do not see any reason why anything using layers should
> > do any particular thing...
>
> I was wondering about saying something along these lines but decided
> it probably wasn't my place to... the idea is a good one, but I would
> say it needs a fairly fundamental re-working. *Especially* :crlf.

Well, those comments brought me to earth with a bit of a bump.  Have I
been blundering around with my eyes shut?  It seems so, but all of the
simpler things I've been using the utf8 stuff for have worked fine:
and I've been recommending it to others in good faith, and have had
quite a number of positive responses.

It was specifically this utf-16LE with crlf incident that had proven
to be a problem.  Ho hum, back to the drawing board.


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

Date: Tue, 2 Dec 2003 00:30:24 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl unicode and :crlf, was Re: regexp: \x0a => \x0d\x0a
Message-Id: <bqgmf0$edr$1@wisteria.csv.warwick.ac.uk>


"Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote:
> On Mon, 1 Dec 2003, Ben Morrow wrote:
> 
> > Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> > > Given that the layers architecture is absolutely broken (especially
> > > :crlf stuff), I do not see any reason why anything using layers should
> > > do any particular thing...
> >
> > I was wondering about saying something along these lines but decided
> > it probably wasn't my place to... the idea is a good one, but I would
> > say it needs a fairly fundamental re-working. *Especially* :crlf.
> 
> Well, those comments brought me to earth with a bit of a bump.  Have I
> been blundering around with my eyes shut?  It seems so, but all of the
> simpler things I've been using the utf8 stuff for have worked fine:
> and I've been recommending it to others in good faith, and have had
> quite a number of positive responses.

Simple things like pushing :utf8 or :encoding(*)[1] onto a filehandle
work fine. Anything more complicated than that gets tricky,
particulary with :crlf since it (like :utf8, but much more so) isn't
really a layer at all but instead searches down the stack 'till it
finds a layer that declares it can do CR:LF translation and tells it
to start... hence my preference for a straightforward layer.

For instance, one thing that I would want to be able to do is, without
losing the contents of any buffers, change a filehandle from being its
default of :unix:perlio to :stdio so I could pass a FILE* to some
library that wanted one, and then change it back afterwards. This
is... very dodgy at the moment. If you have 5.8.2 try some more
complicated pushings and poppings and see what PerlIO::get_layers says
ends up actually there. Or have a poke around in perlio.c :).

[1] As a separate issue, I would *always* be inclined to push
:encoding(utf8) rather than :utf8, despite the probable performance
hit, because :utf8 doesn't actually check the data is valid utf8: it
just marks it as such and passes it along. :encoding not only checks,
it also gives you some chance of decent fallback.

Ben

-- 
   If you put all the prophets,   |   You'd have so much more reason
   Mystics and saints             |   Than ever was born
   In one room together,          |   Out of all of the conflicts of time.
ben@morrow.me.uk |----------------+---------------| The Levellers, 'Believers'


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

Date: 01 Dec 2003 23:51:09 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: question about installation of GD::Text on cygwin (could be a Makefile q)
Message-Id: <slrnbsnkvf.5j7.mgjv@verbruggen.comdyn.com.au>

On 1 Dec 2003 06:15:07 -0800,
	Upstart <stimonyhall@netscape.net> wrote:
> Hi
> 
> For background: I am trying to install a few modules with an
> environment of Cygwin w/ windows 2000. The module I am stuck on is
> GD::Text.

> $ perl Makefile.PL
> Checking if your kit is complete...
> Looks good
> 
> $
> 
> 
> that's it... no Makefile. no error messages. I am building other
> modules (Like GD) and this step builds a Makefile with those modules.

Hmmm.. That's odd. I've never had a report about this before.

Would it be possible for you to comment out bits and pieces from the
makefile.PL file to see whether there is something that causes this,
and if so what it is?

> How would I trouble shoot this? I guess it would have to do with the
> ExtUtils::MakeMaker module.... but I don't know how to troubleshoot
> this kind of fundamental problem.

Try commenting out everything but the call to WriteMakefile(). Then
uncomment the MY::postamble, then MY::libscan, then one by one the two
tests (eval followed by if) at the top. None of it should break the
writing of a Makefile, but at least we'll know what does it. Maybe a
few well-placed debugging statements in the breaking bits could
pinpoint it a bit more.

I don't really see anything in the code that could cause this sort of
breakage though....

Martien
-- 
                        | 
Martien Verbruggen      | You can't have everything, where would you
Trading Post Australia  | put it?
                        | 


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

Date: 1 Dec 2003 20:13:20 -0800
From: stimonyhall@netscape.net (Upstart)
Subject: Re: question about installation of GD::Text on cygwin (could be a Makefile q)
Message-Id: <79516caa.0312012013.3dd92c4f@posting.google.com>

"Randy Kobes" <randy@theoryx5.uwinnipeg.ca> wrote in message news:<vkJyb.33803$MW5.49636@news1.mts.net>...
> "Upstart" <stimonyhall@netscape.net> wrote in message
>  news:79516caa.0312010615.143302a3@posting.google.com...
> > Hi
> >
> > For background: I am trying to install a few modules with an
> > environment of Cygwin w/ windows 2000. The module I am stuck on is
> > GD::Text.
> >
> > tried this post on the *.modules list with no luck.
> >
> > Went to cygwin to download latest and greatest code, and they seem to
> > package freetype and the GD library now. So I downloaded them and
> > installed, then was able to successfully build GD.pm.
> >
> > Now I downloaded GD::Text 0.86. I do a 'perl Makefile.PL' and it won't
> > drop/create a Makefile. I downloaded 0.85 and got the same results:
> >
> > $ perl Makefile.PL
> > Checking if your kit is complete...
> > Looks good
> >
> > $
> >
> > that's it... no Makefile. no error messages. I am building other
> > modules (Like GD) and this step builds a Makefile with those modules.
> >
> > How would I trouble shoot this? I guess it would have to do with the
> > ExtUtils::MakeMaker module.... but I don't know how to troubleshoot
> > this kind of fundamental problem.
> 
> If you comment out all the stuff at the beginning of Makefile.PL
> involving eval{}, and just leave the WriteMakefile() call in, is a
> Makefile produced?

Ok... started hacking at this...

On Mon, 1 Dec 2003, Martien Verbruggen wrote:

> Try commenting out everything but the call to WriteMakefile(). Then
> uncomment the MY::postamble, then MY::libscan, then one by one the two
> tests (eval followed by if) at the top. None of it should break the
> writing of a Makefile, but at least we'll know what does it. Maybe a
> few well-placed debugging statements in the breaking bits could
> pinpoint it a bit more.
> 
> I don't really see anything in the code that could cause this sort of
> breakage though....

Couple of things as a result of this direction (thanks to both guys
for direction):

- I have isolated the code snippet(s) that cause the problem. The hash
value for PREREQ_PM and the "TTF eval" (see diff below).
- There is no MY::libscan in the Makefile.PL, only postamble.
- If I add a "use GD;" line at the top of the page, the silent failure
to create a Makefile is exhibited again. I did this to see if my GD
was broken. I am running GD 2.11.
- I have confirmed that my GD implementation works by creating a
simple black jpeg
- removing these sections allowed me to create the Makefile. I could
send if anyone is interested. I don't know if this is valid yet. I
will run tomorrow.

Here is the diff:

$ diff Makefile.PL Makefile.f
5c5
< 
---
> #use GD;
17,32d16
< eval
< {
<     local $SIG{'__WARN__'};
<     require GD;
<     require File::Spec;
<     require Cwd;
< 
<     GD::Image->can('stringTTF') 
<       or die "One";
<     GD::Image->stringTTF(0, 'foo', 10, 0, 0, 0, 'foo');
<     $@ =~ /TrueType font support/i 
<       and die "Two";
<     my $test_font = File::Spec->catfile(Cwd::cwd(),
"Dustismo_Sans.ttf");
<     GD::Image->stringTTF(0, $test_font, 10, 0, 0, 0, 'foo')
<       or die "Three: $@";
< };
55,56c39
<     'VERSION_FROM'    => 'Text.pm',
<     'PREREQ_PM'               => { 'GD' => 1 },
---
>     'VERSION_FROM'    => 'Text.pm',

and here is the GD snippet I used to make sure I could create an image
file from GD.

#!/usr/bin/perl
#
use GD;

$image = new GD::Image(50,50) or die "Couldn't Create Image";

open OUTFILE, ">output.gif";
binmode OUTFILE;
print OUTFILE $image->jpeg;
close OUTFILE;


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

Date: 1 Dec 2003 18:12:08 -0800
From: goodwill@alloymail.com (Will)
Subject: Re: redirect using location header does not work from an already redirected doc.
Message-Id: <c97890a4.0312011812.6eba4668@posting.google.com>

Using full url, does not work either.
The redirect script works fine if it is not forwarded to by ErrorDocument 404

I think the problem is in that the page already has header
HTTP/1.z 404 Not Found

I tried overwriting that but so far no luck.
I've read up on perlfaq9 and other, so far no clue.

What group should I post it in?
It seems like since I am writing it in perl: comp.lang.perl.misc


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

Date: 1 Dec 2003 18:28:37 -0800
From: goodwill@alloymail.com (Will)
Subject: Re: redirect using location header does not work from an already redirected doc.
Message-Id: <c97890a4.0312011828.5c99dbba@posting.google.com>

> Check the CGI specification.  That form of CGI response is mandated to
> return its results with status 200 (sometimes known as an internal
> redirection).

yes, but if the script is pointed to by ErrorDocument 404 the header
is 404.

> 
> To get a redirection by means of an external HTTP redirection
> transaction (HTTP status 30x and HTTP location header), the CGI
> specification calls for a complete URL in the CGI Location: response.
> 

I tried adding an addition header 30x or 200 along with location
header but it just does not work. My guess would be I would have to
modify the original top
HTTP/1.z 404 Not Found header. I am not really sure how.

> 
> Perlfaq9 points you at appropriate resources (and the appropriate
> newsgroup for discussing the topic).  Use the FAQs, Luke.

Read them all before, can not find a solution yet.

Where would I post this. this is a perl group.


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

Date: Mon, 01 Dec 2003 18:27:55 GMT
From: Z Monteca <zmonteca@zmonteca.com>
Subject: Session Management?
Message-Id: <LKLyb.8041$aw2.3429408@newssrv26.news.prodigy.com>

I just did an implementation of sessions. Personally I used 
Apache::Session::File, but I see others have used CGI::Session.  Does 
anyone have any pros/cons they could lend on using this method/module for 
management. 

So far the one problem that I have run into is all the garbage clean I up 
that has to be done.  For every web request that is made it seems to create 
a lot of unecessary session files in the session directory (after a few 
hours I have upwards of 10's of thousands, but only have a few thousand 
hits a day ~2,000). I am not sure why this is. A true con is that you have 
to have run a cron script to clean up this directory every few hours.  Is 
this a standard element of using the Apache::Session::File module or is my 
implementation seem to be messed up a bit?


-Z 


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

Date: Mon, 1 Dec 2003 20:58:40 -0600
From: "Matt" <nospam@yahoo.com>
Subject: Starting Perl Script at Bootup
Message-Id: <vsnvuj6bl44ge5@corp.supernews.com>

I have a perl script I would like to have run every time my server boots up.
Its running Redhat Linux.  How would I do that?

Matt





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

Date: Tue, 02 Dec 2003 03:13:39 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Starting Perl Script at Bootup
Message-Id: <DrTyb.14017$n4.3477@nwrddc01.gnilink.net>

Matt wrote:
> I have a perl script I would like to have run every time my server
> boots up. Its running Redhat Linux.  How would I do that?

You won't believe it, but by coincidence a name sake of yours just posted
exactly the same question to alt.perl.
You may want to check there and/or ask him about what advice he got.

jue




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

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


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