[18832] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1000 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 27 21:05:38 2001

Date: Sun, 27 May 2001 18:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991011910-v10-i1000@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 27 May 2001     Volume: 10 Number: 1000

Today's topics:
    Re: Clarification and question about FAQ <godzilla@stomp.stomp.tokyo>
    Re: convert letters to numbers <mail@NOSPAMericmarques.net>
    Re: convert letters to numbers (Clinton A. Pierce)
    Re: convert letters to numbers <godzilla@stomp.stomp.tokyo>
        Correct path problem??(related to Perldap) (Hetal)
    Re: Correct path problem??(related to Perldap) <shino_korah@yahoo.com>
    Re: Fcntl usage with tie? <krahnj@acm.org>
    Re: How to connect to MSAccess db w/o creating DSN <sdozois@videotron.ca>
    Re: How to match and print like this ??? <krahnj@acm.org>
        How would have solved this problem? <steffi@shell8.ba.best.com>
    Re: Is there such as thing as an array of structures in (Clinton A. Pierce)
    Re: Nested If <bwilmot@jumpnow.net>
    Re: perl history (*?) <trondmm-usenet@crusaders.no>
    Re: Question on the "use strict" pragma <ahamm.NO$PAM@sanderson.NO$PAM.net.au>
    Re: Question on the "use strict" pragma <ahamm.NO$PAM@sanderson.NO$PAM.net.au>
    Re: Time validation <godzilla@stomp.stomp.tokyo>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 27 May 2001 18:05:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Clarification and question about FAQ
Message-Id: <3B11A440.B1CDC7A0@stomp.stomp.tokyo>

Tad McClellan wrote:
 
> David Ball <db9@NOSPAM.com> wrote:

(snipped)

> >Could someone point me towards the updated FAQ.
 
>    http://dfw.pm.org/clpmisc.shtml
 

This is not the FAQ for this newsgroup. This is a
document you wrote and reflects only your viewpoints.
There are many participants here whom take exception
with this personal document of yours. Be sure you are
clear on this notion, this is not the FAQ for this group.


Godzilla!


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

Date: Sun, 27 May 2001 22:22:49 GMT
From: "Eric" <mail@NOSPAMericmarques.net>
Subject: Re: convert letters to numbers
Message-Id: <Z6fQ6.35019$PF4.70465@news.iol.ie>

OK to be more specific
i want to convert a text string into a number
like convert "Eric" into a number "4573454353"
each time i convert "Eric" it will always give me the same number
if i convert a different string like "Eric Marques" it will give me a
different number like "9567436434" and will always give me the same number
for the same string

its a little like the crypt() function except it will return only numbers


--
Eric Marques
mail@ericmarques.net

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:e8t2ht041d2765eesgghcoe3r5473l5lv5@4ax.com...
> Eric wrote:
>
> >how do i convert a string of text (username) like "Eric Marques" to a
number
> >converting back doesnt matter i dont need it
>
> What number?
>
> if($username eq 'Eric Marques') {
>     return 42;
> }
>
> I don't think this is what you want.
>
> --
> Bart.




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

Date: Sun, 27 May 2001 22:36:48 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: convert letters to numbers
Message-Id: <4kfQ6.91029$V5.15991194@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <Z6fQ6.35019$PF4.70465@news.iol.ie>,
	"Eric" <mail@NOSPAMericmarques.net> writes:
> OK to be more specific
> i want to convert a text string into a number
> like convert "Eric" into a number "4573454353"
> each time i convert "Eric" it will always give me the same number
> if i convert a different string like "Eric Marques" it will give me a
> different number like "9567436434" and will always give me the same number
> for the same string
> 
> its a little like the crypt() function except it will return only numbers

Ah, you want to hash the string as a number.  Look into the MD5 module, 
or use pack to do a simple CRC checksum on the string.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org         Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sun, 27 May 2001 15:51:36 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: convert letters to numbers
Message-Id: <3B1184F8.906214B4@stomp.stomp.tokyo>

Eric wrote:
 
> OK to be more specific

Why where you not specific in your initial article?
A rhetorical question begging no answer, of course.
As many often say, "Truth is self-evident."



> i want to convert a text string into a number
> like convert "Eric" into a number "4573454353"
> each time i convert "Eric" it will always give me the same number
> if i convert a different string like "Eric Marques" it will give me a
> different number like "9567436434" and will always give me the same number
> for the same string


(snipped)

Shouldn't that be 457345353 (some Marques number) ???

You have not indicated conversion of spaces, yes?


Godzilla!
--


#!perl

$name = "Godzilla Rocks";

$name =~ s/(.)/sprintf('%02x',ord($1))/ge;

$name =~ tr/a-z/0-9/;

print "NAME: $name";


$name = "Godzilla Rocks";

$name =~ tr/A-Z/0-9/;

$name =~ tr/a-z/0-9/;

print "\n\nNAME: $name";

exit;



PRINTED RESULTS:
________________

NAME: 4765647069626261205265636173

NAME: 69398990 99299


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

Date: 27 May 2001 15:53:06 -0700
From: hkgandhi@hotmail.com (Hetal)
Subject: Correct path problem??(related to Perldap)
Message-Id: <d6bd81ab.0105271453.6a010945@posting.google.com>

Hello all,

I am really new to perl. I am trying to run Perldap examples scripts that come with download.

When I try to run  "qsearch.pl" from path in my home directory, it gives below error:::::

Can't locate Mozilla/LDAP/Conn.pm in @INC (@INC contains: C:/Master's Project/li
b C:/Master's Project/site/lib .) at qsearch.pl line 29.
BEGIN failed--compilation aborted at qsearch.pl line 29.

And line 29 is 
use Mozilla::LDAP::Conn;   # Main "OO" layer for LDAP

IT may be a simple problem to put the right thing is right place.

Can anyone please enlighten me?

Thanks
hetal


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

Date: Sun, 27 May 2001 17:28:44 -0700
From: "terminalsplash" <shino_korah@yahoo.com>
Subject: Re: Correct path problem??(related to Perldap)
Message-Id: <9es63v$glm@news.or.intel.com>

I guess when u downloaded the scripts u forgot to get the Conn.pm file or u
have put conn.pm in a different path.
I sugest u to first search for conn.pm and copy that file to one of ur
diectories in @inc for eg put that into c:\Master's project/site/lib


"Hetal" <hkgandhi@hotmail.com> wrote in message
news:d6bd81ab.0105271453.6a010945@posting.google.com...
> Hello all,
>
> I am really new to perl. I am trying to run Perldap examples scripts that
come with download.
>
> When I try to run  "qsearch.pl" from path in my home directory, it gives
below error:::::
>
> Can't locate Mozilla/LDAP/Conn.pm in @INC (@INC contains: C:/Master's
Project/li
> b C:/Master's Project/site/lib .) at qsearch.pl line 29.
> BEGIN failed--compilation aborted at qsearch.pl line 29.
>
> And line 29 is
> use Mozilla::LDAP::Conn;   # Main "OO" layer for LDAP
>
> IT may be a simple problem to put the right thing is right place.
>
> Can anyone please enlighten me?
>
> Thanks
> hetal




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

Date: Mon, 28 May 2001 00:56:13 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Fcntl usage with tie?
Message-Id: <3B11A228.8AB827CB@acm.org>

Mark Grimshaw wrote:
> 
> I'm getting the following warning when tieing a DB_File with O_RDONLY:
> 
> Argument "O_RDONLY" isn't numeric in entersub at
>         /usr/local/lib/perl5/5.00502/IP22-irix/DB_File.pm line 255 (#1)
> 
>     (W) The indicated string was fed as an argument to an operator that
>     expected a numeric value instead.  If you're fortunate the message
>     will identify which operator was so unfortunate.
> 
> The DB file is opened and the program works.  However, I'd like to get
> rid of this warning message.  Any ideas what I'm doing wrong?

Add this line to your program:

use Fcntl;



John
-- 
use Perl;
program
fulfillment


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

Date: Sun, 27 May 2001 17:55:31 -0700
From: "Eric Laramee" <sdozois@videotron.ca>
Subject: Re: How to connect to MSAccess db w/o creating DSN
Message-Id: <88gQ6.2769$yT6.339494@weber.videotron.net>

It works perfectly!

Thanks again.

Eric

"Ben Kennedy" <bkennedy99@Home.com> wrote in message
news:S69Q6.9024$lP5.4031959@news1.rdc2.pa.home.com...
>
> "Eric Laramee" <sdozois@videotron.ca> wrote in message
> news:zN8Q6.1435$yT6.98726@weber.videotron.net...
> > HI all,
> >
> > In the following code, I'm connecting to a Access database after
creating
> a
> > DSN (Control Panel - win32ODBC - etc...).
> > This works fine but is there a way to connect to a database without
> manually
> > creating a DSN.  It's easily done in ASP, I'm guessing it's a similar
> > process in Perl.
> >
>
> Its pretty simple, a fully qualified DSN with Access is just the driver
name
> and location of the database:
>
> my $dsn = "driver=Microsoft Access Driver (*.mdb);dbq=$database";
> my $dbh = DBI->connect("dbi:ODBC:$dsn");
>
> More complex ODBC drivers (such as MySQL, Oracle, etc) may require a few
> more parameters in the $dsn string.  Hope this helps --
>
> --Ben Kennedy
>
>
>




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

Date: Sun, 27 May 2001 22:36:25 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How to match and print like this ???
Message-Id: <3B118185.696DE3F@acm.org>

cad wrote:
> 
>  can anyone  help me this  Perl problem,... this is a very difficult for
> me..
> 
> I have  a text file like this:
> 
> MN109 ADDPAD hn
> MN207 n1 ADDPAD hn
> MN208 n1 CEB hn
> MN209 n1 hn
> MP202 ADDPAD NP1 hp
> MP204 ADDPAD NP1 hp
> MP206 NP1 hp
> MP216 net145 ADD n1 hp
> MP205 NP1 CEB n1 hp
> XI119 ADD n1 inv
> MP234 NP1 CEB net145 hp
> 
> every line first element is "master", last element is "instance"
> elements between first and last are all netnames,
> I have already grep to @master,  @netnames #netname already erase duplicate
> and I need do match and print report like this
> 
>                    MN109  MN207  MN208 .... XI119  MP234  #(master)
> #(netname)
> ADD                                                            X
> n1                               X            X                X
> ADDPAD      X          X
> NP1
> X
> ....
> 
> which means I need to print&check  netname line by line
> to check if it mach each text line above if it mach the "master" , print "X"
> can any expert hep me the solve the problem?
> I really don't know how to write a loop or algorithm to do this ><

I had some free time and threw this together, maybe it can get you
started. :)

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

my %graph;
my @masters;
my $mast_wid = 0;
my $col_wid  = 0;
while ( <DATA> ) {
	my @f = split " ";
	my $master = shift @f;
	my $instance = pop @f;
	push @masters, $master;
	$mast_wid = length $master if $mast_wid < length $master;

	for ( @f ) {
		$graph{ $_ }{ $master } = substr $master, 0, 1;
		$col_wid = length if $col_wid < length;
		}
	}
$col_wid++;
$mast_wid++;

printf "%${mast_wid}s" . "%${col_wid}s" x @masters . "\n", ' ',
@masters;
for my $x ( sort keys %graph ) {
	printf "%${mast_wid}s", $x;
	for my $y ( @masters ) {
		printf "%${col_wid}s", exists $graph{$x}{$y} ? $graph{$x}{$y} : ' ';
		}
	print "\n";
	}

__DATA__
MN109 ADDPAD hn
MN207 n1 ADDPAD hn
MN208 n1 CEB hn
MN209 n1 hn
MP202 ADDPAD NP1 hp
MP204 ADDPAD NP1 hp
MP206 NP1 hp
MP216 net145 ADD n1 hp
MP205 NP1 CEB n1 hp
XI119 ADD n1 inv
MP234 NP1 CEB net145 hp



John
-- 
use Perl;
program
fulfillment


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

Date: Mon, 28 May 2001 00:02:21 GMT
From: Robert Nicholson <steffi@shell8.ba.best.com>
Subject: How would have solved this problem?
Message-Id: <yl3n17yqr1u.fsf@shell8.ba.best.com>

I managed to get done what I wanted but I'm very interested to learn
about other ways to solve this problem. The problem was to pass some
html and create nested data structure which will be used later.

Now I decided on using HTML::TokeParser and there's one aspect of this
I do not understand. 

In my code I look for a opening table tag and I wanted parsing to finish
when I find a closing table tag and I would find this in two places in my
code and if I found it first I'd want to unget it to that the other place
would find it and terminate.

I am looking for comments on which set of modules is best suited to this 
problem. If you look at my code you'll see where parse_movies() stops
parsing when it encounters a closing table tag but originally so too
should have parse_cinema but I had to rely on looking for a &nbsp; there
because if I tried to unget the token in parse_movies it wouldn't be
found the next time through the loop in parse_cinema and I don't know
why. 

I would much prefer to rely on a close table tag than the contents of
any text node.

If anybody knows why I cannot unget that token and still terminate
parse_cinema please let me know.

Here's my code.

Again, this is my first time parsing HTML in perl so I'm quite new
at this and would like to know the best set of tools for future tasks.

#! /usr/local/bin/perl5.00502 -w

$url = 'http://www.majorcineplex.com/showtimes/index.php3';

#use lib "$ENV{HOME}/lib/perl5/site_perl";
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use HTML::TokeParser;

%cinemas = (
'pin1'		=> 'Pinklao',
'suk1' 		=> 'Sukhumvit Ekkamai',
'rat1' 		=> 'Ratchayothin',
'ram1' 		=> 'Ramkhamhaeng',
'wor1' 		=> 'World Trade Center', 
'chiangmai2'	=> 'Airport Plaza Chaing Mai'
);

%movies = ();

$ua = LWP::UserAgent->new();
$request = HTTP::Request->new('GET', $url);
$response = $ua->request($request);
$tempfile = "/tmp/temp.$$";
open(OUT,">$tempfile") or die "cannot write to temp file $!\n";
print(OUT $response->as_string);
close(OUT);
parse_temporary_file($tempfile);
unlink($tempfile);

traverse_movies();

sub traverse_movies {

	foreach $cinema (sort(keys %movies)) {
		print "$cinema\n";
		#print "$cinema: @{ $movies{$cinema} }\n";
		foreach $hash (@{$movies{$cinema}}) {
			foreach $movie ( keys %$hash ) {
				print "\t$movie\n";
				foreach $showtime (@{ $hash->{$movie}}) {
					print "\t\t$showtime\n";
				}
			}	
		}		
	}
}

sub parse_temporary_file {
	my $file = shift(@_);

	$p = HTML::TokeParser->new($file);

	while ($token = $p->get_token()) {
		my $type = $token->[0];
		if ($type eq 'S') {
			if ($token->[1] eq 'img') {
				my $url = $token->[2]{src} || '-';
				(my $key =  $url) =~ s/images\/(\w+)\.gif/$1/;

				if (exists $cinemas{$key}) {
					parse_cinema($p,$key);
				}
			}
		}
	}
}

sub parse_cinema {
	my ($parser, $key) = @_;

	my $open_table_seen = 0;

	while ($token = $parser->get_token()) {
		my $type = $token->[0];

		if ($type eq 'S') {
			if ($token->[1] eq 'table') {
				$open_table_seen = 1;
				parse_movies($p,$key);
			}
		}
		if ($type eq 'T') {
			if (($token->[1] =~ /&nbsp;/) && ($open_table_seen)) {
				last;
			}
		}
	}
	print "leaving parse_cinema\n";
}

sub parse_movies {
	my ($parser, $key) = @_;
	my @listings = ();

	while ($token = $parser->get_token()) {
		my $type = $token->[0];
		if ($type eq 'S') {
			if ($token->[1] eq 'tr' && 
				exists $token->[2]{bgcolor} &&
				$token->[2]{bgcolor} eq '#FFFFFF') {
				my @showtimes = ();
				my $rec_ref;
				$rec_ref = parse_movie_td($p,$key);
				push @listings, $rec_ref;
			}
		}
		if ($type eq 'E') {
			if ($token->[1] eq 'table') {
				$movies{$key} = [@listings];
				last;
			}
		}	
	}
}

sub parse_movie_td {
	my ($parser, $key) = @_;
	my @movie_listings = ();
	my @times = ();
	my $title = '';	

	while ($token = $parser->get_token()) {
		my $type = $token->[0];

		if ($type eq 'S') {
			if ($token->[1] eq 'td' &&
				exists $token->[2]{width} &&
				$token->[2]{width} eq '35%') {
				$title = parse_movie_title($p,$key);
			}
			if ($token->[1] eq 'td' &&
				exists $token->[2]{width} &&
				$token->[2]{width} eq '60%') {
				@times = parse_movie_showtimes($p,$key);
				$rec = {};
				$rec->{$title} = [@times];
			}
		}

		if ($type eq 'E') {
			if ($token->[1] eq 'tr') {
				last;
			}	
		}
	}
	return $rec;
}

sub parse_movie_title {
	my ($parser, $key) = @_;
	my $text = '';
	while ($token = $parser->get_token()) {
		my $type = $token->[0];
		
		if ($type eq 'S') {
			if ($token->[1] eq 'font') {
				$text = $parser->get_text("/font") || "-";
				$text =~ s/^\s+//;	#leading space
			 	$text =~ s/\n//g;	#newline
				$text =~ s/\s+$//g;	#trailing space
				$text =~ s/\s+/ /g;	#big gaps
				#print "$text\n";
				last;
			}
		}
	}	
	return $text;
}	

sub parse_movie_showtimes {
	my ($parser, $key) = @_;
	my $text = '';
	my @times = ();

	while ($token = $parser->get_token()) {
		my $type = $token->[0];
		if ($type eq 'S') {
			if ($token->[1] eq 'font') {
				$text = $parser->get_text("/font") || "-";
				$text =~ s/^\s+//;	#leading space
				$text =~ s/\n//g;	#newline
				$text =~ s/\s+$//g;	#trailing space
				$text =~ s/\s+/ /g;	#big gaps
				#print "$text\n";
				@times = split(/ /,$text);
				last;
			}
		}
	}
	return @times;
}


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

Date: Sun, 27 May 2001 22:34:31 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Is there such as thing as an array of structures in Perl?
Message-Id: <XhfQ6.91022$V5.15989819@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <B737A6D5.6A38%chris_newman@bigpond.com>,
	Chris Newman <chris_newman@bigpond.com> writes:
> I come from using C++ where I use these regularly but have not seen a
> mention of these in any of the books I have read for example Learning Perl.
> Perl 5 by example

Then you've got the wrong book.  :)

They're usually mentioned in context of references, and the documentation for
perldsc (data structures cookbook) is a great place to start for an experienced
programmer.

For example, here's an array of hash 'structures':

@books=( { title => 'Moby Dick', 
	   author => 'Mellville' },
	{ title => 'Gone with the Wind',
	   author => 'Mitchell' }
);

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours  *and*
  clintp@geeksalad.org         Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man,     for details, see http://geeksalad.org     
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: Sun, 27 May 2001 15:05:04 -0700
From: "Brian Wilmot" <bwilmot@jumpnow.net>
Subject: Re: Nested If
Message-Id: <9ertv5$tudo$1@ID-44450.news.dfncis.de>

Thank you...to think everything would get hung up on that.

--
Brian Wilmot
http://www.jumpnow.net/
http://www.uglybillboards.com/
"You can die but you're never dead"  -  Red Hot Chili Peppers
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3B117324.96748C1E@stomp.stomp.tokyo...
> Brian Wilmot wrote:
>
> > Ok...I might just be an idiot but what is wrong with the expression
>
> > If ($username eq "")
> >    {
> >         print "Please press your browser's back button and enter a
business
> > name.\n";
> >          exit;
> >     }
>
>
> Use a lowercase "if" for this.
>
> if ($username .. etc
>
> Godzilla!




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

Date: Sun, 27 May 2001 23:23:52 GMT
From: "Trond Michelsen" <trondmm-usenet@crusaders.no>
Subject: Re: perl history (*?)
Message-Id: <c0gQ6.4521$qR5.252028@news01.chello.no>


Bart Lateur <bart.lateur@skynet.be> skrev i
meldingsnyheter:kkl2ht8tfq3fddq8j3o28unflg4dbqtiev@4ax.com...
>>    For example, I have written something that uses the *?
>> capability for regular expressions.  I'm pretty sure this
>> was not in 4.036, which (I think) means that a lot of people
>> with five-year-old installations won't be able to run it.

Actually, perl 5.000 was relased in october 94, so we're talking almost
7-year-old installations here. It's nice to think of people with obsolete
systems, but striving for perl4 compatibility seems to be stretching it a
bit too far.
BTW: I'm sure *? is the least of your problems if you want your program to
run under perl4. I think I'd miss lexical variables, references and modules
the most.

> I think the *? AKA non-greedy matching was added in 5.005.

$ /local/perl/5.001/bin/perl -le 'print "(abc)(def)" =~ /\((.*?)\)/'
abc

Nope. It works in 5.001 as well.
In the changes-file for 5.001
http://www.perldoc.com/perl5.6/Changes5.001.html
there is a reference to a patch that fixes a bug with .*?, so I'm guessing
*? was in 5.000 as well. Unfortunately, I don't have 5.000 available, so I
can't confirm it. I could not find any mention of *? in Changes5.000.

(just to confirm my perl-version..)
$ /local/perl/5.001/bin/perl -v

This is perl, version 5.001

        Unofficial patchlevel 1m.

Copyright 1987-1994, Larry Wall

Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5.0 source kit.

--
Trond Michelsen





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

Date: Mon, 28 May 2001 10:26:30 +1000
From: "Andrew Hamm" <ahamm.NO$PAM@sanderson.NO$PAM.net.au>
Subject: Re: Question on the "use strict" pragma
Message-Id: <3b119b89$1@news.iprimus.com.au>

Mark Jason Dominus wrote in message <3b0e8f49.1eaa$3b2@news.op.net>...
>
>I don't understand why people keep saying this, because 'strict refs'
>is obviously a run-time check.  Have you run a benchmark?  Do you know
>that the time is negligible?
>
ok, after 5 seconds thought, strict refs has to be runtime.

But, without calling anyone a monkey, can you prove that strict barewords
and strict vars is runtime too? They're an important part of the three-piece
set.

barewords: if a bare identifier is seen and it's not a known subroutine -
failure. Sounds like a compiler job to me.

vars: if a $var (or %var or @VAR) is seen and it's not a my or declared by
use vars - failure. Sounds like a compiler job to me.

Now who's a monkey?

--
"Dis act ain't about lafter - it's about comedy" - Andrew Dice Clay





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

Date: Mon, 28 May 2001 10:28:36 +1000
From: "Andrew Hamm" <ahamm.NO$PAM@sanderson.NO$PAM.net.au>
Subject: Re: Question on the "use strict" pragma
Message-Id: <3b119c05$1@news.iprimus.com.au>

nobull@mail.com wrote in message ...
>mjd@plover.com (Mark Jason Dominus) writes:
>
>> In article <9ekbmt$ln4$3@bob.news.rcn.net>,
>> Eric Bohlman <ebohlman@omsdev.com> wrote:
>> >In comp.lang.perl.misc Leo <leapius@hotmail.com> wrote:
>> >> I have a few questions regarding the "use strict" pragma:
>> >
>> >> 1. Does adding use strict to my program slow it's execution down in
any way?
>> >
>> >Nope.  Its effects occur only at compile time, and the time taken for
the
>> >extra checks is negligible compared to the I/O time the compiler spends
>> >reading in your program.
>>
>> I don't understand why people keep saying this, because 'strict refs'
>> is obviously a run-time check.
>
>But the check is in the code that implements symbolic refs, to check
>to see if use strict refs is in effect.  As such the very existance of
>"strict refs" introduces an overhead into code that uses symbolic
>references.  If your code would run under "strict refs" the only speed
>gain you'll get by removing it is at compile time.
>
>Eg:
>
>   if (PL_op->op_private & HINT_STRICT_REFS)
>     DIE(aTHX_ PL_no_symref, sym, "an ARRAY");
>   gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVAV);
>
Relative to the other activity going on generally, you'd have to expect the
effect to be minimal. Would anyone care to test? I don't, because I don't
call extreme runtime efficiency the most important part of perl. If I want
to squeeze every last cpu cycle out of a job I'll use C. I care more about
my time and the expressiveness of the language. I'll leave use strict in the
code for ever.
--
"Dis act ain't about lafter - it's about comedy" - Andrew Dice Clay





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

Date: Sun, 27 May 2001 15:13:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Time validation
Message-Id: <3B117BF6.78DB2C65@stomp.stomp.tokyo>

Daryl Shute wrote:
 
> Sorry Godzilla,
> Here is the code in trying, and YES sometimes even in a 24 hour intranet world
> things wont get done without human intervention.
 
> sub BEGIN {

(snipped)


Sure took you a long time to invent some excuse
which appears legitimate, nearly a week. Bored?
Nobody around to troll? You know this newsgroup
is not open for your daily trolling on weekends.
You should code your newsreader to remind you.


print "<CENTER><H1><BLINK>NOTE!</BLINK></H1></CENTER>
    Our normal business hours are ....
    Analysts are available only during normal business hours
    Please call this number during non-business hours....
    Your form submission will only be read during normal business hours.
    <P>
    [ FORM ACTION BUTTON ]
    [  FORM TEXT FIELDS  ]
    ...etc ad nauseam";



No human intervention nor business hours coding is needed for a form action.

Godzilla!


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

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


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