[29074] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 318 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 9 18:09:59 2007

Date: Mon, 9 Apr 2007 15:09: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           Mon, 9 Apr 2007     Volume: 11 Number: 318

Today's topics:
    Re: "Standard" template / config modules? <cwilbur@chromatico.net>
        Absolute Path errors <hackeras@gmail.com>
    Re: Absolute Path errors usenet@DavidFilmer.com
    Re: Absolute Path errors <hackeras@gmail.com>
        any simple way to do this? <robertchen117@gmail.com>
    Re: any simple way to do this? <sisyphus1@nomail.afraid.org>
    Re: any simple way to do this? <bik.mido@tiscalinet.it>
    Re: any simple way to do this? <mritty@gmail.com>
        Creating a file to print to <r.f.richmond@bigpond.com>
    Re: Creating a file to print to <spamtrap@dot-app.org>
    Re: Creating a file to print to <bik.mido@tiscalinet.it>
    Re: Creating a file to print to <paduille.4061.mumia.w+nospam@earthlink.net>
        HTML::Template module in perl <nitindutt2005@gmail.com>
    Re: HTML::Template module in perl <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: HTML::Template module in perl <glex_no-spam@qwest-spam-no.invalid>
    Re: Passing hash to a subroutine <bik.mido@tiscalinet.it>
    Re: Passing hash to a subroutine <tadmc@augustmail.com>
        Problem configuring Apache with php support to run scri <hackeras@gmail.com>
    Re: Problem configuring Apache with php support to run  usenet@DavidFilmer.com
    Re: Problem configuring Apache with php support to run  <hackeras@gmail.com>
    Re: prototypes - use or not? <greg.ferguson@icrossing.com>
    Re: what's wrong calling a Perl/CGI script in Perl/CGI  <glex_no-spam@qwest-spam-no.invalid>
    Re: what's wrong calling a Perl/CGI script in Perl/CGI  <noreply@gunnar.cc>
    Re: what's wrong calling a Perl/CGI script in Perl/CGI  <glex_no-spam@qwest-spam-no.invalid>
        Why No Famous Open Source Projects From Britain/Ireland <callingrw@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 09 Apr 2007 10:01:41 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: "Standard" template / config modules?
Message-Id: <873b39abp6.fsf@mithril.chromatico.net>

>>>>> "J" == Jamie  <nospam@geniegate.com> writes:

    J> But as far as something like, "Config::General" (for example)
    J> is it considered accepted practice to just include it with the
    J> script and install it as a local package?

"This software package requires Perl 5.8.5 or better and
Config::General.  Please be sure they are installed and up-to-date
before continuing the installation."

Let the users and system administrators install the necessary
software; it's inappropriate to copy it yourself into a local
directory, because that way lies DLL hell, and you'll really tick off
savvy users.  If you have a lot of dependencies, you can create an
installer script to automate the process; a very good model is the one
Matt S Trout put together for Catalyst. 

If you simply *must* cater to the cut-rate web host crowd, you're
better off using PHP anyway, since it's likely to be (marginally)
better supported; and a user who chooses an inadequate web host over
an adequate one on the basis of saving $5 a month is not a customer
you really want anyway.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: 9 Apr 2007 14:33:01 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Absolute Path errors
Message-Id: <1176154381.078092.35160@n76g2000hsh.googlegroups.com>

Tonigth i chnages the scheme of my perl webpage

instead of having index.html redirect to cgi-bin\index.pl

i set in httpd.conf DirectoryIndex index.html cgi-bin/index.pl

but all links to other ple scripts inside my index.pl not workign any
more cause thye y were relative.

Then i changed them alla links to files an folders to absolute
startinf with a leading / (d:\www which is my DocumentRoor)

Now script can work but

but statements like :

my @files = glob "/data/text/*.txt";

and

my @tips;
open FILE, "/data/text/tips.txt" or die $!;
     @tips = <FILE>;
close FILE;

arent opening files or loading them into arrays.

The paths though to files ae correct.

I just dont see the error.



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

Date: 9 Apr 2007 14:43:03 -0700
From: usenet@DavidFilmer.com
Subject: Re: Absolute Path errors
Message-Id: <1176154983.773222.201700@e65g2000hsc.googlegroups.com>

On Apr 9, 2:33 pm, "=CE=9D=CE=AF=CE=BA=CE=BF=CF=82" <hacke...@gmail.com> wr=
ote:

> open FILE, "/data/text/tips.txt" or die $!;

This is I/O which is serviced directly by the operating system, not
the webserver.  You must specify the full path as known by the OS
(including the path to your document root, if that's where the stuff
is), not a full or relative path as known only to your webserver.

--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)



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

Date: 9 Apr 2007 14:59:38 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Re: Absolute Path errors
Message-Id: <1176155978.166798.308100@q75g2000hsh.googlegroups.com>


=CF/=C7 usenet@DavidFilmer.com =DD=E3=F1=E1=F8=E5:
> On Apr 9, 2:33 pm, "=CD=DF=EA=EF=F2" <hacke...@gmail.com> wrote:
>
> > open FILE, "/data/text/tips.txt" or die $!;
>
> This is I/O which is serviced directly by the operating system, not
> the webserver.  You must specify the full path as known by the OS
> (including the path to your document root, if that's where the stuff
> is), not a full or relative path as known only to your webserver.

But why? The Webserver is supposed to identify both relative and
absolute paths.

/ stands for DocumentRoot, why cant it fid the files based on that ( /
=3D "d:\www )

I dotn see why.

nd also hw come it wont open files or load arrasy with files but be
able to perform the following line ?
the following line is also an absolute path based on document root and
it does work!

Tr( td( {class=3D>'lime'},    a( {href=3D>'/cgi-bin/show.pl?
name=3Dshowlog'},  h1( {class=3D>'lime'}, $host )))),



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

Date: 9 Apr 2007 01:59:52 -0700
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: any simple way to do this?
Message-Id: <1176109192.851005.41220@n59g2000hsh.googlegroups.com>

the day of the date is a number, April 4.

I want to replace the number with 04, if it is already 04, then do
nothing. If it is 4 replace with 04.

Please give me a simple way to do this.



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

Date: Mon, 9 Apr 2007 19:44:56 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: any simple way to do this?
Message-Id: <461a0b0e$0$16552$afc38c87@news.optusnet.com.au>


<robertchen117@gmail.com> wrote in message 
news:1176109192.851005.41220@n59g2000hsh.googlegroups.com...
> the day of the date is a number, April 4.
>
> I want to replace the number with 04, if it is already 04, then do
> nothing. If it is 4 replace with 04.
>
> Please give me a simple way to do this.
>

Does this help ?

---------------
use strict;
use warnings;

for(04, 4, 14, 214) {printf "%02d ", $_}

print "\n";

#or use sprintf() if you want to assign:

for(04, 4, 24, 4132) {
   my $formatted = sprintf( "%02d", $_);
   print $formatted, " ";
}

print "\n";
------------------

Cheers,
Rob



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

Date: Mon, 09 Apr 2007 13:59:30 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: any simple way to do this?
Message-Id: <hjak135ktvf9e8jv0u06jgje2er70hok7c@4ax.com>

On 9 Apr 2007 01:59:52 -0700, "robertchen117@gmail.com"
<robertchen117@gmail.com> wrote:

>Subject: any simple way to do this?

What? (How 'bout putting the subject of your post in the Subject?)

>the day of the date is a number, April 4.
>
>I want to replace the number with 04, if it is already 04, then do
>nothing. If it is 4 replace with 04.
>
>Please give me a simple way to do this.

  perldoc -f sprintf


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: 9 Apr 2007 06:20:06 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: any simple way to do this?
Message-Id: <1176124806.340915.91660@l77g2000hsb.googlegroups.com>

On Apr 9, 5:44 am, "Sisyphus" <sisyph...@nomail.afraid.org> wrote:
> <robertchen...@gmail.com> wrote in message
>
> news:1176109192.851005.41220@n59g2000hsh.googlegroups.com...
>
> > the day of the date is a number, April 4.
>
> > I want to replace the number with 04, if it is already 04, then do
> > nothing. If it is 4 replace with 04.
>
> > Please give me a simple way to do this.
>
> Does this help ?
>
> ---------------
> use strict;
> use warnings;
>
> for(04, 4, 14, 214) {printf "%02d ", $_}
>
> print "\n";
>
> #or use sprintf() if you want to assign:
>
> for(04, 4, 24, 4132) {
      ^^

Be careful.  That worked only because Decimal 4 happens to be
equivalent to Octal 4.  Try it with 09 or 010 and see what happens.

Paul Lalli





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

Date: Mon, 09 Apr 2007 11:08:02 GMT
From: Robert <r.f.richmond@bigpond.com>
Subject: Creating a file to print to
Message-Id: <m8pSh.11489$M.6431@news-server.bigpond.net.au>

Hello,

I am trying to create different files to print data to.
The problem I am having is with the name of the file.

I have created a loop to create the files, which works fine,
however later in the program I need to write similar data to the file.

This is what I am doing but it does not work:

while ($group <=12){

        print MY.$group.OUTFILE $header_top;
        print MY.$group.OUTFILE "$group";
        print MY.$group.OUTFILE "$header_bottom;
        $group++;
        
}

How can I get the "reference to the file" to change name?

At the moment I am forced to type:

$group = "12";
print MY12OUTFILE $header_top;
print MY12OUTFILE "$group";
print MY12OUTFILE $header_bottom;

$group = "11";
print MY11OUTFILE $header_top;
 .............
 .............

Any suggestions?




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

Date: Mon, 09 Apr 2007 07:34:15 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Creating a file to print to
Message-Id: <m2r6qtok7c.fsf@local.wv-www.com>

Robert <r.f.richmond@bigpond.com> writes:

> I am trying to create different files to print data to.
> The problem I am having is with the name of the file.
>
> I have created a loop to create the files, which works fine,
> however later in the program I need to write similar data to the file.

Use scalar filehandles and store them in an array.

    my @handles;
    for (1..12) {
        open $handles[$_], '>', "file$_.txt"
            or die "Could not open file$_.txt. $!";
    }

> This is what I am doing but it does not work:
>
> while ($group <=12){
>
>         print MY.$group.OUTFILE $header_top;
>         print MY.$group.OUTFILE "$group";
>         print MY.$group.OUTFILE "$header_bottom;
>         $group++;
>         
> }

    for my $group (1 .. 12) {
        print { $handles[$group] } $header_top;
        print { $handles[$group] } $group; # see perldoc -q always quoting
        print { $handles[$group] } $header_bottom;
    }

For more, have a look at:

    perldoc perlopentut
    perldoc -f print
    perldoc -q always quoting

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Mon, 09 Apr 2007 14:12:51 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Creating a file to print to
Message-Id: <spak13tgdpfsvevan0381isnspvh49a48q@4ax.com>

On Mon, 09 Apr 2007 11:08:02 GMT, Robert <r.f.richmond@bigpond.com>
wrote:

>Subject: Creating a file to print to

  open my $fh, '>', 'a file' or die "Can't open `a file': $!\n";

>I am trying to create different files to print data to.

Different problem.

>The problem I am having is with the name of the file.

I begin feeling smell of symrefs, let's see...

>I have created a loop to create the files, which works fine,
>however later in the program I need to write similar data to the file.
>
>This is what I am doing but it does not work:
>
>while ($group <=12){
>
>        print MY.$group.OUTFILE $header_top;
>        print MY.$group.OUTFILE "$group";

Useless use of quoting.

>        print MY.$group.OUTFILE "$header_bottom;

Syntax error

>        $group++;

Put your handles (well, typeglob references) into an array @fh. Then

  for my $group (0..$#fhs) {  # or 1 ?
      print { $fhs[$group] } $header_top;
      # ...
  }

Since you seem to have many such statements, you may want to

  select $fh

as well.

If you didn't need the index, then you may have had simply

  for my $fh (@fhs) {
      print $fh $header_top;
      # ...
  }

In both cases you can also rely on the default $_ which is fine, IMHO,
if the actual loop block is short enough.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 09 Apr 2007 21:55:38 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Creating a file to print to
Message-Id: <uDySh.135958$_73.134677@newsread2.news.pas.earthlink.net>

On 04/09/2007 06:08 AM, Robert wrote:
> Hello,
> 
> I am trying to create different files to print data to.
> The problem I am having is with the name of the file.
> 
> I have created a loop to create the files, which works fine,
> however later in the program I need to write similar data to the file.
> 
> This is what I am doing but it does not work:
> 
> while ($group <=12){
> 
>         print MY.$group.OUTFILE $header_top;
>         print MY.$group.OUTFILE "$group";
>         print MY.$group.OUTFILE "$header_bottom;
>         $group++;
>         
> }
> 
> How can I get the "reference to the file" to change name?
> 
> At the moment I am forced to type:
> 
> $group = "12";
> print MY12OUTFILE $header_top;
> print MY12OUTFILE "$group";
> print MY12OUTFILE $header_bottom;
> 
> $group = "11";
> print MY11OUTFILE $header_top;
> ..............
> ..............
> 
> Any suggestions?
> 
> 

Yes,

use IO::File;

my %groups = (
	11 => IO::File->new(...) || die(...),
	12 => IO::File->new(...) || die(...),
	);

my $group = 1;

while ($group <= 12) {
	next unless $groups{$group};
	print { $groups{$group} } $header_top;
	print { $groups{$group} } $group;
	print { $groups{$group} } $header_bottom;
	$group++;
}

# Close the IO::File objects in %groups.

__UNTESTED_CODE__

Read the doc for "print" again: "perldoc -f print"



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

Date: 9 Apr 2007 01:29:48 -0700
From: "andy" <nitindutt2005@gmail.com>
Subject: HTML::Template module in perl
Message-Id: <1176107388.336327.300810@y66g2000hsf.googlegroups.com>

I have a html file name test.html as below.
==================================================================
<html>
<head>
<title>Song Listing</title>
</head>
<body>
<h1>My Songs</h1>

<tr>

      <td valign="top">
        <table width="150%" border="1" cellpadding="3"
cellspacing="1">
        <tr height="20" style="font-size: 95%;"><td>&nbsp;</td></tr>

        <tr height="20" style="font-size: 95%;"><td align="left"
valign="middle"><a href="<TMPL_VAR NAME=SOME_DATA>">NITIN</a></td></
tr>

        <tr height="20" style="font-size: 95%;"><td align="left"
valign="middle"><a href="<TMPL_VAR NAME=TEST_THIS_1>">SITE</a></td></
tr>

       </table>
      </td>

<table>
</BODY>
</HTML>
======================================================================
I am opening this html file using the below perl script.
======================================================================
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Session;
use HTML::Template;
my $site = "http://www.google.co.in";
my $FILENAME="/usr/nitin/test_123.tmpl"
my $cgi = new CGI;
print $cgi->header();
my $template = HTML::Template->new(filename => "/usr/nitin/
test.tmpl");
#tried with all the below three options: as in the link of SITE of the
html page i want to open a different template file named
test_123.tmpl.
#my $FILENAME= HTML::Template->new(type => 'filename', source => "/usr/
nitin/test_123.tmpl");
#my $FILENAME= HTML::Template->new( filename => 'test_123.tmpl', path
=> [ '/usr/nitin/test_123.tmpl']);
#my $FILENAME= HTML::Template->new_file('test_123.tmpl', filename => '/
usr/nitin/test_123.tmpl');

$template->param(SOME_DATA=> $site);
$template->param(TEST_THIS_1=> $FILENAME);
print $template->output;
1;
=====================================================================

I am not able to open the test_123.tmpl file by using opening this
using this method.

Tried with TMPL_INCLUDE also. But not able to open the same.

Can anybody help me with the solution.
============================================================
After this I want to first click on NITIN and then on SITE. And then i
want a new page or template file . i.e after clicking on NITIN and
then SITE I want to open a new template file. Will it be done by
TMPL_IF tag under HTML::template module or is there any other way to
do that.


Kindly help me with the logic.



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

Date: Mon, 09 Apr 2007 17:11:54 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: HTML::Template module in perl
Message-Id: <461a57ba$0$25951$ba4acef3@news.orange.fr>

andy wrote:
> I have a html file name test.html as below.
> ==================================================================

<snip>

So the file is called "test.html"

> ======================================================================
> I am opening this html file using the below perl script.
> ======================================================================
> #!/usr/bin/perl -w
> use strict;
> use CGI;
> use CGI::Session;
> use HTML::Template;
> my $site = "http://www.google.co.in";
> my $FILENAME="/usr/nitin/test_123.tmpl"
> my $cgi = new CGI;
> print $cgi->header();
> my $template = HTML::Template->new(filename => "/usr/nitin/
> test.tmpl");

You're then trying to open it as "test.tmpl".

> #tried with all the below three options: as in the link of SITE of the
> html page i want to open a different template file named
> test_123.tmpl.
> #my $FILENAME= HTML::Template->new(type => 'filename', source => "/usr/
> nitin/test_123.tmpl");
> #my $FILENAME= HTML::Template->new( filename => 'test_123.tmpl', path
> => [ '/usr/nitin/test_123.tmpl']);
> #my $FILENAME= HTML::Template->new_file('test_123.tmpl', filename => '/
> usr/nitin/test_123.tmpl');
> 
> $template->param(SOME_DATA=> $site);
> $template->param(TEST_THIS_1=> $FILENAME);
> print $template->output;
> 1;

It's important to check your return values.


F:\Documents and Settings\Mark3>cat template.pl
use strict;
use warnings;

use HTML::Template;

my $filename = shift;

my $template = HTML::Template->new( filename => $filename ) or die $!;

print $template->output();

F:\Documents and Settings\Mark3>perl template.pl notexists.tmpl
HTML::Template->new() : Cannot open included file notexists.tmpl : file 
not found. at F:/Perl/site/lib/HTML/Template.pm line 1658
 
HTML::Template::_init_template('HTML::Template=HASH(0x18c249c)') called 
at F:/Perl/site/lib/HTML/Template.pm line 1238
         HTML::Template::_init('HTML::Template=HASH(0x18c249c)') called 
at F:/Perl/site/lib/HTML/Template.pm line 1124
         HTML::Template::new('HTML::Template', 'filename', 
'notexists.tmpl') called at template.pl line 8

F:\Documents and Settings\Mark3>echo test template > exists.tmpl

F:\Documents and Settings\Mark3>perl template.pl exists.tmpl
test template


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

Date: Mon, 09 Apr 2007 10:16:53 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: HTML::Template module in perl
Message-Id: <461a58e5$0$499$815e3792@news.qwest.net>

andy wrote:
[...]
> #my $FILENAME= HTML::Template->new(type => 'filename', source => "/usr/
> nitin/test_123.tmpl");
> #my $FILENAME= HTML::Template->new( filename => 'test_123.tmpl', path
> => [ '/usr/nitin/test_123.tmpl']);
> #my $FILENAME= HTML::Template->new_file('test_123.tmpl', filename => '/
> usr/nitin/test_123.tmpl');
> 
> $template->param(SOME_DATA=> $site);
> $template->param(TEST_THIS_1=> $FILENAME);
> print $template->output;
> 1;
> =====================================================================
> 
> I am not able to open the test_123.tmpl file by using opening this
> using this method.

perldoc -f open

> 
> Tried with TMPL_INCLUDE also. But not able to open the same.
> 
> Can anybody help me with the solution.
> ============================================================
> After this I want to first click on NITIN and then on SITE. And then i
> want a new page or template file . i.e after clicking on NITIN and
> then SITE I want to open a new template file. Will it be done by
> TMPL_IF tag under HTML::template module or is there any other way to
> do that.

You have to 'open' a file for write. TMPL_INCLUDE will insert the 
contents of a pre-existing file.

> 
> 
> Kindly help me with the logic.

Use HTML::Template to populate predefined values in a file/template.
Use an editor, or 'open' a file in your CGI, or other methods to
create a file.


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

Date: Mon, 09 Apr 2007 11:02:01 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Passing hash to a subroutine
Message-Id: <ptvj131igeokipuq6b55hgjnd7001035r8@4ax.com>

On 8 Apr 2007 21:23:43 -0700, "Ray" <raykyoto@gmail.com> wrote:

>> >  printf (STDOUT "* %s\n", %{$href} -> {"San Francisco"}{"LA"});
>
>And you also caught me. I am originally a C-programmer and changing to
>a Perl programming means my Perl code sometimes looks like C.  Thanks

Well... that is, in $Larry's words, "officially ok". But using a
simple print() where it suffices has obvious advantages. It's much
like when you learn a foreign language and it's fine if you initially
use its constructs that most resemble your mother tongue, even if
they're obsolete or unusual; but as you learn more and more you switch
to more idiomatic ones.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 9 Apr 2007 06:55:19 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Passing hash to a subroutine
Message-Id: <slrnf1kad7.umr.tadmc@tadmc30.august.net>

Ray <raykyoto@gmail.com> wrote:
> On Apr 7, 11:13 pm, Tad McClellan <t...@augustmail.com> wrote:

>> What you haven't figured out is how to dereference it within
>> the function body.

> I was just looking back at perlreftut to see where I
> went wrong.  I guess read @a and @{$aref} were equivalent and


And they *are* equivalent!

But you didn't want the whole aggregate (array above but hash earlier).

You wanted to index into the aggregate, so you needed the
equivalent of $a[], which is ${$aref}[].


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


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

Date: 9 Apr 2007 10:41:34 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Problem configuring Apache with php support to run scripts on browser.
Message-Id: <1176140494.501369.11760@b75g2000hsg.googlegroups.com>

Hello iam trying to install php v5.2.1 with apache support so i can
run .php scripts ddirectly on my browser instead of command line but

when i try to http://localhost/phpinfo.phpi get na internal server
error.

i ahve apache v2.2.4 installed.

and when php asked me i teold het that i want her to configure
automaticall Apache cGI nd inseide htpp.conf it added these lines


#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
ScriptAlias /php/ "C:\\Program Files\\PHP"
Action application/x-httpd-php "C:\\Program Files\\PHP\\php-cgi.exe"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

but yet it wont run. form command lien only works but not inisde my
browser why?



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

Date: 9 Apr 2007 10:43:56 -0700
From: usenet@DavidFilmer.com
Subject: Re: Problem configuring Apache with php support to run scripts on browser.
Message-Id: <1176140636.179232.45410@y80g2000hsf.googlegroups.com>

On Apr 9, 10:41 am, "=CE=9D=CE=AF=CE=BA=CE=BF=CF=82" <hacke...@gmail.com> w=
rote:
> Hello iam trying to install php v5.2.1 with apache support

That's too bad.

Why don't you ask this in a PHP or Apache newsgroup?  It has nothing
to do with Perl.




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

Date: 9 Apr 2007 11:10:23 -0700
From: "=?iso-8859-7?B?zd/q7/I=?=" <hackeras@gmail.com>
Subject: Re: Problem configuring Apache with php support to run scripts on browser.
Message-Id: <1176142223.223745.190140@w1g2000hsg.googlegroups.com>

Iam terribly sorry i though i was asking this in php, my bad.

=CF/=C7 usenet@DavidFilmer.com =DD=E3=F1=E1=F8=E5:
> On Apr 9, 10:41 am, "=CD=DF=EA=EF=F2" <hacke...@gmail.com> wrote:
> > Hello iam trying to install php v5.2.1 with apache support
>
> That's too bad.
>
> Why don't you ask this in a PHP or Apache newsgroup?  It has nothing
> to do with Perl.



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

Date: 9 Apr 2007 14:08:56 -0700
From: "gf" <greg.ferguson@icrossing.com>
Subject: Re: prototypes - use or not?
Message-Id: <1176152936.706320.19500@y66g2000hsf.googlegroups.com>


Dan Becker wrote:
> Perl Best Practices (Conway), section 9.10,  has a pretty clear statement
> that subroutine prototypes should not be used. Period. (It says that the
> disadvantages generally outweigh the limited advantages.) But it's still in
> the language. So I'm confused. Is this generally accepted advice? or should
> it be applied only in specific situations? or, generally speaking, avoided
> in specific situations?

Conway says it's usually not a good idea but gives examples when you
might want to. It's up to you to decide whether the prototypes make
sense or not in a particular script.

Personally, I don't use them. I write in checks when I enter a
subroutine to see if I've gotten sensible values and/or types for the
parameters.

I also stopped using positional parameters in subroutines and instead
follow Conway's recommendation to use hashes or hash-refs. Doing that
opens up some interesting possibilities for using defaults for values
not passed in, or passing in a set of defaults and overriding a
particular value. It makes for more typing as I write the code
initially, but I think my reuse goes up over time.



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

Date: Mon, 09 Apr 2007 10:20:41 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?
Message-Id: <461a59c9$0$499$815e3792@news.qwest.net>

kath wrote:
> Hi all,
> 
> I have small doubt, the following code works fine in Apache server.
> But not completely in Tomcat. Why??
> ------------------------
> #!C:\Perl\bin\perl.exe
> 
> # hello.pl
> 
> use CGI;
> $cgi = new CGI;
> print $cgi->header;
> printf "Hello world";
> system("perl Hi.pl");
> ------------------------
> #!C:\Perl\bin\perl.exe
> 
> # hi.pl
> 
> print "Hi";
> ------------------------
> 
> When I tried in Tomcat, the script prints only
> Hello world
> 
> Why?
> What's wrong?

perldoc -q "Why can't I get the output of a command with system"


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

Date: Mon, 09 Apr 2007 18:41:43 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?
Message-Id: <57v8qdF2e9tljU1@mid.individual.net>

J. Gleixner wrote:
> kath wrote:
> 
>> Hi all,
>>
>> I have small doubt, the following code works fine in Apache server.
>> But not completely in Tomcat. Why??
>> ------------------------
>> #!C:\Perl\bin\perl.exe
>>
>> # hello.pl
>>
>> use CGI;
>> $cgi = new CGI;
>> print $cgi->header;
>> printf "Hello world";
>> system("perl Hi.pl");
>> ------------------------
>> #!C:\Perl\bin\perl.exe
>>
>> # hi.pl
>>
>> print "Hi";
>> ------------------------
>>
>> When I tried in Tomcat, the script prints only
>> Hello world
>>
>> Why?
>> What's wrong?
> 
> 
> perldoc -q "Why can't I get the output of a command with system"

That's not applicable here, is it?

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


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

Date: Mon, 09 Apr 2007 16:21:59 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server?
Message-Id: <461aae78$0$516$815e3792@news.qwest.net>

Gunnar Hjalmarsson wrote:
> J. Gleixner wrote:
>> kath wrote:
>>
>>> Hi all,
>>>
>>> I have small doubt, the following code works fine in Apache server.
>>> But not completely in Tomcat. Why??
>>> ------------------------
>>> #!C:\Perl\bin\perl.exe
>>>
>>> # hello.pl
>>>
>>> use CGI;
>>> $cgi = new CGI;
>>> print $cgi->header;
>>> printf "Hello world";
>>> system("perl Hi.pl");
>>> ------------------------
>>> #!C:\Perl\bin\perl.exe
>>>
>>> # hi.pl
>>>
>>> print "Hi";
>>> ------------------------
>>>
>>> When I tried in Tomcat, the script prints only
>>> Hello world
>>>
>>> Why?
>>> What's wrong?
>>
>>
>> perldoc -q "Why can't I get the output of a command with system"
> 
> That's not applicable here, is it?

Nope.. nevermind.. I missed that 'Hi' was just going to STDOUT, not to a 
variable.


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

Date: 9 Apr 2007 14:03:41 -0700
From: "Robert" <callingrw@yahoo.com>
Subject: Why No Famous Open Source Projects From Britain/Ireland?
Message-Id: <1176152621.806250.287130@n76g2000hsh.googlegroups.com>

Hey.
How come there are no famous and widely-used open source products that
were founded and (more or less) developed from the United Kingdom or
Ireland? I find that odd.

Perl was founded, largely developed, and led by Larry Wall, who I
think is American(mainly in California?).

You got:
Linux -> Linus Torvalds -> formerly Finland, now California
Python -> Guido van Rossum -> formerly the Netherlands, now California

InnoDB -> a group in Finland, bought by Oracle, (coming to California
soon?)
MySQL -> Sweden
Qt -> Norway
Mandriva -> France (Paris , I believe)
OCaml -> somewhere in France

SUSE -> Germany (still there I believe, although now owned by Novell)
Knoppix -> Klaus Knopper -> Germany

Europe does seem to be good at exporting open source programmers. Oh
hey, come on you europeans, you gotta have a sense of humor! You got
the best weather in the world, lovely place. Would go back there if I
had the money.



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

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 V11 Issue 318
**************************************


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