[26503] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8661 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 13 11:05:40 2005

Date: Sun, 13 Nov 2005 08:05:05 -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           Sun, 13 Nov 2005     Volume: 10 Number: 8661

Today's topics:
    Re: alphanumeric counter - howto? <rvtol+news@isolution.nl>
    Re: alphanumeric counter - howto? <1usa@llenroc.ude.invalid>
    Re: alphanumeric counter - howto? <rvtol+news@isolution.nl>
        Net::FTP - Binary mode <bonninf@ifrance.com>
    Re: Net::FTP - Binary mode <1usa@llenroc.ude.invalid>
    Re: Timelocal input, post good Date filters (from - to) <tadmc@augustmail.com>
    Re: Timelocal input, post good Date filters (from - to) <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 13 Nov 2005 16:03:40 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: alphanumeric counter - howto?
Message-Id: <dl7o6h.1h4.1@news.isolution.nl>

Oliver Bleckmann:

> sub base36
> {
>  my ($num) = @_;
>  use integer;
>  my @chars  = ('0'..'9', 'A'..'Z');
>  my $result = "";
>  for(my $b=@chars; $num; $num/=$b)
>  {
>   $result .= $chars[$num % $b];
>  }
>  return scalar reverse $result;
> }


Variant:

#!/usr/bin/perl
use strict; use warnings;

use constant Chars   => ('0'..'9', 'A'..'Z', 'a'..'z');
use constant MaxBase => scalar Chars;

{ local ($,, $\) = ("\t", "\n");

  for (my $i = 0; $i != 30; $i++) {
    print $i, int2base($i, 16, 4);
  }
}

sub int2base {
  use integer;

  my ($ret, $num, $base, $minlen) = ('', @_);
  return undef if $num             < 0
               || ($base   ||= 10) < 2
               || MaxBase          < $base
               || ($minlen ||=  1) < 1;

  for (; $num; $num /= $base) {
    $ret .= (Chars)[$num % $base];
  }
  return scalar reverse $ret . '0'x($minlen - length($ret));
}

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Sun, 13 Nov 2005 15:25:24 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: alphanumeric counter - howto?
Message-Id: <Xns970D6A0ABBC1asu1cornelledu@127.0.0.1>

"Dr.Ruud" <rvtol+news@isolution.nl> wrote in news:dl7o6h.1h4.1
@news.isolution.nl:

>   return undef if $num             < 0
>                || ($base   ||= 10) < 2
>                || MaxBase          < $base
>                || ($minlen ||=  1) < 1;

You should use a plain return here rather than returning undef. Otherwise, 
in list context, the sub will return a non-empty list with one element, 
foiling conditionals.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Sun, 13 Nov 2005 16:46:38 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: alphanumeric counter - howto?
Message-Id: <dl7rcm.1gc.1@news.isolution.nl>

A. Sinan Unur schreef:
> Dr.Ruud:

>>   return undef if $num             < 0
>>                || ($base   ||= 10) < 2
>>                || MaxBase          < $base
>>                || ($minlen ||=  1) < 1;
> 
> You should use a plain return here rather than returning undef.
> Otherwise, in list context, the sub will return a non-empty list with
> one element, foiling conditionals.

Yes, thanks. I actually had read about it not too long ago... 

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: Sun, 13 Nov 2005 14:42:49 +0100
From: "Pascal" <bonninf@ifrance.com>
Subject: Net::FTP - Binary mode
Message-Id: <437742d5$0$11254$626a14ce@news.free.fr>

Hi All,

I get an issue by using Net::FTP to transfer both text and binary files from 
an Unix server to a PC under Windows 2000. For that, I'm using the 
Net::FTP::Get() function.

The files are transferred to the PC but some characters 'OD' are added into 
the binary files. However, I've well activated the binary mode by 
Net::FTP::Binary().

Below is an extract of my code:
 my $opt_s = "myserver";
 my $opt_u = "mylogin";
 my $opt_p = "mypassword";
 my $opt_r = "myremotedir";

 $ftp = new Net::FTP ( $opt_s );
 die "Failed to connect to server '$opt_s': $!\n" unless $ftp;

 die "Failed to login as $opt_u\n" unless $ftp->login($opt_u, $opt_p);

 warn "Failed to set binary mode\n" unless $ftp->binary();

 print "Cannot change directory to $opt_r\n" unless $ftp->cwd($opt_r);
 die "Failed to GET $l\n" unless $ftp->get("file.bin",
"$localdir/file.bin");
$ftp->quit if( defined($ftp) );

I don't get idea about how I can solve my problem. Could you help me ? Is 
this problem a know bug from Net::FTP ?

Thanks very much for your help.
BRgds
Pascal




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

Date: Sun, 13 Nov 2005 13:50:53 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Net::FTP - Binary mode
Message-Id: <Xns970D5A0425DB4asu1cornelledu@127.0.0.1>

"Pascal" <bonninf@ifrance.com> wrote in
news:437742d5$0$11254$626a14ce@news.free.fr: 

> I get an issue by using Net::FTP to transfer both text and binary
> files 

 ...

>  warn "Failed to set binary mode\n" unless $ftp->binary();

Then why are you transferring both types of files as binary?

Sinan

PS: Please read the posting guidelines for this group. In particular, 
don't retype parts of script. Instead, create a short but complete script 
others can run. Then, post that.

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Sun, 13 Nov 2005 08:56:18 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Timelocal input, post good Date filters (from - to)
Message-Id: <slrndnel0h.squ.tadmc@magna.augustmail.com>

robic0 <> wrote:

> i think i can 
> wiper ur ass in Perl day or nite. Day or nite jackoff.
> I own u Perl wise. All of u........


Why is it that you persist in asking questions of people that
know less than you do?

You can't possibly get an answer that's better than what you already
know, so what would be the point in asking?


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


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

Date: Sun, 13 Nov 2005 15:04:33 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Timelocal input, post good Date filters (from - to)
Message-Id: <Xns970D66815BC53asu1cornelledu@127.0.0.1>

Tad McClellan <tadmc@augustmail.com> wrote in 
news:slrndnel0h.squ.tadmc@magna.augustmail.com:

> robic0 <> wrote:
> 
>> i think i can wiper ur ass 
 ...

> Why is it that you persist in asking questions of people that
> know less than you do?

I am not sure, but I think he is saying he wants to wipe our behinds. I am 
sure Freud would have had something to say about that.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8661
***************************************


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