How to send arguments with a redirect?

2009-01-15 Thread evil...@gmail.com
Hi

I have the following two scripts test.cgi  displaytest.cgi

test.cgi is intended to redirect itself to displaytest.cgi and send
some arguments.

The problem I am having is that I can never get the arguments
successfully sent!

Redirect without arguments works fine - but the various approached
I've tried to send arguments all fail.

I would really appreciate some help with this - I'm sure/hope it's a
simple syntax issue

Thanks
NJH

test.cgi
-

#!c:/perl/bin/perl.exe

use strict;
use warnings;
use CGI;

my $q = new CGI;

my %args =
(
'nev'   =  'hi',
'hod'   =  'ho'
);

print   $q-redirect(-url='http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi'); # No arguments works

print   $q-redirect(-url='http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi', \%args); # This fails

print   $q-redirect # # This fails too!
(
-url='http://pubswww.kl.imgtec.org:8080/cgi-bin/
displaytest.cgi',
-nph=1,
{
'never'   =  'hi',
'happen'   =  'ho'
}
);



print   Content-Type: text/html\n\n,
The redirect seems to have failed.;

---

displaytest.cgi
---

#!c:/perl/bin/perl.exe

use warnings;
use strict;
use diagnostics;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;

my $q = new CGI;

print   $q-header(),
$q-start_html(),
'h1Test redirection/h1';

print Args: , $q-param(), br;

foreach my $param($q-param())
{
print Initial: $param, Value: ,$q-param($param),br;
}

$q-end_html;
exit();


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




Re: How to send arguments with a redirect?

2009-01-15 Thread Gunnar Hjalmarsson

evil...@gmail.com wrote:

Hi

I have the following two scripts test.cgi  displaytest.cgi

test.cgi is intended to redirect itself to displaytest.cgi and send
some arguments.

The problem I am having is that I can never get the arguments
successfully sent!


Try this in test.cgi:

use CGI;
use URI::Escape;

my $q = new CGI;

my $url =
'http://pubswww.kl.imgtec.org:8080/cgi-bin/displaytest.cgi';

my %args = (
'nev'   =  'hi',
'hod'   =  'ho'
);

my @args;
foreach my $key ( keys %args ) {
push @args, uri_escape($key).'='.uri_escape($args{$key});
}
my $query = join ';', @args;

print $q-redirect($url?$query);

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

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




Regarding opening web page scripted in perl and cgi

2009-01-15 Thread Karthik Vemula
Hi

I have a problem. I have a web page that has a main page index.cgi.

it has some links in it.

When i click on the linkc i have their address as 

index.cgi?_SHOW_PAGE=11.  /// it is written in the documentation that when this 
link is clicked Will hit the database cwt_page_content with page_id = 5///


I need to make changes in that page source. I am unable to find where that page 
is located. Can you please help me telling how to find those files to change 
the content in that.

I would appreciate reply as soon as possible.

Thanks,


Regards,
Karthik Vemula,
Graduate Student,
Dept of CSSE,
Auburn University.

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




Re: Regarding opening web page scripted in perl and cgi

2009-01-15 Thread Gunnar Hjalmarsson

Karthik Vemula wrote:

I have a problem. I have a web page that has a main page index.cgi.

it has some links in it.

When i click on the linkc i have their address as

index.cgi?_SHOW_PAGE=11.  /// it is written in the documentation that 
when this link is clicked Will hit the database cwt_page_content 
with page_id = 5///


I need to make changes in that page source. I am unable to find where 
that page is located. Can you please help me telling how to find 
those files to change the content in that.


Look in the source of index.cgi.

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

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




A questions about how to split files

2009-01-15 Thread Li, Aiguo (NIH/NCI) [E]
H all,

 

I need to split a file containing three columns of data as shown below
into three separate files.  Each split file should contain row names and
one column of data and the column name should be the file names.  Is
there any perl advanced function that allow me to do this?

 

probe set

E10662B_U133P2

E10662_U133P2

HF1589_U133P2

1007_s_at

12.59

12.9

12.7

1053_at

9.72

9.01

9.55

117_at

9.59

8.99

8.91

121_at

10.21

10.16

10.08

1255_g_at

6.02

6.28

6.01

1294_at

9.32

9.66

9.29

1316_at

10.05

10.01

9.89

1320_at

4.36

5.04

5.56

1405_i_at

5.52

8.24

6.52

 

 

Thanks in advance!

 

AG Lee

 



Perl Newbie question about upgrade from Perl 5.8.8 to 5.10

2009-01-15 Thread dolphin_sonar
Hi,

I bought the O'Reilly 5th edition Learning Perl the other day and it's
great. I am new to programming and Perl as well. I do know my way
around Linux but I am having problems upgrading from the version that
was on my OS (Cent OS 5.2) to 5.10. I downloaded Perl 5.10 from
http://www.cpan.org/authors/id/R/RG/RGARCIA/perl-5.10.0.tar.gz, then
tar -xvzf perl-5.10.0.tar.gz the package in /usr/local/bin   I then
followed the README guide that said to:

./Configure -des -Dprefix=$HOME/localperl
  make test
  make install

Now, the first command was probably my mistake because I really have
no idea what that would do. I figured that I could simply use the
shebang after make test and make install was done doing it's thing
and type out #!/usr/local/bin/perl-5.10.0 or  #!/usr/local/bin/
perl-5.10 and everything was work just fine and I would be using Perl
5.10 This obviously is not the case as now it tells me I still have
5.8.8 installed. I know this is probably a very common problem and
I'll try and do all the research I can when I find the time but if any
of you that are a lot more experienced could help me out and put me
in the right direction that would be great.

Here is the code from the book (page 68) I am trying to run:
---
#!/usr/local/bin/perl-5.10.0 # I've also used perl5.10 and every
other thing I could think of...
use 5.010;
use strict;

sub marine {
state $n = 0;   # private, persistent variable $n
$n += 1;
print Hello, sailor number $n!\n;
}

marine;
marine;
marine;

And here is the output I am getting when I try running it:
Perl v.5.10.0 required --this is only v.5.8.8


I've also noticed that now there's a perl5.10.0 located in the /root/
localperl/bin so I am sure it has something to do with the
above .Configure command. Can anyone give me some advice on how to get
5.10 working? I feel like I am close, but nothing so far.

thanks in advance,
jim


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




How to find the modul a functions originates.

2009-01-15 Thread Deviloper
Hi,

is there an easy why to determit from which package/modul a function/methode is 
used?

I have the case of a very long inheritance chain and don´t know how to figure 
out the modul where a function has its source.

Thanks,
B.

RE: need help on perl script

2009-01-15 Thread Kammen van, Marco, Springer SBM NL
Looking at all his posts below with the exact same format just different 
questions...

Is this guy for real... or is this a spam bot??

- 
Marco van Kammen
Springer Science+Business Media
System Manager  Postmaster 
- 
van Godewijckstraat 30 | 3311 GX
Office Number: 05E21 
Dordrecht | The Netherlands 
-  
tel 
 +31(78)6576446
fax 
 +31(78)6576302

- 
www.springeronline.com 
www.springer.com
- 



-Original Message-
From: li...@lists.develooper.com [mailto:li...@lists.develooper.com] On Behalf 
Of zentara
Sent: Thursday, January 15, 2009 1:05 PM
To: beginners@perl.org
Subject: Re: need help on perl script

On Thu, 15 Jan 2009 10:29:37 +0530, srinivasa.pras...@wipro.com wrote:

Hi Zentara,

I would like to thank you for timely response.

But when I execute this code it gave lots of compliataion error, I have
attached the screen shot.
Pls help me to run this code successfully and to get the output.
And also wanted to know that do I need to do any pre-requisite procedure
beofre running this code.

You need to have the GTK2 libs installed.
See:  http://gtk2-perl.sourceforge.net/

If you don't want to install them, you can probably use ImageMagick's
import utility to grab a desktop screenshot, then get it's dimensions.

As to the rest of your posts:
This is not a forum to do your homework, or do your job for you.
Unless you show some code, as to what you have tried, you will not
get answers here by posting speifications, and asking for working
solutions. Hire a Perl programmer instead.this place is to help YOU
learn and we expect you to show your code attempts first.

Google and group.google have a giant library of previously posted code,
just search there.

zentara


-- 
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: Perl Newbie question about upgrade from Perl 5.8.8 to 5.10

2009-01-15 Thread Telemachus
On Wed Jan 14 2009 @  8:17, dolphin_sonar wrote:
 Hi,
 
 I bought the O'Reilly 5th edition Learning Perl the other day and it's
 great. I am new to programming and Perl as well. I do know my way
 around Linux but I am having problems upgrading from the version that
 was on my OS (Cent OS 5.2) to 5.10. I downloaded Perl 5.10 from
 http://www.cpan.org/authors/id/R/RG/RGARCIA/perl-5.10.0.tar.gz, then
 tar -xvzf perl-5.10.0.tar.gz the package in /usr/local/bin   I then
 followed the README guide that said to:
 
 ./Configure -des -Dprefix=$HOME/localperl
   make test
   make install
 
 Now, the first command was probably my mistake because I really have
 no idea what that would do.

In -Dprefix=$HOME/localperl, the variable $HOME is what you're not getting,
I think. That configuration line means build a new installation of Perl in
my home directory and put it all into a folder called localperl.
(Normally, the build would get put into the directory you choose, but then
into bin/, lib, share/ and man/ directories there.)

 I've also noticed that now there's a perl5.10.0 located in the /root/
 localperl/bin so I am sure it has something to do with the
 above .Configure command. Can anyone give me some advice on how to get
 5.10 working? I feel like I am close, but nothing so far.

Apparently, you were logged in as root when you built and installed this
version of Perl. That was a mistake. You should be root as little as
possible. (I can tell you were root since $HOME for root = /root. You
configured it to be built in $HOME/localperl and it was.) 

In any case, I would recommend that you remove entirely the localperl/
directory in your root home directory, and then start again. Download the
latest sources as a regular user, in your regular user's $HOME. Then build
it and install it there. After that you should be able to invoke it with
this shebang line: 
#!/home/username/localperl/bin/perl

Hope this helps, T

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




Re: need help on perl script

2009-01-15 Thread Telemachus
On Thu Jan 15 2009 @  1:12, Kammen van, Marco, Springer SBM NL wrote:
 Looking at all his posts below with the exact same format just different 
 questions...
 
 Is this guy for real... or is this a spam bot??
A real guy with a lot of homework?

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




RE: need help on perl script

2009-01-15 Thread Bob McConnell
From: Telemachus
 On Thu Jan 15 2009 @  1:12, Kammen van, Marco, Springer SBM NL wrote:
 Looking at all his posts below with the exact same format just
different questions...
 
 Is this guy for real... or is this a spam bot??
 A real guy with a lot of homework?

Or just an unrealistic set of expectations. He is asking how to write
simple scripts to replace significant (and expensive) applications. We
sell systems that could solve two of his problems. Who knows, in this
economic environment, those may be tasks assigned by a manager with a
desire to reduce expenses, but very little understanding of computers.
It is an interesting list.

Bob McConnell

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




Threadsafe-ing Modules

2009-01-15 Thread h3xx
I wrote a module that was designed to be instantiated and that object
be used by multiple threads. I guess I didn't exactly plan this out
from the beginning and ran into problems when trying to set it up so
that there was only one copy of the object and its data structure in
memory, while multiple threads called its subs.

Seeing as I couldn't just create an object in memory and share a
REFERENCE to it (this was my original plan, but that's apparently not
how threading works), I set about making it so the class, when
instantiated, existed in shared memory. I'm using threads::shared, by
the way.

My problem is that creating the object in the new() subroutine is
tedious, making sure every single bit of the data structure (most of
which is passed in as arguments) is share()d. This gets especially
tiresome when the user passes a multi-dimensional hash reference as a
constructor argument.

My question is whether there is a simpler way for creating an packaged-
based blessed object so that it and ALL its data structures exist in
shared memory?

Sample package with constructor:

package Foo;

sub new {
my $class = shift;
bless {
'option1'= 80,
'mydata'= {},
# over-ride with passed-in named arguments
@_,
}, $class
}

__END__

Called with:

my $f = Foo-new(
'option1' = 20,
'mydata' = {
[ one, two ],
[ three, four ],
}
);

__END__

I tried it with bless share({ ... }), $class but that returns an
empty blessed object.


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




Re: GD::Graph::bars - multiple x-axis data sets

2009-01-15 Thread Raymond Wan


Hi Danny,


Danny Miller wrote:

Hi, I've got two sets of data I'm displaying in a bar graph.  I'd like
to use two different colors for the different data.  I'm not sure how
to do this.

My code looks like:

@xdata1; # bunch of x values
@ydata1; # bunch of corresponding y values

@xdata2; # second set of x values I'd like to plot
@ydata2; # second set of y values



I have to admit that I have never used GD::Graph before.  However, something 
about what you are describing does not seem right.  A bar graph doesn't usually 
have two sets of x-values.  Just to clarify so that maybe someone else can help 
you, is this what you meant.

Suppose you have heights of men and women for a set of age groups:  0-15 years, 16-21 
years, 22-30 years, 30 and up [not to indicate life goes downhill from 30, but just to 
save me typing :-) ].  That means, for both men and women, you have 4 y-values each.  In 
order to compare men and women that are 0-15 years old, their x-values need to be the 
same.  [Actually, in this example, there are 4 bars each, and the x-values could just be 
discrete values like 0, 1, 2, 3.]

Somewhat of a trivial example, but can you change this example to what you are 
trying to do?  I'm just wondering whether or not a bar graph or even two graphs 
in a plot, is the tool you want...

Ray


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




Re: GD::Graph::bars - multiple x-axis data sets

2009-01-15 Thread Danny Miller
On Thu, Jan 15, 2009 at 10:13 PM, Raymond Wan r...@kuicr.kyoto-u.ac.jp wrote:

 Hi Danny,

Howdy.

 Danny Miller wrote:

 Hi, I've got two sets of data I'm displaying in a bar graph.  I'd like
 to use two different colors for the different data.  I'm not sure how
 to do this.

 My code looks like:

 @xdata1; # bunch of x values
 @ydata1; # bunch of corresponding y values

 @xdata2; # second set of x values I'd like to plot
 @ydata2; # second set of y values


 I have to admit that I have never used GD::Graph before.  However, something
 about what you are describing does not seem right.  A bar graph doesn't
 usually have two sets of x-values.  Just to clarify so that maybe someone
 else can help you, is this what you meant.

Sorry, that was a bit confusing.  Using your age example I am trying
to color the data for the 0-15, 16-21 and 30 and up ages black, but
color the 22-30 year age data red.  So, the x-axis data is of the same
scale, I'm just trying to figure out how to separate it visually.

I guess the @xdata1 would be something like [0-15, 16-21, 30+]
and @xdata2 is [22-30].  I can combine them into one array and pass
it into GD::Graph just fine, but I can't get the color delineation.

Thanks in advance,
Danny

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




RE: How and from where to install perl 5.10 on unix (solaris) m/c?

2009-01-15 Thread Sarsamkar, Paryushan
Yeah.. I tried that, but while installing DBI module that I have.. it failed 
saying you should have perl 5.8 or 5.10. That’s why I wanted to install perl 
5.10 which will have DBI inbuilt in it.

How can I do that?

Thanks,
Paryushan

-Original Message-
From: Ralf Peng [mailto:ralf.p...@gmail.com] 
Sent: Thursday, January 15, 2009 1:14 PM
To: Perl beginners
Subject: Re: How and from where to install perl 5.10 on unix (solaris) m/c?

2009/1/15 Sarsamkar, Paryushan psars...@ptc.com:
 Hi All,



 I would like to install Perl 5.10 on UNIX (Solaris) machine. There is
 5.0 and 5.6 version of Perl on that machine, but it does not have DBI
 module that I want. Can anyone please help me in this regard?


rather than installing Perl fully, you may more want to install DBI module.
you could install it from CPAN shell or download it from cpan.org then
intall it by hand.

Ralf.

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