[25425] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7670 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 19 00:05:41 2005

Date: Tue, 18 Jan 2005 21:05:12 -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           Tue, 18 Jan 2005     Volume: 10 Number: 7670

Today's topics:
    Re: [perl-python] 20050118 keyed list <jurgenex@hotmail.com>
        Directory listing <rv01@gre.ac.uk>
    Re: Directory listing <abigail@abigail.nl>
    Re: Directory listing <xxxx@yyyy.zzzz>
    Re: Directory listing <1usa@llenroc.ude.invalid>
        Help Perlling a program <yyusenet@yahoo.com>
    Re: Help Perlling a program <yyusenet@yahoo.com>
    Re: How do I force a specific compiler in Configure/mak <spamtrap@dot-app.org>
    Re: How do I force a specific compiler in Configure/mak <kalinaubears@iinet.net.au>
    Re: How do I force a specific compiler in Configure/mak <spamntrapf@yahoo.com>
    Re: HTTP Get with Proxy authentication <matthew.garrish@sympatico.ca>
    Re: Kalender programm <tadmc@augustmail.com>
    Re: Kalender programm <lv@aol.com>
    Re: Kalender programm <jurgenex@hotmail.com>
    Re: Kalender programm <1usa@llenroc.ude.invalid>
    Re: Low level data manipulation in Perl <groleau+news@freeshell.org>
    Re: newbie question about documentation <tadmc@augustmail.com>
        Parsing in regular expression <sam.wun@authtec.com>
    Re: telnet timed out <lv@aol.com>
    Re: The world's shortest 'Hello World!' program: a prop <groleau+news@freeshell.org>
    Re: The world's shortest 'Hello World!' program: a prop <a.newmane.remove@eastcoastcz.com>
        Usage of File::Find <hi.joshi@gmail.com>
    Re: Usage of File::Find <see_sig@invalid>
    Re: Usage of File::Find drleeds@gmail.com
    Re: Usage of File::Find <noreply@gunnar.cc>
    Re: Usage of File::Find <hi.joshi@gmail.com>
    Re: Win32::api doesn't work? <1usa@llenroc.ude.invalid>
    Re: Win32::api doesn't work? <dontmewithme@got.it>
    Re: Win32::api doesn't work? <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 19 Jan 2005 03:16:18 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: [perl-python] 20050118 keyed list
Message-Id: <6ikHd.10352$5t2.9480@trnddc01>

Tassilo v. Parseval wrote:
> Also sprach Jürgen Exner:
>
>> Xah Lee wrote:
>
>>> © %a = ('john',3, 'mary', 4, 'jane', 5, 'vicky',7);
>>> © use Data::Dumper qw(Dumper);
>>> © print Dumper \%a;
>>
>> Wow, my compliments. The very first time that using Data::Dumper
>> actually may do something useful (formats the data more nicely).
>> Still, why you are passing a reference is beyond me.
>
> How else would you use 'Dumper' on a hash?

Well, fair enough. If you do a plain
    print Dumper(%a);
you do loose a lot of the nifty pretty printing that is provided by Dumper 
otherwise.

jue 




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

Date: Tue, 18 Jan 2005 23:50:59 GMT
From: "Frank Raz" <rv01@gre.ac.uk>
Subject: Directory listing
Message-Id: <DhhHd.280$Z31.44@newsfe1-gui.ntli.net>

Hi

I am a new comer to the world of PERL scripting.
Can someone let me know how can i right a script to show me the directory
sizes on a remote machine





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

Date: 19 Jan 2005 00:50:32 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Directory listing
Message-Id: <slrncurbmn.ev3.abigail@alexandra.abigail.nl>

Frank Raz (rv01@gre.ac.uk) wrote on MMMMCLVIII September MCMXCIII in
<URL:news:DhhHd.280$Z31.44@newsfe1-gui.ntli.net>:
##  Hi
##  
##  I am a new comer to the world of PERL scripting.

The language is called Perl. The binary is called perl. There's no such
thing as PERL.

##  Can someone let me know how can i right a script to show me the directory
##  sizes on a remote machine

That depends how you access the remote machine. telnet? rsh? rlogin?
ssh? UUCP? NFS? Samba? HTTP? FTP? Something else?



Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


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

Date: Tue, 18 Jan 2005 17:59:23 -0800
From: "Crom" <xxxx@yyyy.zzzz>
Subject: Re: Directory listing
Message-Id: <cskeps$v5g$1@news.astound.net>

Abigail wrote:
> Frank Raz (rv01@gre.ac.uk) wrote on MMMMCLVIII September MCMXCIII in
> <URL:news:DhhHd.280$Z31.44@newsfe1-gui.ntli.net>:
> ##  Hi
> ##
> ##  I am a new comer to the world of PERL scripting.
>
> The language is called Perl. The binary is called perl. There's no
> such thing as PERL.

Please excuse my bluntness, but the sky is NOT falling.

In fact, the only place the casing of the word "Perl" matters at all is 
the first line (#!).

I've never see anyone complain if you call Java, java, or JAVA, same 
with c++ or C++, pascal/Pascal/PASCAL, php/PHP, ...

Yes, what you said is perfectly 100% true, perl is the default name of 
the binary, Perl is the name of the language, but who really gives a 
rat's hind end if you case it right in everyday speech or writing. This 
is a new group, for an essay writting contest.

I have nothing against you, but people who thinks that miss-casing 
"perl" will some how being on the wrath of $deity...

My point is get off your high horse and kindly shoot it. Or if you like, 
I can get my 12 gauge <g>

> ##  Can someone let me know how can i right a script to show me the
> directory ##  sizes on a remote machine
>
> That depends how you access the remote machine. telnet? rsh? rlogin?
> ssh? UUCP? NFS? Samba? HTTP? FTP? Something else?

For FTP, Net::FTP works well, has a size() function if I recall.

For HTTP have a look at the HTTP module (and HTTP::*)

For Telnet'ing, I find IO::Socket useful (also see perlfaq8.)





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

Date: 19 Jan 2005 02:21:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Directory listing
Message-Id: <Xns95E2D9510AE5Dasu1cornelledu@132.236.56.8>

"Crom" <xxxx@yyyy.zzzz> wrote in news:cskeps$v5g$1@news.astound.net:

> Abigail wrote:
>> Frank Raz (rv01@gre.ac.uk) wrote on MMMMCLVIII September MCMXCIII in
>> <URL:news:DhhHd.280$Z31.44@newsfe1-gui.ntli.net>:
>> ##  Hi
>> ##
>> ##  I am a new comer to the world of PERL scripting.
>>
>> The language is called Perl. The binary is called perl. There's no
>> such thing as PERL.
> 
> Please excuse my bluntness, but the sky is NOT falling.

Hi!

> I have nothing against you, but people who thinks that miss-casing 
> "perl" will some how being on the wrath of $deity...
> 
> My point is get off your high horse and kindly shoot it. Or if you like, 
> I can get my 12 gauge <g>

BYEEEEE!

*PLONK* 

This does feel good.

Sinan.


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

Date: Tue, 18 Jan 2005 20:15:00 -0700
From: "YYusenet" <yyusenet@yahoo.com>
Subject: Help Perlling a program
Message-Id: <cskjbo$js0$1@news.xmission.com>

Hello,

I am new to Perl, so I am probably making my programs (or scripts?) in a 
non-Perl way.  I was wondering if the following script could be made with 
less repition or lines of code, or in a more Perl like way.

The script is used so if I download a lot of pictures with not very useful 
names (like from digital camera software that exports pictures called 
IMG000001234 or something), it would name them in order, starting with zero. 
It also should work assuming that there may already be files named 0.jpg, 
etc.

I am running this with ActivePerl versin 5.8.6.811 on windows XP.

Here is the code:
----------------------------------------
#perl

use warnings;
use strict;
use File::Copy;

print "--------RENAMING .jpg.bak STARTING--------\n";
my @files = grep { -f} glob "*.jpg";
foreach (@files) {
 print "renaming $_...\t\tto\t$_.jbak\n";
 move ($_,$_ . ".jbak") or
  die "unable to rename $_!";
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING .gif.bak STARTING--------\n";
@files = grep { -f} glob "*.gif";
foreach (@files) {
 print "renaming $_...\t\tto\t$_.gbak\n";
 move ($_,$_ . ".gbak") or
  die "unable to rename $_!";
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING.jpg STARTING--------\n";
my $counter = 0;
@files = grep { -f} glob "*.jbak";
foreach (@files) {
 print "renaming $_...\t\tto\t$counter\n";
 move ($_,$counter . ".jpg") or
  die "unable to rename $_!";
 $counter++;
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING.gif STARTING--------\n";

@files = grep { -f} glob "*.gbak";
foreach (@files) {
 print "renaming $_...\t\tto\t$counter\n";
 move ($_,$counter . ".gif") or
  die "unable to rename $_!";
 $counter++;
}
print "--------RENAMING COMPLETE--------\n";
print "--------PROGRAM FINISHED--------\n";
<STDIN>
__END__;
----------------------------------------

Thanks,

hgabert _*at*_ xmission.com 




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

Date: Tue, 18 Jan 2005 20:23:46 -0700
From: "YYusenet" <yyusenet@yahoo.com>
Subject: Re: Help Perlling a program
Message-Id: <cskjs8$k7c$1@news.xmission.com>

Sorry, I missed a semi-colon after <STDIN>:

#perl

use warnings;
use strict;
use File::Copy;

print "--------RENAMING .jpg.bak STARTING--------\n";
my @files = grep { -f} glob "*.jpg";
foreach (@files) {
 print "renaming $_...\t\tto\t$_.jbak\n";
 move ($_,$_ . ".jbak") or
  die "unable to rename $_!";
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING .gif.bak STARTING--------\n";
@files = grep { -f} glob "*.gif";
foreach (@files) {
 print "renaming $_...\t\tto\t$_.gbak\n";
 move ($_,$_ . ".gbak") or
  die "unable to rename $_!";
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING.jpg STARTING--------\n";
my $counter = 0;
@files = grep { -f} glob "*.jbak";
foreach (@files) {
 print "renaming $_...\t\tto\t$counter\n";
 move ($_,$counter . ".jpg") or
  die "unable to rename $_!";
 $counter++;
}
print "--------RENAMING COMPLETE--------\n";
print "--------RENAMING.gif STARTING--------\n";

@files = grep { -f} glob "*.gbak";
foreach (@files) {
 print "renaming $_...\t\tto\t$counter\n";
 move ($_,$counter . ".gif") or
  die "unable to rename $_!";
 $counter++;
}
print "--------RENAMING COMPLETE--------\n";
print "--------PROGRAM FINISHED--------\n";
<STDIN>;
__END__;




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

Date: Tue, 18 Jan 2005 18:25:51 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How do I force a specific compiler in Configure/make
Message-Id: <M8adnR5_OoieBnDcRVn-tw@adelphia.com>

Jacob wrote:

> I'm sorry to report that neither of the following has gotten
> the make to work with the xlc_r compiler:
> 
> - export CC=xlc_r

Check for more low-hanging fruit - xlc_r *is* in your PATH, right? And it's
not aliased to something else?

    whereis xlc_r
    which xlc_r
    alias
    xlc_r -v

If xlc_r doesn't understand -v, you might get a usage message -- that's OK,
because we're checking for GCC or another compiler in disguise, not for a
specific version of xlc_r.

> The make is now proceeding with its chosen compiler, cc_r
> and there seems to be nothing I can do to stop it.

Of course you can stop it. The trick is figuring out how, and we've just
gotten started with that.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Tue, 18 Jan 2005 23:05:20 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: How do I force a specific compiler in Configure/make
Message-Id: <41eda5b4$0$31102$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

Jacob wrote:

> before each new Configure, I run "make realclean" and rm -rf
> the whole blessed directory in which I had untarred the perl
> tar file , I then untar it afresh.  The "make realclean"  is
> pure unnecessary paranoia.  But there's no config.sh or
> policy.sh to force my compiler any which way before I
> start...  I looked into policy.sh before the make.  I did
> not find anything that looks like compiler control, though I
> may have missed it.
> 
> There's nothing in /tmp that looks like today's activity.
> (/tmp/fcgi_49346 says nothing I can decipher.)
> 
> How much cleaner can a guy get? :-)

That should be clean enough :-)
Seems to me that there's something that INSTALL and/or README.aix is not 
telling us.

Is 'cc_r' the default compiler ? Perhaps 'xlc_r' is not being 
recognised, so it defaults to the ...ummm .... default. (Dunno - just a 
thought.)

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: 18 Jan 2005 16:32:28 -0800
From: "Jacob" <spamntrapf@yahoo.com>
Subject: Re: How do I force a specific compiler in Configure/make
Message-Id: <1106094748.250450.304590@c13g2000cwb.googlegroups.com>

Rob,

let's take all your remarks in turn:

$ whereis xlc_r
xlc_r: /usr/bin/xlc_r

Yes, it's in my path.  I can type xlc_r -v and get several
screenfuls of information.  (I work with 54-line X-Window
sessions so that's saying something.)  If I type cc -v I
also get lots of info, including the fact that I could have
typed xlc_r.

Checking for aliases, I was surprised to find as many as I
did, but xlc_r was not in the list.  However, among the
aliases was this tidbit:
cc=/usr/bin/cc

Anything in that?  Nah, the make is not invoking cc, it's
invoking cc_r.

For all flavors of the compiler, the -v option told me it
was Version 6.

<sigh!>
Thanks for the efforts. I haven't given up yet..

-- Jacob JSalomon at bn.com
----
Sisyphus wrote:
> Jacob wrote:
>
> > before each new Configure, I run "make realclean" and rm -rf
> > the whole blessed directory in which I had untarred the perl
> > tar file , I then untar it afresh.  The "make realclean"  is
> > pure unnecessary paranoia.  But there's no config.sh or
> > policy.sh to force my compiler any which way before I
> > start...  I looked into policy.sh before the make.  I did
> > not find anything that looks like compiler control, though I
> > may have missed it.
> >
> > There's nothing in /tmp that looks like today's activity.
> > (/tmp/fcgi_49346 says nothing I can decipher.)
> >
> > How much cleaner can a guy get? :-)
>
> That should be clean enough :-)
> Seems to me that there's something that INSTALL and/or README.aix is
not
> telling us.
>
> Is 'cc_r' the default compiler ? Perhaps 'xlc_r' is not being
> recognised, so it defaults to the ...ummm .... default. (Dunno - just
a 
> thought.)
> 
> Cheers,
> Rob



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

Date: Tue, 18 Jan 2005 19:08:41 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: HTTP Get with Proxy authentication
Message-Id: <cyhHd.20228$K03.574046@news20.bellglobal.com>


"Adrian" <aprz43@yahoo.com.au> wrote in message 
news:1106026185.264915.270300@z14g2000cwz.googlegroups.com...
>
> Here is my solution.
> Hopefully it helps the next person with a similar problem.
>

Glad you were able to find a solution on your own, but I doubt many people 
will find it useful, especially since it's much easier to use the LWP module 
(and that module provides a much greater range of options).

Matt 




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

Date: Tue, 18 Jan 2005 17:11:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Kalender programm
Message-Id: <slrncur5tp.40o.tadmc@magna.augustmail.com>

Christoph Sünderhauf <chris@sunderhauf.net> wrote:

> My Shell (I use SuSE Linux) always says 
> there is an syntax-error, but there isnt any.
                                ^^^^^^^^^^^^^^

The last part of that sentence is most certainly incorrect.

The parser is the definition of the allowable syntax.

If it says that your syntax is an error, then it is an error,
even if you cannot see the error.


Error messages are meant to help in debugging, but since you have
not shared the message with us, we cannot help with the debugging.

We are not mind-readers here!


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


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

Date: Tue, 18 Jan 2005 22:17:04 -0600
From: l v <lv@aol.com>
Subject: Re: Kalender programm
Message-Id: <41eddfbf$1_1@127.0.0.1>

Christoph Sünderhauf wrote:

> Christoph Sünderhauf wrote:
> 
>> Hello
>> I#m new to Perl.
>> I started to write a programm which will tell you the day of the wekk 
>> if you tell it the first day in the year.
>> But somehow it doesnt work. My Shell (I use SuSE Linux) always says 
>> there is an syntax-error, but there isnt any.
>> could anyone please help me?
>> thanks,
>> Christoph
> 
> sorry,
> I forgot the script:
> 
> 
> 
> 
> chdir $FindBin::Bin;
> 
> #variale des jahres und der monate
> our @year = (1..365);
> our @jan;
> our @feb;
> our @mar;
> our @apr;
> our @may;
> our @jun;
> our @jul;
> our @aug;
> our @sep;
> our @oct;
> our @nov;
> our @dec;
> 
> #ask the first day
> print "What is the first day in the year?\n(1 for Monday, 2 for 
> Tuesday)...";
> 
> my $first = <stdin>;
> 
> my $firstday = &day_num($first);
> 
> $year[0] = $firstday;
> 
> 
> print "Figuring out all the rest of days...";
> 
> &days($firstday);
> 
> print "Finished!\n";
> 
> print "Making the seperate Months...";
> 
> &split_months;
> 
> print "Finished!\n";
> 
> #~~~~~~~~~~~~~~~~~~~~~~~~~~~
> #subs
> 
> #make the input to a number:
> sub day_num
> {
>  my ($day) = @_;
> 
>  if ($day = "Monday")
>  {return 1}
>  else
>  {
>   if ($day = "Tuesday")
>   {return 2}
>   else
>   {
>    if ($day = "Wednesday")
>    {return 3}
>    else
>    {
>     if ($day = "Thursday")
>     {return 4}
>     else
>     {
>      if ($day = "Friday")
>      {return 5}
>      else
>      {
>       #if (day = "Saturday")
>       #{return 6}
>       #else
>       #{
>        if ($day = "Sunday")
>        {return 7}
>        else
>        {
>         return 6}
> 
>        #}
>       }
>      }
>     }
>    }
>   }
>  }  #end sub
> 
> 
> 
> #show the user somke days
> sub show_days
> {
>  print "Which days do you want to know?\n";
>  my $day = <stdin>;
>   my $month = <stdin>;
> 
>  my $date = &date($day,$month);
> 
>  print "$day, $month is a $date\nAgain?";
> 
>  my $again = <stdin>;
>  if ($again = "y")
>  {&show_days;}
> }
> 
> 
> sub date
> {
>  my ($day,$month) = @_;
> 
>  my $date
> 
>  if ($month = "January")
>  {
>   $date = $jan[$day];
>  }
> 
>  if ($month = "February")
>  {
>   $date = $feb[$day];
>  }
> 
>  if ($month = "March")
>  {
>   $date = $mar[$day];
>  }
> 
>  if ($month = "April")
>  {
>   $date = $apr[$day];
>  }
> 
>  if ($month = "May")
>  {
>   $date = $may[$day];
>  }
> 
>  if ($month = "June")
>  {
>   $date = $jun[$day];
>  }
> 
>  if ($month = "July")
>  {
>   $date = $jul[$day];
>  }
> 
>  if ($month = "August")
>  {
>   $date = $aug[$day];
>  }
> 
>  if ($month = "September")
>  {
>   $date = $sep[$day];
>  }
> 
>  if ($month = "October")
>  {
>   $date = $oct[$day];
>  }
> 
>  if ($month = "Nevember")
>  {
>   $date = $nov[$day];
>  }
> 
>  if ($month = "December")
>  {
>   $date = $dec[$day];
>  }
> 
> return $date;
> 
> }
> 
> 
> sub days
> {
>  my ($firstday) = @_;
> 
> 
> 
> 
>  for my $el (1..364)
>  {
>   my $modo;
>   $modo = ($el % 7);
> 
>   if ($modo+$firstday > 7)
>   {$modo = $modo-7;}
> 
>   $year[$el] = ($modo + $firstday);
>  }
> }
> 
> sub split_months
> {
>  my $el; my $new;
> 
> 
>  my $last = 0 ;
>  my $next = 30;
> 
>  for $el ($last..$next)
>  {
>   $jan[$el] = $year[$el];
>  }
>  $last = (1 + $next);
>  $next = ($next + 28);
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $feb[$new] = $year[$el];
>  }
> 
>  $last = (1+$next);
>  $next = ($next + 31);
> 
>  for $el ($last..$last)
>  {
>   $new = ($el - $last);
>   $mar[$new] = $year[$el];
>  }
> 
>  $last=($naxt+1);
>  $next = ($next + 30);
> 
>   for $el ($last..$next)
>  {
>   $new=$el-$last;
>   $apr[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+31;
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $may[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+30;
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $jun[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+31;
> 
>  for $el ($last..$next)
>  {
>   $new=$el-$last;
>   $jul[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+31;
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $aug[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+30;
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $sep[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+31;
> 
>  for $el ($last..$next)
>  {
>   $new=$el-$last;
>   $oct[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+30;
> 
>  for $el ($last..$next)
>  {
>   $new = ($el - $last);
>   $nov[$new] = $year[$el];
>  }
> 
>  $last = $next+1;
>  $next=$next+31;
>  for $el ($last..$next)
>  {
>   $new=$el-$last;
>   $oct[$new] = $year[$el];
>  }
> 
> 
> 
> }

Why not just use one of the Date modules available from 
http://search.cpan.org ?  Like Date::Calc

use Date::Calc qw(Day_of_Week This_Year Day_of_Week_to_Text);

print "Which days do you want to know?\n";
chomp (my $day =  <STDIN>);
chomp (my  $month =  <STDIN>);

print "$day, $month is a " . Day_of_Week(This_Year(),$month,$day);

# or

print "\n$day, $month is a " . 
Day_of_Week_to_Text(Day_of_Week(This_Year(),$month,$day));



Len



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

Date: Wed, 19 Jan 2005 04:21:27 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Kalender programm
Message-Id: <bflHd.11056$Os6.10738@trnddc08>

Christoph Sünderhauf wrote:
> Christoph Sünderhauf wrote:
>> Hello
>> I#m new to Perl.
>> I started to write a programm which will tell you the day of the
>> wekk if you tell it the first day in the year.
>> But somehow it doesnt work. My Shell (I use SuSE Linux) always says
>> there is an syntax-error, but there isnt any.
>> could anyone please help me?
>> thanks,
>> Christoph
> sorry,
> I forgot the script:
>
[...]
> sub date
> {
>  my ($day,$month) = @_;
>
>  my $date

You forgot a semicolon in this line
The other syntax error is a bogus error caused by the first error.

jue




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

Date: 19 Jan 2005 04:30:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Kalender programm
Message-Id: <Xns95E2EF238E6DAasu1cornelledu@132.236.56.8>

l v <lv@aol.com> wrote in news:41eddfbf$1_1@127.0.0.1:

> Why not just use one of the Date modules available from 
> http://search.cpan.org ?  Like Date::Calc

Did you really have to quote the full message to say this?

Sinan


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

Date: Tue, 18 Jan 2005 21:42:32 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: Low level data manipulation in Perl
Message-Id: <0d2dnS3oSpy-VHDcRVn-iQ@gbronline.com>

Leonard Challis wrote:
> I have spent a few hours looking on Google, Perl.com, CPAN etc to try find 
> some information on messing about with low leveldata in Perl. I am talking 
> about opening files and looking at them in their very simplest format, 1s 
> and 0s.

You said look at them.  Is that it, or do you want more?

If just looking at them, perl is overkill.

http://www.hmug.org/man/1/od.html
http://www.hmug.org/man/1/hexdump.html

(Doesn't require a Mac--that just happened to be
the first hit in Google)


-- 
Wes Groleau

Is it an on-line compliment to call someone a Net Wit ?


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

Date: Tue, 18 Jan 2005 17:31:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie question about documentation
Message-Id: <slrncur739.40o.tadmc@magna.augustmail.com>

xhoster@gmail.com <xhoster@gmail.com> wrote:

> It would be nice if
> 
> perldoc -f Net::FTP::new
> 
> worked for doing this, but it doesn't.


Here is a (long) one-liner that can do that (kinda):

   perl -e 'print $1 if qx/ perldoc -u $ARGV[0] / =~ /(=item $ARGV[1].*?)(?=^=)/sm' Net::FTP new


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


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

Date: Wed, 19 Jan 2005 12:44:36 +0800
From: sam <sam.wun@authtec.com>
Subject: Parsing in regular expression
Message-Id: <cskq67$5eh$1@news.hgc.com.hk>

Hi,

The following pattern does not return all the values, the pattern only 
able to parse the first two fields:

my $test = "01-,    Revlon,                 n/a,    Revlon";
$test =~
         /^([0-9]*-), #prefix        1
           (.*),        #vendor      2
           (.*),        #Category    3
           (.*)         #basename    4
         /x;

if ($1 eq "" or $2 eq "" or $3 eq "") {
     print "Failed to parse $test\n";
} else {
     # get the value
}

What should be the correct implementation of this pattern?
Thanks
Sam


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

Date: Tue, 18 Jan 2005 21:56:30 -0600
From: l v <lv@aol.com>
Subject: Re: telnet timed out
Message-Id: <41eddaec$1_1@127.0.0.1>

Petterson Mikael wrote:
> Hi,
> 
> I am using Net::Telnet module in perl to connect to a remote client.
> I get a timeout for '$telnet->login($username, $password);'.
> 
> timed-out waiting for command prompt at ./telnet.pl line 15
> 
> Any ideas why?
> 
> I have tried with regular telnet and it works!
> 
> //Mikael
> 
> 
> Script
> -------------------------------------------
> #!/vobs/cello/cade_struct/bin/perl -w
> 
> use Net::Telnet;
> 
> my $hostname = 'ws3196.rnd.ki.sw.ericsson.se';
> my $username = 'eraonel';
> my $password = 'test';
> 
> 
>  my $telnet = new Net::Telnet ( Timeout=>30,
>                 Errmode=>'die');
> 
> 
>   $telnet->open($hostname);
>   $telnet->login($username, $password);
>   $telnet->waitfor('/login:.*$/');
>   print $telnet->cmd('whoami');
> 
> This is how my telnet login looks like:
> ***************************************
> 
> Trying 147.214.201.190...
> Connected to ws3196.
> Escape character is '^]'.
> 
> 
> SunOS 5.8
> 
> login:
> 
> ****************************************

According to the Net::Telnet doc:

*The methods login() and cmd() use the prompt setting in the object to 
determine when a login or remote command is complete. The method will 
fail with a time-out if you don't set the prompt correctly. *

Len


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Tue, 18 Jan 2005 21:32:07 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <l_udnY1ZDIw7W3DcRVn-pA@gbronline.com>

Leonard Challis wrote:
> Lol, I can't tell if it is or not, but it would be quit funny :D

As in funny enough to make me quit.


-- 
Wes Groleau
http://groleau.freeshell.org/teaching/


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

Date: Tue, 18 Jan 2005 20:42:25 -0800
From: "Alfred Z. Newmane" <a.newmane.remove@eastcoastcz.com>
Subject: Re: The world's shortest 'Hello World!' program: a proposal
Message-Id: <3566pmF4hq3opU1@individual.net>

A. Sinan Unur wrote:
> "Leonard Challis" <perl@lennychallis.co.uk> wrote in news:csk2ht$udm$1
> @newsg2.svr.pol.co.uk:
>
>> "Ken" <x3v0-usenet@yahoo.com> wrote in message
>> news:gXeHd.59$dm5.17@fe37.usenetserver.com...
>>> Larry wrote:
>
> ...
>
>>>> One claim that Perl can make is one of the most simple and shortest
>>>> 'Hello World' programs.
> ...
>
>>>>
>>>
>>> lol (this IS a joke, right?)
>
>> Lol, I can't tell if it is or not, but it would be quit funny :D
>
> Please stop feeding the troll.
>
> Sinan.

Why is he (the OP I assume you were referring to) automatically a troll? 
Seemed like a totally harmless "ha ha" orientated question. (If the 
person has otherwise truely proved to be a "troll", then I apologize in 
advance.)

And if you really think about it, printing /something/ for a completely 
empty program (0 bytes), such as version info, rather then a variant of 
"hello world", could be useful.

Or how about this, when configuration Perl for the first time, have a 
question/option to change the default behavior for 0 byte programs 
(default being the do nothing) with the printing of some useful 
information, like version, or a 3rd option to print "hello World" 
instead. That way everyone can be happy.

Could be useful. :-) 




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

Date: 18 Jan 2005 16:18:05 -0800
From: "tensai" <hi.joshi@gmail.com>
Subject: Usage of File::Find
Message-Id: <1106093885.617906.49490@z14g2000cwz.googlegroups.com>

Hi~

Is there any way to use File::Find and control the depth of directory
recursion

because ideally I'd like to be able to view the files/directories on
the top level or the second level at the most..
Thanks for any help :)



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

Date: Tue, 18 Jan 2005 19:55:37 -0500
From: Bob Walton <see_sig@invalid>
Subject: Re: Usage of File::Find
Message-Id: <41edb08f_1@127.0.0.1>

tensai wrote:

 ...
> Is there any way to use File::Find and control the depth of directory
> recursion
> 
> because ideally I'd like to be able to view the files/directories on
> the top level or the second level at the most..
> Thanks for any help :)

Well, you could set $File::Find::prune when your "wanted" 
function detects it has entered a directory at more than the 
specified depth.  Determining the depth should be a matter of 
counting the path delimiters in $File::Find::dir , which is 
probably best done with the tr/// operator.

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: 18 Jan 2005 16:58:54 -0800
From: drleeds@gmail.com
Subject: Re: Usage of File::Find
Message-Id: <1106096334.854139.87570@c13g2000cwb.googlegroups.com>

like this?

#!/usr/bin/perl

use strict;
use warnings;

use File::Find;
sub process_file {
print "$File::Find::name\n" if $File::Find::name =~
m'^[^/]*/[^/]+/[^/]*$';
}
find(\&process_file, $ARGV[0]);



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

Date: Wed, 19 Jan 2005 03:22:00 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Usage of File::Find
Message-Id: <355v91F4ihhsdU1@individual.net>

tensai wrote:
> Is there any way to use File::Find and control the depth of directory
> recursion
> 
> because ideally I'd like to be able to view the files/directories on
> the top level or the second level at the most..

To me it sounds easiest to do it without File::Find, i.e. using 
opendir() and readdir() instead.

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


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

Date: 18 Jan 2005 19:22:05 -0800
From: "tensai" <hi.joshi@gmail.com>
Subject: Re: Usage of File::Find
Message-Id: <1106104925.444669.20760@c13g2000cwb.googlegroups.com>

Thanks Gunnar

Tried using opendir() and readdir() and it works beautifully!
thanks guys for all your help :)



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

Date: 18 Jan 2005 23:42:36 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Win32::api doesn't work?
Message-Id: <Xns95E2BE59BDDECasu1cornelledu@132.236.56.8>

Larry <dontmewithme@got.it> wrote in news:dontmewithme-
AAD3C5.23455818012005@twister2.tin.it:

> How come the chunk of code below doesn't work?

[ snip code I posted some time ago with the caution that you probably need 
a way to find out the how to get valid device IDs ]

> $devices = waveInGetNumDevs();
> 
> print "Devices: $devices\n\n";
> 
> for (0 .. ($devices - 1) ) {
>    $result = waveInGetDevCaps($_, $caps, 
> Win32::API::Struct->sizeof('WAVEINCAPS'));
>    print "Device ID: $_ ,ProductName: $caps->{ProductName}\n";
> }
> 
> __END__;
> 
> It should return the product name of the devices (like soundblaster)
> I can only get the number of the devices

It seems like this is a Windows API question rather than a Perl question. 
I don't know much about the Windows API but, from the page I referred you 
to earlier:

  uDeviceID

  Identifier of the waveform-audio output device. It can be either a
  device identifier or a handle of an open waveform-audio input device.

So, I am going to venture to guess that 0 is not a valid device identifier 
or a handle.

Indeed, see:

http://msdn.microsoft.com/library/en-us/multimed/htm/_win32_waveinopen.asp

There is no point in continuing this discussion in this forum. You'll need 
to make a call to waveInOpen, pass the value of WAVE_MAPPER as the second 
argument, receive a handle in the first argument, then use that handle to 
call waveInGetCaps.

Or, find a way to enumerate the device IDs.

All of this belongs to a group which specializes in the Windows API.

Oh, and don't say stupid things like "Win32:api doesn't work" when you 
can't even spell the module's name.

Sinan.


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

Date: Wed, 19 Jan 2005 00:34:43 GMT
From: Larry <dontmewithme@got.it>
Subject: Re: Win32::api doesn't work?
Message-Id: <dontmewithme-A7ED49.01342719012005@twister1.tin.it>

In article <Xns95E2BE59BDDECasu1cornelledu@132.236.56.8>,
 "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:

> http://msdn.microsoft.com/library/en-us/multimed/htm/_win32_waveinopen.asp

can  you please run this  code ?

#!/perl

use strict;
use warnings;
use Win32::API;

my ($WaveFormat,$DevHandle,$result);
my $InData = " " x 44100;

# Private Type WaveFormatEx
Win32::API::Struct->typedef( 'WaveFormatEx', qw(
   INT FormatTag; 
   INT Channels; 
   LONG SamplesPerSec; 
   LONG AvgBytesPerSec; 
   INT BlockAlign; 
   INT BitsPerSample; 
   INT ExtraDataSize;
)) or die "Typedef error $!\n";

# Private Type WaveHdr
Win32::API::Struct->typedef( 'WaveHdr', qw(
   LONG lpData; 
   LONG dwBufferLength; 
   LONG dwBytesRecorded; 
   LONG dwUser; 
   LONG dwFlags; 
   LONG dwLoops; 
   LONG lpNext;
   LONG Reserved
)) or die "Typedef error $!\n";

# Private Type WaveInCaps
Win32::API::Struct->typedef( 'WaveInCaps', qw(
   INT ManufacturerID; 
   INT ProductID; 
   LONG DriverVersion; 
   TCHAR ProductName[32]; 
   LONG Formats; 
   INT Channels; 
   INT Reserved;
)) or die "Typedef error $!\n";

# Declare Function ...
Win32::API->Import( winmm => "int waveInGetNumDevs()");
Win32::API->Import( winmm => q{LRESULT waveInGetDevCaps(UINT_PTR 
DeviceID, LPWAVEINCAPS pwic, UINT cbwic)} );
Win32::API->Import( winmm => q{LRESULT waveInAddBuffer(HWAVEIN 
hwi,LPWAVEHDR pwh,UINT cbwh)} );
Win32::API->Import( winmm => q{LRESULT waveInOpen(LPHWAVEIN 
phwi,UINT_PTR uDeviceID,LPWAVEFORMATEX pwfx,DWORD_PTR 
dwCallback,DWORD_PTR dwCallbackInstance,DWORD fdwOpen)} );
Win32::API->Import( winmm => q{LRESULT waveInPrepareHeader(HWAVEIN 
hwi,LPWAVEHDR pwh,UINT cbwh)} );
Win32::API->Import( winmm => q{LRESULT waveInUnprepareHeader(HWAVEIN 
hwi,LPWAVEHDR pwh,UINT cbwh)} );
Win32::API->Import( winmm => q{LRESULT waveInStart(HWAVEIN hwi)} );
Win32::API->Import( winmm => q{LRESULT waveInStop(HWAVEIN hwi)} );
Win32::API->Import( winmm => q{LRESULT waveInReset(HWAVEIN hwi)} );
Win32::API->Import( winmm => q{LRESULT waveInClose(HWAVEIN hwi)} );

$WaveFormat = Win32::API::Struct->new('WaveFormatEx'); # Static 
WaveFormat As WaveFormatEx
$WaveFormat->{FormatTag} = 1; # WAVE_FORMAT_PCM
$WaveFormat->{Channels} = 1;
$WaveFormat->{SamplesPerSec} = 44100;
$WaveFormat->{BitsPerSample} = 16;
$WaveFormat->{BlockAlign} = 2;
$WaveFormat->{AvgBytesPerSec} = 44100 * 2;
$WaveFormat->{ExtraDataSize} = 0;

$Wave = Win32::API::Struct->new('WaveHdr'); # Static Wave As WaveHdr
$Wave->{lpData} = $InData;
$Wave->{dwBufferLength} = 44100 * 2;
$Wave->{dwFlags} = 0;

$result = waveInOpen($DevHandle, 0, $WaveFormat, 0, 0, 0);
$result = waveInPrepareHeader($DevHandle, $Wave, 
Win32::API::Struct->sizeof('WaveHdr'));
$result = waveInAddBuffer($DevHandle, $Wave, 
Win32::API::Struct->sizeof('WaveHdr'));
$result = waveInStart($DevHandle);

sleep 1;

$result = waveInPrepareHeader($DevHandle, $Wave, 
Win32::API::Struct->sizeof('WaveHdr'));
$result = waveInClose($DevHandle);


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

Date: 19 Jan 2005 02:16:01 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Win32::api doesn't work?
Message-Id: <Xns95E2D85C2D4C0asu1cornelledu@132.236.56.8>

Larry <dontmewithme@got.it> wrote in
news:dontmewithme-A7ED49.01342719012005@twister1.tin.it: 

> In article <Xns95E2BE59BDDECasu1cornelledu@132.236.56.8>,
>  "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> 
>> http://msdn.microsoft.com/library/en-us/multimed/htm/_win32
_waveinopen
>> .asp 
> 
> can  you please run this  code ?

Here's what I get:

C:\Home\asu1\UseNet\clpmisc> perl -c wave2.pl
Global symbol "$Wave" requires explicit package name at wave2.pl line 
72.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
73.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
74.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
75.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
78.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
80.
Global symbol "$Wave" requires explicit package name at wave2.pl line 
86.
wave2.pl had compilation errors.

When I fix that, I get:

C:\Home\asu1\UseNet\clpmisc> wave2.pl
Win32::API::parse_prototype: WARNING unknown parameter type 
'LPWAVEINCAPS' at C:
/opt/Perl/site/lib/Win32/API.pm line 248, <DATA> line 164.
Win32::API::parse_prototype: WARNING unknown parameter type 'HWAVEIN' at 
C:/opt/
Perl/site/lib/Win32/API.pm line 248, <DATA> line 164.


and more ...

Please post code others can easily run by cutting and pasting.

Anyway, as I said, I don't know much about the Windows API and I don't 
have much motivation to investigate.

Sinan.


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

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


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