perlembed : makefiles on win32

2005-03-22 Thread toolscripts

 I've tried following the perlembed manual example and the downloaded 
ExtUtils-Embed-1.14 on windows but the generated makefiles are wrong. Either 
they say "Expecting Rule Or Pattern found neither" or in one case it couldn't 
find perl.h and other headers.
Using Mingw, dont have VCC, tried with mingw32-make, nmake, dmake.
Does anyone have some example files that work that I can see?
Here's probably the problem, Im using perl-5.8.6.

I found it easy enough to compile with my own header, but it crashes on start.

--t

Re: perlembed : makefiles on win32

2005-03-23 Thread toolscripts
FYI  it's probably not the makefiles causing the problem if you can compile.

 PERL_SYS_INIT3(&argc,&argv,&env);  at the start of main solved my problem,
at least for now. See miniperlmain.c for example. (add
int PL_use_safe_putenv =1;
int PL_do_undump = 0;
if needed)

--t

- Original Message - 
From: "toolscripts" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 22, 2005 5:00 PM
Subject: perlembed : makefiles on win32



 I've tried following the perlembed manual example and the downloaded
ExtUtils-Embed-1.14 on windows but the generated makefiles are wrong. Either
they say "Expecting Rule Or Pattern found neither" or in one case it
couldn't find perl.h and other headers.
Using Mingw, dont have VCC, tried with mingw32-make, nmake, dmake.
Does anyone have some example files that work that I can see?
Here's probably the problem, Im using perl-5.8.6.

I found it easy enough to compile with my own header, but it crashes on
start.

--t



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




no main, perlembed env

2005-03-28 Thread toolscripts
perlembed for perl-5.8.6 : 
I'm trying to do something like this:

int useargs(int argc, char **argv, char **env)
{
 PERL_SYS_INIT3(&argc,&argv,&env);
...
 }

The trouble is I don't think I'm supposed to retrieve the env pointer in the 
wxWidgets SDK I'm using. Basically I can't seem to get ahold of env and it 
crashes. This is a windows gui app and perl is a part that should be able to be 
disabled, in case it's dll is unavailable etc.
Any tips on how i should get env, reconstruct it since i can find individual 
enviromental vars, or bypass sys init?

--t

Re: New to CGI.pm

2005-03-31 Thread toolscripts
Sorry if I'm not totally clear on this myself, but are you saying you are
trying to use it without POST, GET or COOKIE usage? The solution might be to
use a file named based on the user's ip.

--t


- Original Message - 
From: "Jeff Borders" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, March 31, 2005 12:39 PM
Subject: New to CGI.pm


> I've written a perl program to quiz myself using a simple text file as
> input.
>
> Input file:
>
> answer = question
> answer = question
> etc...
>
> When I try to convert this program to a cgi program to use from a web
> browser, it will not pass the parameters back to the program after
> drawing the page.  I've tried saving the parameter to a variable.  I
> even tried pulling it from the param array, which it appears in.
>
> The program starts and presents a menu of test chapters, then after user
> selection, it exits the program as if I finished the exam.
>
> Could someone give me some guidance?
>
> Thank you,
>
> Jeff Borders
>
> http://www.jeffborders.com/cgi-bin/korean-cgi.pl
>
> Listing below:
>
> 
>
> #!/usr/bin/perl
>
> use warnings;
> use CGI qw/-debug :standard/;
> use CGI::Carp qw(fatalsToBrowser);
> use CGI::Pretty qw(:html3);
>
> print header,
> start_html('Korean Terminology'),
> h1('Korean Terminology'),
> start_form,
> p,hr,p;
>
> foreach $name ( param() ) {
> $value = param($name);
> print "The value of $name is $value\n"
> }
>
> $test=param('test');
>
> if (param()) {
> if ($test eq "9th Gup") { $test="9gup.txt"; }
> elsif ($test eq "8th Gup") { $test="8gup.txt"; }
> elsif ($test eq "7th Gup") { $test="7gup.txt"; }
> elsif ($test eq "6th Gup") { $test="6gup.txt"; }
> elsif ($test eq "5th Gup") { $test="5gup.txt"; }
> elsif ($test eq "4th Gup") { $test="4gup.txt"; }
> elsif ($test eq "3rd Gup") { $test="3gup.txt"; }
> elsif ($test eq "2nd Gup") { $test="2gup.txt"; }
> elsif ($test eq "1st Gup") { $test="1gup.txt"; }
> elsif ($test eq "1st Dan") { $test="1dan.txt"; }
> else { print "no such test name"; }
>
> &main_section();
>
> }
> else {
> print h2('Choose test:');
> &choose_test();
> &process_test();
> }
>
>
> print p,hr,p;
> print end_form, end_html;
>
>
> sub choose_test
> {
> print radio_group(-name=>'test', -value=>['9th Gup','8th Gup','7th
> Gup','6th Gup','5th Gup','4th Gup','3rd Gup','2nd Gup','1st Gup','1st
> Dan'], -cols=>4);
> print p;
> print submit(-name=>'test',-label=>'Enter'),
> reset(-name=>'reset',-label=>'Cancel');
> print p;
> $test=param('test');
> return $test;
> }
>
> sub process_test
> {
> print p;
> print "test = $test";
> print p;
> print param('test');
> $number_of_questions=0;
> open (DICT, $test) || die "Cannot open '$test' $!";
> while () {
> chomp;
> $number_of_questions++;
> ($answer, $question) = split /\s*=\s*/;
> $answer[$number_of_questions] = $answer;
> $question[$number_of_questions] = $question;
> }
> close DICT;
> print p;
> print "number_of_questions = $number_of_questions\n";
> return $number_of_questions;
> }
>
> sub main_section
> {
> $total=0;
> $total++;
> while ($total <= $number_of_questions || $response eq 'Cancel')
> # || $total > $number_of_questions)
> {
> &pick_question();
> &pick_order();
> &print_question();
> &get_response();
> }
> &print_result();
> print p; print "\ntotal number of questions = $number_of_questions\n";
> print p; print "\ntotal = $total\n";
>
> }
>
> sub pick_question
> { #Pick a unique question from list
> do {
> $random_question = 1 + int(rand($number_of_questions));
> } while ( grep (/$random_question/, @answered) );
> push @answered, $random_question;
> return $random_question;
> }
>
> sub pick_order
> { #Pick which position to insert the correct answer.
> $random_order = 1 + int(rand(4)); #returns an integer from (0..3) + 1.
> return $random_order;
> }
>
> sub print_question
> {
> print start_form,
> "Question number $total of $number_of_questions",hr,p,"$question
> [$random_question]",p; #Print the question.
> my @temp_answers;
> my $temp_answer;
> push @temp_answers, $random_question;#This keeps the answer from
> showing up twice on the same question.
> for my $i (1..4)   #Print the possible answers.
> {
> if ($i == $random_order)
> {
> #print correct value from array.
> push @temp_answers, $answer[$random_question];
>   }
> else
> {
> ### Make sure that bogus answer does not equal answer or other 2
> bogus answers ###
> do
> {
> $temp_answer =  1 + int(rand($number_of_questions));
> } while ( grep (/$temp_answer/, @temp_answers) );
> #print incorrect value from array.
> push @temp_answers, $answer[$temp_answer];
> }
> }
> print radio_group(-name=>'answer', -value=>[EMAIL PROTECTED], -cols=>1);
> $answers=param('answer');
> print p;
> print submit(-name=>'answer',-label=>'Enter'),
> reset(-name=>'reset',-label=>'Cancel');
> print p;
> print end_form;
> }
>
> sub get_response
> {
> $response=param('answer');
> if ($response eq 'Cancel')
> {
>   print p;
>   $total--;
> }
> elsif ($response != $random_order)
> { #print

Re: AutoIncrement Database Fields for MySQL and PostGreSQL

2005-04-11 Thread toolscripts
"SELECT MAX(id)+1 as lastid FROM table"
(It's not +1 if you already said INSERT etc)

I'm not sure what normalized relations are, but I think this will help
anyway.

--t


- Original Message - 
From: "Siegfried Heintze" <[EMAIL PROTECTED]>
To: "'Perl Beginners'" 
Sent: Monday, April 11, 2005 4:18 PM
Subject: AutoIncrement Database Fields for MySQL and PostGreSQL


> If I use the auto-increment feature for a couple of normalized relations,
> how do I insert into them?
>
> Specifically, when I insert into a relation with the autoincrement feature
> on the primary key, how do I get the value of the index on the newly
created
> row so I can use that the value of a foreign key in another relation?
>
> I'm using DBI for a multithreaded application, sometimes for MySQL and
> sometimes for PostGreSQL. In MSAccess, I know, I can only say SELECT
MAX(ID)
> which does not work well for a multithreaded application.
>
> Thanks,
> Siegfried
>
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Starting Template for calling C from Perl

2005-04-22 Thread toolscripts
I don't think there are any such examples besides the manual. There are
generally clear warnings as to why not to try to do the c code from scratch.
Either work with the xs system directly, or try http://www.swig.org which
has good and bad sides to it. If you described the problem you're having I
can probably help.

--t

- Original Message - 
From: "Siegfried Heintze" <[EMAIL PROTECTED]>
To: "'Perl Beginners List'" 
Sent: Friday, April 22, 2005 9:37 AM
Subject: Starting Template for calling C from Perl


> I was looking at "Programming Perl" trying to understand how to write OS
> vendor neutral C functions to be called by perl and felt a little
> overwhelmed (as usual when reading that book).
>
> Can someone recommend a template that works with windows/MSVC/nmake or
> Cygwin/GCC/make (unix clone for windows platform) that does something
> trivial in C like print "hello" or adds two numbers or concatenates two
> strings that will run out of the box and I can just modify.
>
> Thanks,
> Siegfried
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: problem with $1

2005-06-03 Thread toolscripts
Perhaps the following applies.
"Usually this name is a single identifier, that is, a string beginning with
a letter or underscore, and containing letters, underscores, and digits."

-ts
- Original Message - 
From: "Nischi" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 02, 2005 10:16 PM
Subject: problem with $1


> Hello
>
> The matched string which is stored in $1 is getting corrupted.
>
> the regular expression i have is
>
> "\xa0\xa0\xa0\x{100}" =~ /(\xa0+)/;
>
> when i say ... if($1 eq "\xa0\xa0\xa0") this is true. It is working fine
in Linux but not working (ASCII platform) but it is not working in EBCIDIC
platform it is not working.
>
> regards,
> Nischitha
>
>
> Failure is the step for success. If you know you are failed it will be
easy to climb step.
>
> -
>  Free antispam, antivirus and 1GB to save all your messages
>  Only in Yahoo! Mail: http://in.mail.yahoo.com



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]