Re: Saving param after new recall of a cgi script

2009-11-28 Thread Marek
On 27 Nov., 10:42, rrogg...@uni-osnabrueck.de (Robert Roggenbuck)
wrote:
 You should store the values from step 2 at step 3 in hidden parameters (input
 type=hidden ...). The You can access them via CGI in step 4.

 An alternative would be storing the whole CGI-object in a file using
 Data::Dumper and recreate it using 'do $file'.

 Greetings

 Robert



Thank you Robert! I will try both solutions tomorrow ...

Have a nice weekend!


marek


-- 
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




RE: Loading results (via ajax) from a CGI

2009-11-28 Thread Dermot Paikkos
This is of course a javascript/ajax question to a perl list

 -Original Message-
 From: bu...@alejandro.ceballos.info
 [mailto:bu...@alejandro.ceballos.info]
 Sent: 27 November 2009 13:59
 To: beginners-cgi@perl.org
 Subject: Loading results (via ajax) from a CGI
 
 Any idea where is going this?
 
 
 If this help, here is my ajax routine:
 
 function ShowInstallInfo (int_value)
{
var ajax_this;
if (window.XMLHttpRequest) { ajax_this = new XMLHttpRequest(); }
else { ajax_this = new ActiveXObject(Microsoft.XMLHTTP); }
ajax_this.onreadystatechange = function ()


Take out the if clause and see what you get.

  { if (ajax_this.readyState==4 || 
ajax_this.readyState==complete)
{ alert(Results: +ajax_this.status+
 text:+ajax_this.responseText); }
  };

//   { if (ajax_this.readyState==4 || ajax_this.readyState==complete)
   { alert(Results: +ajax_this.status+
 text:+ajax_this.responseText); }
//  };

Good luck,
Dp.
 



--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




problems with 'require'

2009-11-28 Thread Paweł Prędki

Hey,
I've been using simple CGI scripts to make some things on my website 
require less human touch and some of them require mysql database 
connection. I've started with only one such scripts but now there are 
more so I've decided to move the connection data (table name, database 
name, username, password) to a separate .pm file which I could include 
in the other .cgi scripts. However, I don't seem to be able to use the 
functions and/or variables in this .pm module and I have no idea what is 
wrong. Let me give you a simple example of what works and what doesn't 
and I would really appreciate any help.


file mydbtest.pm
package dbredwings;

my $platform = mysql;
my $database = dbplayers;
my $host = localhost;
my $tablename = players;
my $user = player;
my $pw = pass;

sub printout {
print shift;
}

sub get_platform {
print $platform;
}
1;
/file mydbtest.pm

file properscript.cgi
require 'mydbtest.pm';
print Content-type: text/html\n\n;
mydbtest::printout('hey hey'); # (1)
mydbtest::get_platform; # (2)
print $mydbtest::platform; # (3)
/file properscript.cgi

(1) works without any problems. I get the proper output in my browser 
window.

(2) doesn't work at all. I get an error as follows:
Undefined subroutine mydbtest::get_platform called at 
E:/webdev/perl/properscript.cgi line 42.

(3) prints an empty string

Also, I get an error message saying that the .pm file can't be found 
when I place it in the same directory as the .cgi files. I have to move 
it to a directory in the @INC array when I run it through the server. 
However, when I run it locally, from the command line, everything works 
just fine. This makes me think that there is something in the Apache 
config that I have to do in order for all this to work but I don't know 
what that is.


I'm running ActivePerl 5.10.1 with Apache2.2 with mod_perl.
Alias /perl E:\webdev\perl
  Location /perl
 SetHandler perl-script
 PerlResponseHandler ModPerl::Registry
 Options +ExecCGI
 PerlOptions +ParseHeaders
  /Location
ScriptAlias /cgi-bin/ E:/webdev/perl/cgi-bin/

Cheers,
palo

--
To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org
For additional commands, e-mail: beginners-cgi-h...@perl.org
http://learn.perl.org/




Re: why can't I collapse reference variable?

2009-11-28 Thread C.DeRykus
On Nov 24, 11:14 am, mark_galeck_spam_mag...@yahoo.com (Mark_Galeck)
wrote:
 If I can do this:

 $ref = \...@foobar;
 print @$ref;

 then why can't I do this:

 print @\...@foobar;

Because you're asking the parser to do too much. It needs
to quickly identify the reference without ambiguity. What if
someone expected the parser to decipher this for example..

  print @\...@\$foo{\$$bar[0]}

At some point, there has to be an way  to identify easily
what's happening... without confusing perl or the coder.
(But someone familiar with parsing may be able to explain this
more fully or provide a better example of the difficulties.)

See 'perldoc perlref' ...specifically 'Using References' section
Bottom line: perl requires  a block to identify the reference,
unless it's a simple scalar, eg.

 print @{...@foobar}
 print @$ref

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




reference to anonymous array, references last element instead??

2009-11-28 Thread Mark_Galeck
Why does

$foobar = \(foo, bar);
print $$foobar;


print bar  ??

Thank you for any insight.  Mark


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: reference to anonymous array, references last element instead??

2009-11-28 Thread John W. Krahn

Mark_Galeck wrote:

Why does

$foobar = \(foo, bar);
print $$foobar;


print bar  ??

Thank you for any insight.  Mark


Because \(foo, bar) is really (\foo, \bar) and the comma 
operator in scalar context will return the last item listed so:


$foobar = \(foo, bar);

Is just:

$foobar = \bar;




John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.   -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: reference to anonymous array, references last element instead??

2009-11-28 Thread John Refior
Just replying to add that you can use square brackets for an array literal:

$foobar = ['foo', 'bar'];

See http://perldoc.perl.org/perlref.html#Making-References .

John

On Sat, Nov 28, 2009 at 5:53 AM, John W. Krahn jwkr...@shaw.ca wrote:

 Mark_Galeck wrote:

 Why does

 $foobar = \(foo, bar);
 print $$foobar;


 print bar  ??

 Thank you for any insight.  Mark


 Because \(foo, bar) is really (\foo, \bar) and the comma operator
 in scalar context will return the last item listed so:

 $foobar = \(foo, bar);

 Is just:

 $foobar = \bar;




 John
 --
 The programmer is fighting against the two most
 destructive forces in the universe: entropy and
 human stupidity.   -- Damian Conway


 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: reference to anonymous array, references last element instead??

2009-11-28 Thread John Refior
Woops - meant to write anonymous array literal.  $foobar will be a
reference to the anonymous array that contains ('foo', 'bar').  - John

On Sat, Nov 28, 2009 at 6:03 AM, John Refior jref...@gmail.com wrote:

 Just replying to add that you can use square brackets for an array literal:


 $foobar = ['foo', 'bar'];

 See http://perldoc.perl.org/perlref.html#Making-References .

 John


 On Sat, Nov 28, 2009 at 5:53 AM, John W. Krahn jwkr...@shaw.ca wrote:

 Mark_Galeck wrote:

 Why does

 $foobar = \(foo, bar);
 print $$foobar;


 print bar  ??

 Thank you for any insight.  Mark


 Because \(foo, bar) is really (\foo, \bar) and the comma operator
 in scalar context will return the last item listed so:

 $foobar = \(foo, bar);

 Is just:

 $foobar = \bar;




 John
 --
 The programmer is fighting against the two most
 destructive forces in the universe: entropy and
 human stupidity.   -- Damian Conway


 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/






reference to anonymous array, references last element instead??

2009-11-28 Thread Mark_Galeck
Why does

$foobar = \(foo, bar);
print $$foobar;


print bar  ??

Thank you for any insight.  Mark


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Separating DB operations out of program code

2009-11-28 Thread Dermot
2009/11/27 Steve Bertrand st...@ibctech.ca:
 Dermot wrote:
 2009/11/26 Scott Pham scott.p...@gmail.com:
 Have you looked at DBIx::Class?


 I'd 2nd that. DBIx is the way forward. You should be looking to stop
 writing SQL statements and moving towards ORM. Try the example at
 http://search.cpan.org/~frew/DBIx-Class-0.08114/lib/DBIx/Class/Manual/Example.pod

 I want to thank those who responded on list, and off-list.
...

 Thanks for the recommendations, and if there are any contributors to
 this project or its derivatives on the list, cheers!

 Only a single business day of learning the basic in and outs, and I can
 see already how I've wasted thousands of man hours doing it the 'old'
 way in the past :)

I see you truly hooked. I haven't seen a maintainer for DBIx on this
list. They have a pretty active mailing list[1] and a IRC[2]. I,
personally, find other lists less friendly than beginners. Your
expected to know your stuff but if you have issues with DBIx that's
the place to go.


1) http://lists.scsys.co.uk/mailman/listinfo/dbix-class/
2) irc.perl.org#dbix-class

Dp.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: remove directory from @INC

2009-11-28 Thread Huub van Niekerk
Thank you for your answer.

I changed the beginning of my code to this:

#!/usr/bin/perl
no lib /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/;
use lib /usr/lib/perl5/5.10.0/i386-linux-thread-multi/;
use DBI;
use strict;
use warnings;
use PostScript::Simple;

No errors are given anymore in the editor. However, when I run the code,
this message is still given:

install_driver(mysql) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so'
for module DBD::mysql: libssl.so.8: cannot open shared object file: No such
file or directory at
/usr/lib/perl5/5.10.0/i386-linux-thread-multi//DynaLoader.pm line 203.
 at (eval 3) line 3

In Fedora 12, libssl.so.8 has been replaced by libssl.so.10. Can you give me
an idea on how to solve this?

Thank you for helping out.


 Remove them in a BEGIN{} block before any `use` module statements.  You
 can also add directories by `use lib 'directory';`  See `perldoc lib`.


 --
 Just my 0.0002 million dollars worth,
  Shawn

 Programming is as much about organization and communication
 as it is about coding.

 I like Perl; it's the only language where you can bless your
 thingy.



Autovivification of hash from an array

2009-11-28 Thread Jeremiah Foster
Hi there!

This may or may not be a beginners question. If not, please let me know 
where I ought to post. :-)

I have a data structure, a simple array. It is made up of sections of 
files I have slurped;

sub _build_packages { 
   use Perl6::Slurp; 
   my @pkgs; 
 
   # iterate over the packages slurping them into one 
   map { push @pkgs, (slurp $_, {irs = qr/\n\n/xms}) } @packages; 
   return \...@pkgs; 
} 

(The above code is in the class declaration)


Now in my program which subclasses that array ref, after de-referencing 
I have this idiom;

my %versions;
map { 
my $package = $_;
# autovivfy a hash with versions of packages 
$versions{$package} = [ ] unless exists $versions{$package};
} @packages


So my questions are:

Is this an efficient way to do this? Am I using the idiom correctly? 
Could I make it more readable? Is my predilection for map over foreach making 
this less readable? Or is that only a question of style?

Thanks for any feedback.

Regards,

Jeremiah


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Autovivification of hash from an array

2009-11-28 Thread Jeremiah Foster
Edit: Added missing 'push' to code example.

On Nov 28, 2009, at 14:13, Jeremiah Foster wrote:

 Hi there!
 
   This may or may not be a beginners question. If not, please let me know 
 where I ought to post. :-)
 
   I have a data structure, a simple array. It is made up of sections of 
 files I have slurped;
 
   sub _build_packages { 
  use Perl6::Slurp; 
  my @pkgs; 
 
   # iterate over the packages slurping them into one 
  map { push @pkgs, (slurp $_, {irs = qr/\n\n/xms}) } @packages; 
   return \...@pkgs; 
} 
 
   (The above code is in the class declaration)
 
 
   Now in my program which subclasses that array ref, after de-referencing 
 I have this idiom;
 
   my %versions;
map { 
my $package = $_;
# autovivfy a hash with versions of packages 
  $versions{$package} = [ ] unless exists $versions{$package};
   push @{ $versions{$package} = $version
 } @packages
 
 
   So my questions are:
 
   Is this an efficient way to do this? Am I using the idiom correctly? 
 Could I make it more readable? Is my predilection for map over foreach making 
 this less readable? Or is that only a question of style?
 
   Thanks for any feedback.
 
   Regards,
 
   Jeremiah
 
 
 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/
 
 
 


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Autovivification of hash from an array

2009-11-28 Thread Shawn H Corey
Jeremiah Foster wrote:
  my %versions;
map { 
   my $package = $_;
   # autovivfy a hash with versions of packages 
  $versions{$package} = [ ] unless exists $versions{$package};
  push @{ $versions{$package} = $version
} @packages

You don't need to store an anonymous array before a push

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;

# Make Data::Dumper pretty
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent   = 1;

# Set maximum depth for Data::Dumper, zero means unlimited
$Data::Dumper::Maxdepth = 0;

my %hash = ();
for my $key ( 'a' .. 'z' ){
  for my $value ( 'a' .. $key ){
push @{ $hash{$key} }, $value;
  }
}
print 'hash = ', Dumper \%hash;

__END__

-- 
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Autovivification of hash from an array

2009-11-28 Thread Jeremiah Foster

On Nov 28, 2009, at 15:25, Shawn H Corey wrote:

 Jeremiah Foster wrote:
 my %versions;
   map { 
  my $package = $_;
  # autovivfy a hash with versions of packages 
 $versions{$package} = [ ] unless exists $versions{$package};
 push @{ $versions{$package} = $version
   } @packages
 
 You don't need to store an anonymous array before a push

Ah okay.

 #!/usr/bin/perl
 
 use strict;
 use warnings;
 
 use Data::Dumper;
 
 # Make Data::Dumper pretty
 $Data::Dumper::Sortkeys = 1;
 $Data::Dumper::Indent   = 1;
 
 # Set maximum depth for Data::Dumper, zero means unlimited
 $Data::Dumper::Maxdepth = 0;

I learned a bit about data dumper here, thanks!

 
 my %hash = ();
 for my $key ( 'a' .. 'z' ){
  for my $value ( 'a' .. $key ){
push @{ $hash{$key} }, $value;
  }
 }
 print 'hash = ', Dumper \%hash;

Thanks Shawn.

Jeremiah


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Autovivification of hash from an array

2009-11-28 Thread John W. Krahn

Jeremiah Foster wrote:

Hi there!


Hello,


This may or may not be a beginners question. If not, please let me
know where I ought to post. :-)

I have a data structure, a simple array. It is made up of sections of
files I have slurped;

sub _build_packages { 
use Perl6::Slurp; 


Do you really need to use this module?

my @pkgs; 

# iterate over the packages slurping them into one 
map { push @pkgs, (slurp $_, {irs = qr/\n\n/xms}) } @packages; 


You shouldn't use map() in void context:

 return [ map { slurp $_, { irs = qr/\n\n/ } } @packages ];


return \...@pkgs; 
} 


(The above code is in the class declaration)


Now in my program which subclasses that array ref, after
de-referencing I have this idiom;

my %versions;
map { 
my $package = $_;
# autovivfy a hash with versions of packages 
$versions{$package} = [ ] unless exists $versions{$package}; 	

push @{ $versions{$package} = $version
} @packages


Again, you shouldn't use map() in void context:

foreach my $package ( @packages ) {
# autovivfy a hash with versions of packages
push @{ $versions{ $package } }, $version
}



So my questions are:

Is this an efficient way to do this? Am I using the idiom correctly?
Could I make it more readable? Is my predilection for map over foreach
making this less readable? Or is that only a question of style?


It depends on which version of Perl this will run on.  In older versions 
map() in void context would create a list that would be discarded.





John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.   -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Autovivification of hash from an array

2009-11-28 Thread Uri Guttman
 JF == Jeremiah Foster jerem...@jeremiahfoster.com writes:

  JF   # autovivfy a hash with versions of packages 
  JF $versions{$package} = [ ] unless exists $versions{$package};  

that is MANUALLY vivifying an array. if you just pushed to the slot with
a dereference, that would be autovivifying. only perl can autovivify for
you! 

read this to learn more about autovivifying:

http://sysarch.com/Perl/autoviv.txt

  JF   Is this an efficient way to do this? Am I using the idiom
  JF   correctly? Could I make it more readable? Is my predilection for
  JF   map over foreach making this less readable? Or is that only a
  JF   question of style?

map in a void context is considered poor coding style. it doesn't have
the storage penalty it used to have but its purpose is still to generate
a list. in a void context it can't do that so you are misleading the
reader. use foreach modifier for this instead.

uri

-- 
Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com --
-  Perl Code Review , Architecture, Development, Training, Support --
-  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com -

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Assignment Operator

2009-11-28 Thread Jenda Krynicky
From:   Marco Pacini i...@marcopacini.org
Subject:Assignment Operator
Date sent:  Thu, 26 Nov 2009 12:31:54 +0100
To: beginners@perl.org

 Hi All,
 
 I'm studying Perl since one week on Learning Perl written by L. Wall
 and in the paragraph Assignment Operators i don't understand why
 this: 
 
   ($temp = $global) += $constant;
 
 is equivalent of:
 
   $tmp = $global + $constant;

I believe you meant $temp, not $tmp
 
 Instead,  before i read it, i thought it was equivalent of:
   
   $temp = $global;
   $temp = $temp + $constant;

You were right, though unless the $temp is a tie()d variable, they 
are all equivalent.

If $temp is tie()d, then the first and third will call the STORE 
method twice abd FETCH once, while the second calls just STORE once.

This may cause the result to be different if the STORE modifies the 
stored value. Eg. by rounding it.


#!perl
package TstTie;
require Tie::Scalar;

@ISA = qw(Tie::Scalar);

sub FETCH { print FETCH ${$_[0]}\n; return ${$_[0]} }
sub STORE { print STORE $_[1]\n; ${$_[0]} = $_[1] }
sub TIESCALAR { my ($class, $value) = @_; return bless( \$value, 
$class)}

package main;

my $temp=4;
tie $temp, 'TstTie', 4;

my $global = 10;
my $constant = 7;

print Original:\n;
($temp = $global) += $constant;
print Result: $temp\n\n;

print First:\n;
$temp = $global + $constant;
print Result: $temp\n\n;

print Second:\n;
$temp = $global;
$temp = $temp + $constant;
print Result: $temp\n\n;
__END__


(Keep in mind that the 
  print Result: $temp\n\n;
causes on more FETCH!

Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




PRINT LAST ENTRY IN A FILE

2009-11-28 Thread raphael()
Hi,

I want to print the last entry by record  in this file records.txt
The file is read in a subroutine and prints last line by the number in this
example.


# records.txt
 25.11.2009 NAME_0
 15.12.2006 NAME_3
 20.10.2007 NAME_1
 01.01.2008 NAME_3-- This whole line should be printed.
 10.10.2008 NAME_4

Using while in a while loop matching ( m// ) I get all the entries
having .


sub who_is_who($) {

open( FILE_DB, '', INFODB.TXT) || die Cannot open INFODB.TXT\n;
my $number = $_[0]; # print \$number is $_[0]\n;

while ( FILE_DB ) {
while ( m/^$number\s+(\S+)\s+(.*)$/mgs ) {   # -- tried while as
well as if
get_info($match, $1, $2);
# if (! $1) { die \nNo Entries Found for $match\n\n };
}
}
close(FILE_DB);
}

How can I do this?


Re: PRINT LAST ENTRY IN A FILE

2009-11-28 Thread Dermot
2009/11/28 raphael() raphael.j...@gmail.com:
 Hi,
Hi,

 # records.txt
  25.11.2009 NAME_0
  15.12.2006 NAME_3
  20.10.2007 NAME_1
  01.01.2008 NAME_3    -- This whole line should be printed.
  10.10.2008 NAME_4

 Using while in a while loop matching ( m// ) I get all the entries
 having .

What is distinctive about the line you are trying to print? Do you
want the 4th line every time or is there some combination of  and
NAME_ that you need? Once you determine what is unique about the line
your after, you'll be on the way.
Dp.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: PRINT LAST ENTRY IN A FILE

2009-11-28 Thread Dermot
2009/11/28 raphael() raphael.j...@gmail.com:
 2009/11/28 raphael() raphael.j...@gmail.com:
  Hi,
 Hi,

  # records.txt
   25.11.2009 NAME_0
   15.12.2006 NAME_3
   20.10.2007 NAME_1
   01.01.2008 NAME_3    -- This whole line should be printed.
   10.10.2008 NAME_4
 
  Using while in a while loop matching ( m// ) I get all the entries
  having .

 What is distinctive about the line you are trying to print? Do you
 want the 4th line every time or is there some combination of  and
 NAME_ that you need? Once you determine what is unique about the line
 your after, you'll be on the way.
 Dp.

 No combination! Just the last entry of the record   which is given
 through user input and changes each time the script is called.
 The whole line then is parsed and given to another subroutine as shown in
 the subroutine code.


Here one option. Stick the hits into an array and print out the last element.


#!/bin/perl

use strict;
use warnings;

chomp (my $input = STDIN); #111

my @hits;
while (DATA) {
push @hits, $_ if /$input/;
}

print $hits[-1]; # prints  01.01.2008 NAME_3


__DATA__
 25.11.2009 NAME_0
 15.12.2006 NAME_3
 20.10.2007 NAME_1
 01.01.2008 NAME_3
 10.10.2008 NAME_4



Good luck,
Dp.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: remove directory from @INC

2009-11-28 Thread Owen

 Thank you for your answer.

 I changed the beginning of my code to this:

 #!/usr/bin/perl
 no lib
 /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/;
 use lib /usr/lib/perl5/5.10.0/i386-linux-thread-multi/;
 use DBI;
 use strict;
 use warnings;
 use PostScript::Simple;

 No errors are given anymore in the editor. However, when I run the
 code,
 this message is still given:

 install_driver(mysql) failed: Can't load
 '/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/auto/DBD/mysql/mysql.so'
 for module DBD::mysql: libssl.so.8: cannot open shared object file: No
 such
 file or directory at
 /usr/lib/perl5/5.10.0/i386-linux-thread-multi//DynaLoader.pm line 203.
  at (eval 3) line 3

 In Fedora 12, libssl.so.8 has been replaced by libssl.so.10. Can you
 give me
 an idea on how to solve this?

 Thank you for helping out.



Well I have no idea if it will solve your problem, but try one of these;

a. make a symbolic link between libssl.so.8 and libssl.so.10
b. or simply copy libssl.so.10 as lbssl.so.8



-- 



Owen


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: remove directory from @INC

2009-11-28 Thread Huub van Niekerk
 
 Well I have no idea if it will solve your problem, but try one of these;
 
 a. make a symbolic link between libssl.so.8 and libssl.so.10 b. or
 simply copy libssl.so.10 as lbssl.so.8
 

Thank you. Didn't think of ln -s. That works now.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Separating DB operations out of program code

2009-11-28 Thread Shlomi Fish
Hi Dermot!

On Saturday 28 Nov 2009 13:53:45 Dermot wrote:
 2009/11/27 Steve Bertrand st...@ibctech.ca:
  Dermot wrote:
  2009/11/26 Scott Pham scott.p...@gmail.com:
  Have you looked at DBIx::Class?
 
  I'd 2nd that. DBIx is the way forward. You should be looking to stop
  writing SQL statements and moving towards ORM. Try the example at
  http://search.cpan.org/~frew/DBIx-Class-0.08114/lib/DBIx/Class/Manual/Ex
 ample.pod
 
  I want to thank those who responded on list, and off-list.
 
 ...
 
  Thanks for the recommendations, and if there are any contributors to
  this project or its derivatives on the list, cheers!
 
  Only a single business day of learning the basic in and outs, and I can
  see already how I've wasted thousands of man hours doing it the 'old'
  way in the past :)
 
 I see you truly hooked. I haven't seen a maintainer for DBIx on this
 list. They have a pretty active mailing list[1] and a IRC[2]. I,
 personally, find other lists less friendly than beginners. Your
 expected to know your stuff but if you have issues with DBIx that's
 the place to go.
 
 
 1) http://lists.scsys.co.uk/mailman/listinfo/dbix-class/
 2) irc.perl.org#dbix-class
 

Just a note - DBIx-Class should not be called DBIx alone. DBIx is the top-
level-namespace for DBI extensions, and it also includes such things as:

* http://search.cpan.org/dist/DBIx-Simple/

* http://search.cpan.org/dist/DBIx-Log4perl/

* http://search.cpan.org/dist/DBIx-Chart/

Calling DBIx-Class DBIx  does injustice to them all and is incorrect. DBIx-
Class however, may be abbreviated as DBIC.

Regards,

Shlomi Fish

 Dp.
 

-- 
-
Shlomi Fish   http://www.shlomifish.org/
The Case for File Swapping - http://shlom.in/file-swap

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Insecure $ENV{PATH} message

2009-11-28 Thread Huub van Niekerk
Hi,

I started getting this error after upgrading from Fedora 11 to 12. The 
line of code hasn't been changed: 

open my $LPR, '|-', qw/lpr -PDeskJet940C/ or die can't fork lpr: $!;

The error is: Insecure $ENV{PATH} while running with -T switch at 
pointing at the line above. From articles on the net I understand it has 
something to do with '|-', though I'm not sure. What can/should I do 
about it?

Thanks for helping out.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/