[26239] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8424 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 16 00:05:30 2005

Date: Thu, 15 Sep 2005 21:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Sep 2005     Volume: 10 Number: 8424

Today's topics:
    Re: Need a regex <1usa@llenroc.ude.invalid>
    Re: Perl portability <ddunham@redwood.taos.com>
    Re: Perl portability <1usa@llenroc.ude.invalid>
    Re: Perl portability (Jay Tilton)
    Re: Perl portability <tadmc@augustmail.com>
    Re: sorting data - hash vs. list <Fred@fred.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Sep 2005 22:09:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Need a regex
Message-Id: <Xns96D2B8C56558Dasu1cornelledu@127.0.0.1>

"Randy Harris" <randy@SpamFree.com> wrote in
news:lHkWe.1367$D42.153@newssvr19.news.prodigy.com: 
 
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
 ...

>> To the OP: This is not a "write my code for me" service. If you do
>> not put any effort into helping others help you, you cannot expect
>> others to put much effort into helping you.

> What could I have done differently to ask for help without incurring
> the wrath of regulars such as yourself and Tad?

You did not incur anyone's wrath.

The easy way of getting help here is outlined in the posting guidelines. 
In short, you try something, you post what you have tried, explain how 
it does not do what you want it to do.

Postings without code generally get ignored unless someone like Shane 
actually posts a bogus answer. In that case, I feel compelled to point 
out the errors.

So, you could have posted a short script that others can run by copying 
and pasting into an editor. See the posting guidelines to learn how to 
do that. Oh, and please, no line numbers. I try to ignore code with line 
numbers as much as possible. Posting code with line numbers is probably 
a good way to ensure that no one is going to run, or play with your code 
to find an answer.

In short, read the posting guidelines.

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: Thu, 15 Sep 2005 23:35:58 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Perl portability
Message-Id: <yznWe.2294$3V6.1194@newssvr11.news.prodigy.com>

Hendry Taylor <hendry.taylor@btinternet.com> wrote:
> Well here is the entire code it is rather long. It just says syntax
> error on line 55 near $user1

I couldn't get that message at all when I tried to run the code.  I
checked it under 5.8.7, so it may be something to do with perl or one of
the modules (like Switch) between our versions.

> #!/usr/bin/perl
> use Tie::File;
> use Switch;
> sub trimwhitespace($);
> sub nslookup();

Now I got a lot of whining about that.  You don't need this line at all,
and you probably want to remove the parentheses where you define the
subroutine.

> sub nslookup() {

to

sub nslookup {

Of course, you could just use gethostent instead of calling nslookup,
but that's not causing your syntax error.

After changing those two lines...
$ perl -w article 
Useless use of localtime in void context at article line 289.
Possible precedence problem on bitwise & operator at article line 326.
Name "main::user" used only once: possible typo at article line 58.
Name "main::rundate" used only once: possible typo at article line 27.
Name "main::item" used only once: possible typo at article line 49.
Name "main::serverlist" used only once: possible typo at article line 33.
Name "main::FILEWRITE" used only once: possible typo at article line 35.
readline() on closed filehandle FILEREAD at article line 17.
Use of uninitialized value in concatenation (.) or string at article line 19.
readline() on closed filehandle FILEREAD at article line 27.
Use of uninitialized value in concatenation (.) or string at article line 42, <$fh> line 16.
untie attempted while 1 inner references still exist at article line 309, <$fh> line 16.

No syntax errors...

-- 
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: Fri, 16 Sep 2005 00:16:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl portability
Message-Id: <Xns96D2CE3F85126asu1cornelledu@127.0.0.1>

Hendry Taylor <hendry.taylor@btinternet.com> wrote in
news:dgc6t8$gdb$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com: 

> Well here is the entire code it is rather long. It just says syntax
> error on line 55 near $user1

This is just plain rude. Post the shortest possible script that still 
exhibits the problem.

By the way, who wrote this crap?

> #!/usr/bin/perl

use warnings;
use strict;

missing.

> use Tie::File;
> use Switch;
> sub trimwhitespace($);
> sub nslookup();

What, can you tell me, is the purpose of declaring that a sub called 
nslookup takes no arguments?

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

sub sub_with_empty_prototype () { print "@_\n" }

sub_with_empty_prototype(qw'pass some args');

__END__

Run that script and see what happens.

Now, if I copy and paste your script, I get:

D:\Home\asu1\UseNet\clpmisc> perl -c c.pl
Too many arguments for main::nslookup at c.pl line 32, near "'Address')"
BEGIN not safe after errors--compilation aborted at c.pl line 42.

So, I do not believe you when you say your script runs fine on a later 
version of Perl.

Seeing code like this makes me respect people who work in the real 
world, who have to fix messes like this to make things right.

> $debug = 0;
> chdir("/usr/local/home/autosys/seos_autotrack");
> $auditrecords = 0;
> $n = 0;
> $srecords = 0;
> $arecords = 0;
> $index = 0;
> $totalmatched = 0;
> $totalunmatched = 0;

What are all these global variables. Declare variables in the smallest 
applicable scope.

> my @monthnames = (qw(dummy Jan Feb Mar Apr May Jun Jul Aug Sep Nov
> Dec)); 

Cute.

open FILEREAD, "<seos_autotrack_day";

open FILEREAD, '<', 'seos_autotrack_day'
    	or die "Cannot open seos_autotrack_day: $!";

> $runday = <FILEREAD>;
> close FILEREAD;
> $logfilename = "autotrack-seos-compare".$runday.".log";

my $logfilename = "autotrack-seos-compare$runday.log";

> use Fcntl 'O_RDWR', 'O_CREAT';
> my $o = tie @logfile, 'Tie::File', $logfilename,  mode => O_RDWR |
> O_CREAT, dw_size => 512;
> $logrecords = @logfile;
> if ($logrecords > 0)     {splice @logfile, 0, $logrecords;}
> $o->STORE($n, "Debug mode set to: ".$debug);
> open FILEREAD, "<seos_autotrack_date";
> $rundate = <FILEREAD>;
> close FILEREAD;
> tie @servers, 'Tie::File', 'servers' || die "Can't open: $!\n";

I don't think this will actually die on error.

> foreach $server (@servers)
> {
>      $iplist = nslookup($server, 'Address');

What do you think this will return?

Why is $iplist a scalar?

>      $serverlist{$iplist} = sprintf "%s",$server;

This is sick. What do you think is the difference between

sprintf "%s",$server;

and 

"$server"

>      $serverlist1{$server} = sprintf "%s",$iplist;

Ditto.

>      print FILEWRITE "$server $iplist\n";
> }
> untie @servers;
> local $now = time;
> ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
> localtime(time);

I can't read any more.

Have you seen the posting guidelines?

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: Fri, 16 Sep 2005 00:17:49 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Perl portability
Message-Id: <432a0778.354805413@news.rcn.com>

[comp.lang.perl removed from newsgroups list]

Traditional Usenet reply style is to trim reply-quoted material to only
enough necessary to give context to your comments, and to interleave your
comments with the quoted material.  clpm readers appreciate replies that
adhere to that tradition.

Hendry Taylor <hendry.taylor@btinternet.com> wrote:

: Is it possible that the switch is not fully supported.

Possible, yep.  It's implemented by a source filter.  Using it has created
problems for me before, though I can't remember particulars.  I abandoned
its use after one special day of enthusiastic cursing.

You might verify that the two platforms are using the same version of
Switch.pm and its dependent modules.

Is there a way to see the code as altered by a source filter?  I dunno.
 
: If i were to take the switch out my code suddenly become alot more
: complicated and I prefer KISS.

"Simple" and "portable" are often mutually exclusive choices.



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

Date: Thu, 15 Sep 2005 21:10:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl portability
Message-Id: <slrndikacb.7t1.tadmc@magna.augustmail.com>

axel@white-eagle.invalid.uk <axel@white-eagle.invalid.uk> wrote:

> I have a vi
> mug


But how do you get it into "beep mode"?


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


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

Date: Thu, 15 Sep 2005 19:23:11 -0500
From: "Fred@fred.net" <Fred@fred.net>
Subject: Re: sorting data - hash vs. list
Message-Id: <sc3ki1lka0o2ub8v6sodndmu1n2ltijjbb@4ax.com>

On Wed, 14 Sep 2005 22:36:14 -0500, Tad McClellan <tadmc@augustmail.com> wrote:

>Fred@fred.net <Fred@fred.net> wrote:
>> On Mon, 12 Sep 2005 20:41:23 -0500, Tad McClellan <tadmc@augustmail.com> wrote:
>>>Fred@fred.net <Fred@fred.net> wrote:
>>>> On Sun, 11 Sep 2005 22:30:59 GMT, "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
>>>>>"Fred@fred.net" <Fred@fred.net> wrote in
>>>>>news:qf79i19v7kqklccnr86pqr56ck5rc6loio@4ax.com: 
>
>
>> (And broke 2 more c.l.p.m  rules!)
>
>
>>>>>> I have posted here before and been flamed to death,
>>>
>>>
>>>If you engage in socially unacceptable behavior you should be expecting same.
>>>
>>>I would hope that what you took away from that experience was
>>>to act in a socially responsible manner...
>> 
>> Let me say I am honored at this time to have scolded by none other than Tad. I rung the top bell!
>
>
>It would appear then that my hope was misplaced. :-(

I have a sense of your sincerity and as such I do apologize.
I have never really understood you guys and the way you all are about this
group, but I won't be posting anymore , as to follow the guidlines 
would yeild from me little. Other usenet groups are more "relaxed".
See, in my ill-mannered post I managed to learn about a promising
programming language called Ruby. Diamonds in the rough, I guess.


>
>
>>>>>Have you read the posting guidelines for this group? They contain 
>>>>>invaluable information on how to help yourself and help others help you.
>>>> Thanks, but no. 
>
>>>Do you really want an answer, or are you just trolling around?
>> 
>> Trolling no.
>
>
>We will have to agree to disagree on that point then.
Honestly all I needed to hear was "prepend the epoch seconds to the front of the list and sort the zero subscript".

>
>
>> I just wanted friendly advice.
>
>
>Yeah right.


Whatever. There is always a skeptic, a heckler, and the rest of us in any crowd.
I guess we can leave it it up to the reader to flesh those definitions out.

Fred


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

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


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