[25731] in Perl-Users-Digest
Perl-Users Digest, Issue: 7971 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 13 14:05:37 2005
Date: Wed, 13 Apr 2005 11:05:09 -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 Wed, 13 Apr 2005 Volume: 10 Number: 7971
Today's topics:
Angle Brackets vs. foreach Nathan.Neff@gmail.com
Re: Angle Brackets vs. foreach <richard@zync.co.uk>
can anyone explain the last two lines to me?thanks! biomahui@gmail.com
CPAN Module 'Undefined value assigned' ryanmhuc@yahoo.com
Re: Is Perl open source? xhoster@gmail.com
LWP::UserAgent and basic authentication <ThomasKratz@REMOVEwebCAPS.de>
Re: LWP::UserAgent and basic authentication <no@email.com>
Re: LWP::UserAgent and basic authentication <ThomasKratz@REMOVEwebCAPS.de>
Re: Matching mixed up words <tassilo.von.parseval@rwth-aachen.de>
Re: Matching mixed up words (Anno Siegel)
newbie questions about File IO <crema@bu.edu>
Re: newbie questions about File IO <pilkowsk@informatik.uni-marburg.de>
Re: newbie questions about File IO <crema@bu.edu>
Re: Openings in an online game company for programmers <1usa@llenroc.ude.invalid>
Parser.pm -- not well-formed error <rishid@gmail.com>
Re: Parser.pm -- not well-formed error <rishid@gmail.com>
Re: Parser.pm -- not well-formed error <rishid@gmail.com>
Re: Parser.pm -- not well-formed error <mirod@mirod.org>
Re: Web Interface and index.pl separated?!? <lawrence.tierney@bipcontracts.com>
Re: Web Interface and index.pl separated?!? <1usa@llenroc.ude.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Apr 2005 08:37:27 -0700
From: Nathan.Neff@gmail.com
Subject: Angle Brackets vs. foreach
Message-Id: <1113406647.262467.114430@l41g2000cwc.googlegroups.com>
I recently encountered a performance problem which was fixed by
changing:
while($file = <@files>)
to
foreach $file(@files)
Can anyone explain the reason for the performance hit? My program took
3 minutes using the <> operator, vs. about 2 seconds using foreach.
I realize that the angle brackets operator <> is not really for list
iteration. But when you evaluate it in scalar context, it does return
the contents of the list, one by one.
What is Perl doing that causes such a hit?
Thanks,
--Nate
------------------------------
Date: Wed, 13 Apr 2005 17:41:37 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: Angle Brackets vs. foreach
Message-Id: <pan.2005.04.13.17.41.37.265726@zync.co.uk>
On Wed, 13 Apr 2005 08:37:27 -0700, Nathan.Neff wrote:
> I recently encountered a performance problem which was fixed by
> changing:
Not really. You changed the code so that it did something different which
took less time. Probably. It's hard to say for sure.
The while and the foreach do different things.
> while($file = <@files>)
From "perldoc perlop":
"If what's within the angle brackets is neither a filehandle nor a simple
scalar variable containing a filehandle name, type-glob, or typeglob
reference, it is interpreted as a filename pattern to be globbed, and
either a list of filenames or the next filename in the list is returned,
depending on context."
As I understand the above, @files will be used as a pattern to be globbed.
This means the elements of @files will be joined with the value of $" and
the resulting string will be globbed. The default value of $" is a space,
which will result in such a string that the effect will be that each
element of @files will be treated as a pattern to be globbed. IFF no
filename is returned as a result of globbing a particular pattern, will
the pattern itself be returned.
So the number of iterations of the while loop above depends on the
contents of @files and the names of the files in the current directory for
your executing script.
For example, if your CWD contains these files: 1.txt 2.txt 3.dat
then these values of @files will return the given lists when globbed using
<@files> ...
@files = ('txt') returns ('txt') # no match (no wildcard)
@files = ('*txt') returns ('1.txt','2.txt') # 2 matches
@files = ('*txt','dat') returns ('1.txt','2.txt','dat') # no wildcard
@files = ('*txt','*dat') returns ('1.txt','2.txt','3.dat')
> foreach $file(@files)
This merely iterates over the elements of @files in the standard way.
> Can anyone explain the reason for the performance hit? My program took
> 3 minutes using the <> operator, vs. about 2 seconds using foreach.
>
> I realize that the angle brackets operator <> is not really for list
> iteration. But when you evaluate it in scalar context, it does return
> the contents of the list, one by one.
Not exactly. See above.
>
> What is Perl doing that causes such a hit?
It's hard to say without knowing the contents of your loop.
Rich
------------------------------
Date: 13 Apr 2005 08:00:26 -0700
From: biomahui@gmail.com
Subject: can anyone explain the last two lines to me?thanks!
Message-Id: <1113404426.451039.267460@f14g2000cwb.googlegroups.com>
#!/usr/bin/perl
$_='OTcommailDngATghiliaguans';
1 while s/(.{5})(.{5})?/$_{$2}=$1,$2/e;
print while $_=$_{$_};
------------------------------
Date: 13 Apr 2005 06:10:50 -0700
From: ryanmhuc@yahoo.com
Subject: CPAN Module 'Undefined value assigned'
Message-Id: <1113397850.112023.56180@f14g2000cwb.googlegroups.com>
I can no longer able to use perl's CPAN to download and install
modules. I can start up the shell but when I attempt to install a
module it gets an error when trying to FTP the packages. On the shell
start up I get the following error:
Undefined value assigned to typeglob at (eval 13) line 15, <RC> line
11.
Warning [/etc/inputrc line 11]:
Invalid variable `mark-symlinked-directories'
There are no other CPAN shells running. On another identical server
CPAN is working fine. I've tried removing the CPAN module and
resintalling. The install goes fine but I still get the same error on
start up. Any suggestions on how to solve this error?
------------------------------
Date: 13 Apr 2005 17:56:49 GMT
From: xhoster@gmail.com
Subject: Re: Is Perl open source?
Message-Id: <20050413135649.108$a9@newsreader.com>
soup_or_power@yahoo.com wrote:
> If much of perl is implemented in C, why should we prefer Perl over C
> for performance critical projects?
Because 1 plus 3 is less than 10 plus 1.
Time spent writing and righting the program is time during which the
program cannot be "performancing".
> Please don't get me wrong. I prefer Perl over C if performance is not
> the issue.
I prefer to wash my hair with shampoo rather than with Perl. It is
not something to be ashamed of.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Wed, 13 Apr 2005 17:41:42 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: LWP::UserAgent and basic authentication
Message-Id: <425d3db8$0$825$bb690d87@news.main-rheiner.de>
I have a third party webserver that expects xml datasets to be uploaded
one per request (buggy concept, but not mine). The URL needs basic
authentication. If I understand the docs and sources of libwww correctly,
LWP::UserAgent is supposed to work like this:
The request method of the LWP::UserAgent object first sends a
simple_request without authentication. If the response indicates that
basic authorization is required and I supplied the object with
credentials, the request is passed to LWP::Authen::Basic::authenticate,
which will rerequest the URL with proper authentication information.
The problem is, that I will have to do a lot of requests and the webserver
chokes on the many unauthorized requests (non standard webserver, buggy
handling). Is there a possibility to skip the first request and let
LWP::Authen::Basic handle the request directly?
I could of cause inherit from LWP::UserAgent and roll my own request
method. But there could be somewhat more elegant.
TIA
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: Wed, 13 Apr 2005 17:01:42 +0100
From: Brian Wakem <no@email.com>
Subject: Re: LWP::UserAgent and basic authentication
Message-Id: <3c4u37F6ge0uvU1@individual.net>
Thomas Kratz wrote:
> I have a third party webserver that expects xml datasets to be uploaded
> one per request (buggy concept, but not mine). The URL needs basic
> authentication. If I understand the docs and sources of libwww
> correctly, LWP::UserAgent is supposed to work like this:
>
> The request method of the LWP::UserAgent object first sends a
> simple_request without authentication. If the response indicates that
> basic authorization is required and I supplied the object with
> credentials, the request is passed to LWP::Authen::Basic::authenticate,
> which will rerequest the URL with proper authentication information.
>
> The problem is, that I will have to do a lot of requests and the
> webserver chokes on the many unauthorized requests (non standard
> webserver, buggy handling). Is there a possibility to skip the first
> request and let LWP::Authen::Basic handle the request directly?
>
> I could of cause inherit from LWP::UserAgent and roll my own request
> method. But there could be somewhat more elegant.
>
> TIA
> Thomas
I have not read the docs but I do it like this -
my $ua = LWP::UserAgent->new;
$ua->agent("MyAgent/1.0");
my $req = HTTP::Request->new(GET => $url);
$req->authorization_basic('user', 'pass');
my $res = $ua->request($req);
And I can say without any doubt (observing the access_log of the server
it speaks to) that it passes the user/pass *straight away*.
--
Brian Wakem
------------------------------
Date: Wed, 13 Apr 2005 19:32:22 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: LWP::UserAgent and basic authentication
Message-Id: <425d57a6$0$830$bb690d87@news.main-rheiner.de>
Brian Wakem wrote:
> I have not read the docs but I do it like this -
>
> my $ua = LWP::UserAgent->new;
> $ua->agent("MyAgent/1.0");
> my $req = HTTP::Request->new(GET => $url);
> $req->authorization_basic('user', 'pass');
> my $res = $ua->request($req);
authorization_basic does not work for me, because I have to set a special
realm with $ua->credentials.
>
> And I can say without any doubt (observing the access_log of the server
> it speaks to) that it passes the user/pass *straight away*.
Perhaps I misread the code of the request method. But the first thing it
does is call $ua->simple_request, and I cannot see any call to
LWP::Authen::Basic there.
Could you please add a:
use LWP::Debug qw(+);
at the top of your code
Then I see something like this on STDOUT for each request:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST <URL>
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 853 bytes
LWP::Protocol::collect: read 2219 bytes
LWP::UserAgent::request: Simple response: Unauthorized
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST <URL>
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 858 bytes
LWP::Protocol::collect: read 905 bytes
LWP::UserAgent::request: Simple response: OK
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: Wed, 13 Apr 2005 12:33:00 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Matching mixed up words
Message-Id: <slrnd5ptas.1fk.tassilo.von.parseval@localhost.localdomain>
Also sprach Anno Siegel:
> Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in comp.lang.perl.misc:
>> Also sprach A. Sinan Unur:
>>
>> > DAVISM@ecr6.ohio-state.edu (Michael T. Davis) wrote in
>> > news:d3h7bu$hbt$1@charm.magnus.acs.ohio-state.edu:
>
> [anagram detection by counting letters]
>
>> A faster solution appears to involve sort(): split both strings, sort
>> them and compare for equality. According to a benchmark:
>
> [benchmark snipped]
>
> Interesting, since counting is linear and sorting is n*log n. Presumably,
> with huge words, counting would win in the end, but there probably
> never was a language (not even German) with words long enough to bring
> out the difference.
Altering the benchmark a little so that we can change the length of the
words more easily:
use Benchmark qw/cmpthese/;
sub check {
my ($orig, $target) = @_;
my %c;
++$c{$_} for split //, $orig;
--$c{$_} for split //, $target;
return ! grep $_, values %c;
}
sub check_sort {
my ($orig, $target) = @_;
my $o = join '', sort split //, $orig;
my $t = join '', sort split //, $target;
return $o eq $t;
}
my $len = shift;
my $key = join '', map { ['a'..'z']->[rand 26] } 1 .. $len;
cmpthese(-2, {
histo => sub {
check($key, scalar reverse $key);
},
sort => sub {
check_sort($key, scalar reverse $key);
},
});
$len = 20:
Rate histo sort
histo 8029/s -- -19%
sort 9962/s 24% --
$len = 50:
Rate histo sort
histo 3600/s -- -10%
sort 4015/s 12% --
$len = 100:
Rate histo sort
histo 1912/s -- -3%
sort 1981/s 4% --
$len = 200:
Rate sort histo
sort 972/s -- -5%
histo 1018/s 5% --
Aha! So the words need to be unrealistically long in order for the
linear method to win. Which says quite something about the efficiency of
perl's sort implementations. Of course, check() could be made to return
earlier, for instance when a negative value shows up in the second
for-loop. The same is true for the final grep().
Still, for real-world words I suspect using sort() is still a very
efficient (both coding- and runtime-wise) solution.
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
------------------------------
Date: 13 Apr 2005 12:31:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Matching mixed up words
Message-Id: <d3j3f6$ire$1@mamenchi.zrz.TU-Berlin.DE>
Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in comp.lang.perl.misc:
> Also sprach Anno Siegel:
> > Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in
> comp.lang.perl.misc:
> >> Also sprach A. Sinan Unur:
> >>
> >> > DAVISM@ecr6.ohio-state.edu (Michael T. Davis) wrote in
> >> > news:d3h7bu$hbt$1@charm.magnus.acs.ohio-state.edu:
> >
> > [anagram detection by counting letters]
> >
> >> A faster solution appears to involve sort(): split both strings, sort
> >> them and compare for equality. According to a benchmark:
> >
> > [benchmark snipped]
> >
> > Interesting, since counting is linear and sorting is n*log n. Presumably,
> > with huge words, counting would win in the end, but there probably
> > never was a language (not even German) with words long enough to bring
> > out the difference.
>
> Altering the benchmark a little so that we can change the length of the
> words more easily:
[shortened]
> $len = 100:
>
> Rate histo sort
> histo 1912/s -- -3%
> sort 1981/s 4% --
>
> $len = 200:
>
> Rate sort histo
> sort 972/s -- -5%
> histo 1018/s 5% --
>
> Aha! So the words need to be unrealistically long in order for the
> linear method to win.
I wouldn't have been amazed to find the crossover length even higher,
at 1000 or so.
> Which says quite something about the efficiency of
> perl's sort implementations. Of course, check() could be made to return
> earlier, for instance when a negative value shows up in the second
> for-loop. The same is true for the final grep().
List::Util::first is the grep replacement for that. How much it
saves depends heavily on the distribution of the strings. If
strings vary wildly, it can save a lot, if most comparisons are
for almost-anagrams it won't save so much.
> Still, for real-world words I suspect using sort() is still a very
> efficient (both coding- and runtime-wise) solution.
In one implementation I used byte vectors for letter counting, a la
embag {
my $bag = '';
++ vec( $bag, ord $_, 8) for split //, shift;
$bag;
}
which is easily Inline-able. Equality of counts is 'eq', like with
sorting. The count vectors can be compacted using another level of
indirection ( $charno[ ord $_] instead of ord $_), which is still
easily Inlined. Sorting was no option for the application, so I never
benchmarked against it, but I'd expect the Inlined code to be in the
same ballpark, even for short strings.
Anno
------------------------------
Date: Wed, 13 Apr 2005 11:08:53 -0400
From: Matthew Crema <crema@bu.edu>
Subject: newbie questions about File IO
Message-Id: <d3jcm7$38d$1@news3.bu.edu>
Hello,
I'm brand new to Perl. I spent the last few weeks reading the "Llama"
and I want to get started now. This question is more for a beginner's
curiosity than an actual application.
Say I have 1000 text files called:
data1.dat
data2.dat
data3.dat
.
.
.
data1000.dat
Each of these files has 32768 integer numbers (between -100 and 100)
like so:
10
-20
-14
.
.
.
90
Say I issue the command:
$cat *.dat > one_large_file
This takes about 1.5 seconds.
However, the Perl script I wrote takes 28 seconds . Am I doing
something wrong? My guess is that it has something to do with type
conversions behind the scenes.
Thanks.
-Matt
Here's the code:
#! /usr/bin/perl -w
use strict;
my $NFILES = 1000;
for (my $i=1;$i<=$NFILES;++$i) {
my $filename = "data$i.dat";
open (DATA, "< $filename") or die "Cannot open file: $!";
while (my $line = <DATA>){
print $line;
}
close DATA;
}
------------------------------
Date: Wed, 13 Apr 2005 19:42:37 +0200
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: newbie questions about File IO
Message-Id: <3c53usF6haf5gU1@individual.net>
* Matthew Crema schrieb:
>
> Say I have 1000 text files called:
> Say I issue the command:
> $cat *.dat > one_large_file
>
> This takes about 1.5 seconds.
>
> However, the Perl script I wrote takes 28 seconds . Am I doing
> something wrong? My guess is that it has something to do with type
> conversions behind the scenes.
Perl's default behavior while reading files with the <>-operator is a
line-by-line proceeding. From that place your code opens every file and
read in each line separately, just to print it out. Perl has to search
for each newline in your files -- that's why your code slows down.
But it's simple to change this behavior. Try to read in your files in
chunks of some kilobytes like
#!usr/bin/perl -w
use strict;
for my $i ( 1 .. 1000 ) {
my $file = "data$i.dat";
open my $fh, '<', $file or die "Cannot open '$file': $!";
local $/ = \8192;
print $_ while <$fh>;
}
I'm sure, cat is working this way. The important statement is the
assigning to the special var »$/«. Have a look at `perldoc perlvar`
where you can learn more about this variable.
regards,
fabian
------------------------------
Date: Wed, 13 Apr 2005 14:02:25 -0400
From: Matthew Crema <crema@bu.edu>
Subject: Re: newbie questions about File IO
Message-Id: <d3jmri$nrj$1@news3.bu.edu>
Fabian Pilkowski wrote:
> * Matthew Crema schrieb:
>
>>Say I have 1000 text files called:
>
>
>>Say I issue the command:
>>$cat *.dat > one_large_file
>>
>>This takes about 1.5 seconds.
>>
>>However, the Perl script I wrote takes 28 seconds . Am I doing
>>something wrong? My guess is that it has something to do with type
>>conversions behind the scenes.
>
>
> Perl's default behavior while reading files with the <>-operator is a
> line-by-line proceeding. From that place your code opens every file and
> read in each line separately, just to print it out. Perl has to search
> for each newline in your files -- that's why your code slows down.
>
> But it's simple to change this behavior. Try to read in your files in
> chunks of some kilobytes like
>
> #!usr/bin/perl -w
> use strict;
> for my $i ( 1 .. 1000 ) {
> my $file = "data$i.dat";
> open my $fh, '<', $file or die "Cannot open '$file': $!";
> local $/ = \8192;
> print $_ while <$fh>;
> }
>
> I'm sure, cat is working this way. The important statement is the
> assigning to the special var »$/«. Have a look at `perldoc perlvar`
> where you can learn more about this variable.
>
> regards,
> fabian
Thanks.
Works great.
-Matt
------------------------------
Date: Wed, 13 Apr 2005 12:56:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Openings in an online game company for programmers
Message-Id: <Xns96375AF35F8AFasu1cornelledu@127.0.0.1>
step_y@yahoo.com wrote in
news:1113377536.093518.43970@o13g2000cwo.googlegroups.com:
> Subject: Openings in an online game company for programmers
Go to:
<URL: http://jobs.perl.org/>
Please do not post job openings here.
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: 13 Apr 2005 06:21:04 -0700
From: "Rishi Dhupar" <rishid@gmail.com>
Subject: Parser.pm -- not well-formed error
Message-Id: <1113398464.966238.41500@o13g2000cwo.googlegroups.com>
Hi,
General idea of what I am doing: Running a file scan on my hard drive
that is storing the info into an XML file. Then another perl script I
have wrote is parsing this data and making use of it.
Keep getting this error:
not well-formed (invalid token) at line 1742, column 29, byte 67305 at
C:/Perl/s
ite/lib/XML/Parser.pm line 187
The line in the XML file is:
<FileName>3=BD Floppy (A).lnk</FileName>
The issue is obviosuly the 1/2 symbol. Is there anyway way to get
around this error? I cannot delete the 1/2 symbol or anything, I need
it exactly the way it is.
Any way to have the parser not validate the XML data or something and
just take it as a literal string?
------------------------------
Date: 13 Apr 2005 06:34:43 -0700
From: "Rishi Dhupar" <rishid@gmail.com>
Subject: Re: Parser.pm -- not well-formed error
Message-Id: <1113399283.037097.151400@l41g2000cwc.googlegroups.com>
Just figured it out.
I don't know the XML specs too well so I kind of made up the format the
file scan outputted.
Added this line to the top of the document:
<?xml version="1.0" encoding="ISO-8859-1"?>
And seems to all work.
Thanks
------------------------------
Date: 13 Apr 2005 07:05:59 -0700
From: "Rishi Dhupar" <rishid@gmail.com>
Subject: Re: Parser.pm -- not well-formed error
Message-Id: <1113401159.888682.262770@g14g2000cwa.googlegroups.com>
Is there any encoding that allows & symbols in XML? Without having to
replace to &
------------------------------
Date: Wed, 13 Apr 2005 16:37:22 +0200
From: Michel Rodriguez <mirod@mirod.org>
Subject: Re: Parser.pm -- not well-formed error
Message-Id: <425d2ea2$0$11715$5fc30a8@news.tiscali.it>
Rishi Dhupar wrote:
> Is there any encoding that allows & symbols in XML? Without having to
> replace to &
no:
http://xml.com/axml/target.html#syntax (look at the (T) comment, while
non-normative, Tim Bray should know what he is talking about ;--)
--
mirod
------------------------------
Date: Wed, 13 Apr 2005 12:43:44 GMT
From: "Lord0" <lawrence.tierney@bipcontracts.com>
Subject: Re: Web Interface and index.pl separated?!?
Message-Id: <4u87e.27704$pA6.19966@newsfe1-win.ntli.net>
"Do you think that i must separate the page's interface in a file by itself
and then in another index.pl make calculations and stuff with it:"
It *IS* easier to put everything in one place but this can quickly become
unmaintainable for anything but the smallest project. Many "design patterns"
would suggest that you keep your presentation i.e. your webpage and your
business layer i.e. your calculations seperate. You may want to google for
"model view controller" for some more info on this.
------------------------------
Date: Wed, 13 Apr 2005 12:55:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Web Interface and index.pl separated?!?
Message-Id: <Xns96375AA7597FDasu1cornelledu@127.0.0.1>
Nikos <hackeras@gmail.com> wrote in news:d3hgf1$p2u$1@nic.grnet.gr:
> Inside my webpage index.pl i ahve the Perl code and the interface of
> the page: Do you think that i must separate the page's interface in a
> file by itself and then in another index.pl make calculations and
> stuff with it:
The simplest templating solution that results in complete separation of
HTML, Javascript, CSS and what not is, IMHO, HTML::Template. You might
want to give it a shot.
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 7971
***************************************