[27909] in Perl-Users-Digest
Perl-Users Digest, Issue: 9273 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 9 11:05:58 2006
Date: Fri, 9 Jun 2006 08:05:06 -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 Fri, 9 Jun 2006 Volume: 10 Number: 9273
Today's topics:
Re: [Fwd: Gtk and Glib::Timeout] <zentara@highstream.net>
Re: [OT] Why the speed of reading data from ramdisk is <rvtol+news@isolution.nl>
Re: Binding array to pattern <nobull67@gmail.com>
CGI for collecting phone numbers <ferreira@unm.edu>
Re: CGI for collecting phone numbers <bart@nijlen.com>
creating log file <hara.acharya@gmail.com>
Re: creating log file <xemoth@gmail.com>
Re: creating log file <David.Squire@no.spam.from.here.au>
Re: creating log file <rengolin@gmail.com>
Re: creating log file <prawnMUNG@prawn.me.uk>
Error when connecting to database using Win32::ODBC <madan.narra@gmail.com>
Re: Error when connecting to database using Win32::ODBC <David.Squire@no.spam.from.here.au>
Re: Error when connecting to database using Win32::ODBC <madan.narra@gmail.com>
Re: Error when connecting to database using Win32::ODBC <David.Squire@no.spam.from.here.au>
Re: filename charset and internal Perl utf8 <ynleder@nspark.org>
Re: filename charset and internal Perl utf8 <ynleder@nspark.org>
Help - Inline::C arrayref deref? <leegee@gmail.com>
Re: Inverse Sequence Matching <tadmc@augustmail.com>
Merge part of CSV files <duncan@itswakeling.com>
Re: MIME::Parser and Purge / Prune <afrinspray@gmail.com>
Proposed Changes (was Re: Posting Guidelines for comp.l <tadmc@augustmail.com>
Re: split a big program into multiple files <benmorrow@tiscali.co.uk>
Re: Still error coming when connecting to database usin <tadmc@augustmail.com>
Still Error when connecting to database using Win32::OD <madan.narra@gmail.com>
Re: What is Expressiveness in a Computer Language <eval.apply@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Jun 2006 14:00:39 GMT
From: zentara <zentara@highstream.net>
Subject: Re: [Fwd: Gtk and Glib::Timeout]
Message-Id: <h2vi829jo5i45sgm3e1avk6krr5pun115d@4ax.com>
On Thu, 08 Jun 2006 18:47:17 +0200, "Y.G." <yg_blah_@this_domain.bla>
wrote:
>I am writing a program in perl which invokes a small window. This window
>should time out after some time. For the window I use Gtk2. For the
>timeout I use Glib::Timeout
>
>The code looks something like this:
>
>my $dialog = new Gtk2::Dialog( );
>
>(creating some buttons and all)
>
>my $timer = Glib::Timeout->add( $interval, \&some_func));
>
>Gtk2->main;
>
>
>This returns Not a CODE reference at /program_path line line_number
That seems to say that the sub some_func isn't declared yet.
>
>Should I use Glib (and how?) or is there any other function I should use.
All you need to do is return FALSE from the sub after the timeout
period. Timers keep running as long as they return TRUE from the
code reference.
$id = Glib::Timeout->add ($milliseconds, \&timeout_handler);
sub timeout_handler {
do_cool_stuff ();
return $keep_running_or_not;
}
but since it's a 1 shot timer, it can all be in one line,
for a 10 second timeout
my $id = Glib::Timeout->add (10000, sub{ return 0 } );
are you trying to make the dialog only stay up 10 seconds?
Only moderately tested code follows....................
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw(TRUE FALSE);
use Gtk2 '-init';
my $dialog = Gtk2::Dialog->new ('Confirmation Dialog', undef, 'modal',
'gtk-ok' => 'ok', # response ids may be one of the built-in enums...
'_Cancel' => 2, # or any positive integer.
);
# put an hbox with a label and entry into the dialog's vbox area.
my $hbox = Gtk2::HBox->new (FALSE, 6);
$hbox->pack_start (Gtk2::Label->new ('Continue Real Transfer? '), TRUE,
TRUE, 0);
$hbox->show_all;
$dialog->vbox->pack_start ($hbox, TRUE, TRUE, 0);
# Set which response is the default:
$dialog->set_default_response ('ok');
# connect a signal to the dialog's response signal.
$dialog->signal_connect (response => sub {
# get our params
shift; # we don't need the dialog
my $response = shift; # the clicked button
print "The user clicked: $response\n";
if ($response eq 'ok')
{
Gtk2->main_quit;
}
elsif ($response eq 'delete-event')
{
$response = 2;
}
elsif ($response == 2)
{
}
});
# show the dialog
$dialog->show;
my $id = Glib::Timeout->add (5000, sub{
print "timeded out\n";
$dialog->destroy;
return FALSE;
});
Gtk2->main;
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Fri, 9 Jun 2006 12:20:15 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: [OT] Why the speed of reading data from ramdisk is the same as harddisk?
Message-Id: <e6bp5m.ps.1@news.isolution.nl>
sonet schreef:
> Subject: Why the speed of reading data from ramdisk is the same as
harddisk?
Why not? There is easily more than 1 RAM-buffer involved: many harddisks
have 8 MB RAM aboard, and the OS reads large chunks from the harddisk at
a time, even if you ask only for a single byte.
About writing: many harddisks report 'OK' when the data is available, so
long before the data is physically written to 'the platters'.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 9 Jun 2006 05:17:55 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Binding array to pattern
Message-Id: <1149855475.824531.49490@g10g2000cwb.googlegroups.com>
Shmuel (Seymour J.) Metz wrote:
> I'd like to bind an array to a pattern. I couldn't find anything in
> the Camel book about the context for the left side of the binding
> operator. I ran some tests, and it appears that I get scalar context
> if I write
>
> while (@anarray =~ /pattern/g) {
> block;
> }
>
> which means that I match against the size rather than the contents. I
> tried
>
> while ("@anarray" =~ /pattern/g) {
> block;
> }
>
> but that went into a loop.
There problem is that you are using an expression with =~ //g
There was a similar problem here a while back.
http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/1cdea0dc1313b9b7/9bdc49d7f9d7bf31
> Is there a description that I missed of interpolation for the left
> side of the binding operator?
It's not the fact that it's interpolation, it's the fact that it's an
rvalue expression so each time round the while() loop the =~ is binding
to a new string and the /g position pointer is starts again at zero.
------------------------------
Date: 9 Jun 2006 07:16:06 -0700
From: "ferreira@unm.edu" <ferreira@unm.edu>
Subject: CGI for collecting phone numbers
Message-Id: <1149862566.572514.219140@c74g2000cwc.googlegroups.com>
I would like to have my visitors sign up for text message updates. What
I need is to have the form submit to a .txt file on the server. All I
need is a list of phone numbers. Does anyone have the cgi or pl code
that would accomplish this task?
------------------------------
Date: 9 Jun 2006 07:51:01 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: CGI for collecting phone numbers
Message-Id: <1149864660.893800.116050@c74g2000cwc.googlegroups.com>
ferreira@unm.edu wrote:
> I would like to have my visitors sign up for text message updates. What
> I need is to have the form submit to a .txt file on the server. All I
> need is a list of phone numbers. Does anyone have the cgi or pl code
> that would accomplish this task?
I would say the most common approach is to have three files:
1. your HTML input form
2. the .pl file that receives the sent data
3. the .txt file the phone number is written to
--
Bart
bb||!bb? -William Shakespeare
------------------------------
Date: 9 Jun 2006 04:55:21 -0700
From: "king" <hara.acharya@gmail.com>
Subject: creating log file
Message-Id: <1149854121.725325.89770@i40g2000cwc.googlegroups.com>
Suppose I have written a perl script and a lot of print commands are
there in the script.
I want to keep all the things I am printing into a test file.
Or you can say I want to create a log file.
How can I keep everything i am printing into a log file.
Regards
------------------------------
Date: 9 Jun 2006 05:09:32 -0700
From: "Owen" <xemoth@gmail.com>
Subject: Re: creating log file
Message-Id: <1149854971.950960.10070@f6g2000cwb.googlegroups.com>
king wrote:
> Suppose I have written a perl script and a lot of print commands are
> there in the script.
> I want to keep all the things I am printing into a test file.
>
> Or you can say I want to create a log file.
>
> How can I keep everything i am printing into a log file.
Open a file to write to
open (FH,">name_of_file")or die "Cant open name_of_file $!\n";
(check the difference between > and >> when opening files for writing
to)
Then print to it.
print FH "whatever you were goind to print with a normal print
statement\n";
Xemoth
------------------------------
Date: Fri, 09 Jun 2006 13:15:21 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: creating log file
Message-Id: <e6boop$mqq$1@news.ox.ac.uk>
Owen wrote:
> king wrote:
>> Suppose I have written a perl script and a lot of print commands are
>> there in the script.
>> I want to keep all the things I am printing into a test file.
>>
>> Or you can say I want to create a log file.
>>
>> How can I keep everything i am printing into a log file.
>
>
> Open a file to write to
>
> open (FH,">name_of_file")or die "Cant open name_of_file $!\n";
> (check the difference between > and >> when opening files for writing
> to)
Better (safer, and scoped):
open my $FH, '>', 'name_of_file' or die "Can't open name_of_file $!\n";
> Then print to it.
>
> print FH "whatever you were goind to print with a normal print
> statement\n";
print $FH "whatever you were going to print with a normal print
statement\n";
or you could look at redirecting STDOUT, or check out the various
logging modules available at cpan.
DS
------------------------------
Date: Fri, 09 Jun 2006 14:08:19 +0100
From: Renato <rengolin@gmail.com>
Subject: Re: creating log file
Message-Id: <448972b4$0$783$da29aeef@newsread.sanger.ac.uk>
Owen wrote:
> open (FH,">name_of_file")or die "Cant open name_of_file $!\n";
> (check the difference between > and >> when opening files for writing
> to)
> Then print to it.
>
> print FH "whatever you were goind to print with a normal print
> statement\n";
close FH;
;)
--renato
------------------------------
Date: Fri, 09 Jun 2006 14:12:13 +0100
From: prawn <prawnMUNG@prawn.me.uk>
Subject: Re: creating log file
Message-Id: <448973a9$0$3540$ed2619ec@ptn-nntp-reader01.plus.net>
Renato wrote:
> Owen wrote:
>> open (FH,">name_of_file")or die "Cant open name_of_file $!\n";
>> (check the difference between > and >> when opening files for writing
>> to)
>> Then print to it.
>>
>> print FH "whatever you were goind to print with a normal print
>> statement\n";
>
> close FH;
>
> ;)
>
For a non Perl solution: perl myperl.pl > myperl.log
;)
--
p LotR#9 BotM#1
------------------------------
Date: 9 Jun 2006 06:26:23 -0700
From: "madan" <madan.narra@gmail.com>
Subject: Error when connecting to database using Win32::ODBC
Message-Id: <1149859583.128419.312120@i39g2000cwa.googlegroups.com>
hi all,
i am getting a error when i use Win32::ODBC..Please check it out and
see weather its working on ur systems..i need to connect to database...
#! /usr/bin/perl
use lib '/cgi-bin/lib';
require("CGI.pm");
use CGI::Carp 'fatalsToBrowser';
use CGI;
use Win32::ODBC;
my $cgi = CGI->new;
$dbh= new Win32::ODBC("dsn=test");
print $cgi->header( 'text/html' );
print $cgi->start_html;
print $cgi->startform("get","/cgi-bin/data.cgi");
if(!$dbh)
{
&printFailure;
exit();
}
else
{
&printSucess;
}
sub printFailure {
print "failure in connecting <br>".Win32::ODBC::Error();
}
sub printSucess {
print "Connection Sucessful<br>";
}
print $cgi->endform;
print $cgi->end_html;
############################
The following error is coming only when i use Win32::ODBC module..
when i removed it the program is working fine..I checked the dsn,user
name and password all are right...
the following error is shown on the browser..
##########################################################################
Undefined subroutine &Scalar::Util::blessed called at
W:/usr/lib/overload.pm line 89.
Compilation failed in require at W:/usr/lib/Config.pm line 70.
Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.
Compilation failed in require at W:/cgi-bin/dbtest.pl line 7.
BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 7.
############################################################################
i am new to perl...so i dont have enough stuff to write a good
syntax...
thanks in advance
------------------------------
Date: Fri, 09 Jun 2006 14:30:41 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Error when connecting to database using Win32::ODBC
Message-Id: <e6bt62$ohe$1@news.ox.ac.uk>
madan wrote:
> hi all,
> i am getting a error when i use Win32::ODBC..Please check it out and
> see weather its working on ur systems..i need to connect to database...
> #! /usr/bin/perl
missing:
use strict;
use warnings;
# get Perl to help you help yourself before asking here.
> require("CGI.pm");
...
> use CGI;
Which of these do you mean (almost certainly the second)? This problem
has already been pointed out to you, as have others still in your code.
Read, understand, and act on advice rather than just reposting your problem.
DS
------------------------------
Date: 9 Jun 2006 06:44:47 -0700
From: "madan" <madan.narra@gmail.com>
Subject: Re: Error when connecting to database using Win32::ODBC
Message-Id: <1149860687.680248.171030@g10g2000cwb.googlegroups.com>
sir,
still the same error...befor i tried with strict and warning but didnt
execute...the same is the case when i included strict and warning...
the following errors are shown on browser...
#########
Undefined subroutine &Scalar::Util::blessed called at
W:/usr/lib/overload.pm line 89.
Compilation failed in require at W:/usr/lib/Config.pm line 70.
Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.
Compilation failed in require at W:/cgi-bin/dbtest.pl line 8.
BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 8.
##########
------------------------------
Date: Fri, 09 Jun 2006 14:54:51 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Error when connecting to database using Win32::ODBC
Message-Id: <e6bujb$ovr$1@news.ox.ac.uk>
madan wrote:
> sir,
You are not replying to me, you are replying to the whole group
comp.perl.lang.misc
You need to read and follow the posting guidelines for this group
(posted earlier today), or soon you will find that no one is seeing your
posts. Briefly: quote context when you reply, include attributions of
quotes, and don't top-post.
>
> still the same error...befor i tried with strict and warning but didnt
> execute...
Then read the error messages/warnings that are produced when using
strict and warnings and fix the problems!
You should have all the perl documentation with your distribution, but
if you would prefer to read it on-line it is available at
http://www.perl.com/pub/q/documentation
What have you done about require/using the CGI module?
the same is the case when i included strict and warning...
> the following errors are shown on browser...
>
> #########
> Undefined subroutine &Scalar::Util::blessed called at
> W:/usr/lib/overload.pm line 89.
> Compilation failed in require at W:/usr/lib/Config.pm line 70.
> Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.
> Compilation failed in require at W:/cgi-bin/dbtest.pl line 8.
> BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 8.
> ##########
>
Get your script to compile cleanly with "use strict;" and "use
warnings;" first. Then we can look at any remaining problems.
DS
------------------------------
Date: Fri, 9 Jun 2006 13:07:06 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: filename charset and internal Perl utf8
Message-Id: <MPG.1ef374c56a70a563989882@news.tiscali.fr>
In article <1149803026.432616.125610@u72g2000cwu.googlegroups.com>,
jl_post@hotmail.com says...
> $name = decode("utf8", $name);
> $value = decode("utf8", $value);
>
Thanks, but I don't understand your reply. What you show is exactly what
I'm doing already : decode to internal utf8 the name and value pairs.
So, it works for all the pairs unless the value containing the filename
as explained in my original message.
------------------------------
Date: Fri, 9 Jun 2006 15:28:30 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Re: filename charset and internal Perl utf8
Message-Id: <MPG.1ef395ece5a85499989883@news.tiscali.fr>
In article <1149803026.432616.125610@u72g2000cwu.googlegroups.com>,
jl_post@hotmail.com says...
> $value = decode("utf8", $value);
>
Oops, OK, now I'm seeing. Poor of me :)
------------------------------
Date: 9 Jun 2006 06:42:29 -0700
From: "Lee" <leegee@gmail.com>
Subject: Help - Inline::C arrayref deref?
Message-Id: <1149860549.072525.291250@j55g2000cwa.googlegroups.com>
Please help: I'm trying to do the my first real thing in Inline::C and
have got stuck trying to get expected values from an array reference.
I pass in an anonymous array of one value, the number 1, and I get back
135435488.
>From the code you can see that I realise it is the way I getting at the
values in the input array, but I can't figure out where to go from
here...
Any help would be appreciated.
Thanks in anticipation
lee
Output from the code below:
$VAR1 = [ 99 ];
$VAR1 = [ 135435488 ];
Code:
#! perl
package Testing;
use strict;
use warnings;
use Data::Dumper;
use Inline "C";
Inline->init;
my @amps = test( 1, [1] );
warn Dumper @amps;
my @amps = test( 2, [2] );
warn Dumper @amps;
exit;
1;
__DATA__
__C__
AV* test (
int mode,
SV* rpcm
){
AV* av_ret = newAV(); // Return values
AV* av_pcm = newAV(); // Dereferenced PCM input array
if (SvROK(rpcm) && (SvTYPE(SvRV(rpcm)) == SVt_PVAV))
av_pcm = (AV*)SvREFCNT_inc(SvRV(rpcm));
if (mode==1){
int x = 99;
av_push( av_ret, newSViv(x) );
} else {
int x = av_fetch(av_pcm, 0, 0);
av_push( av_ret, newSViv(x) );
}
return av_ret;
}
------------------------------
Date: Fri, 9 Jun 2006 08:40:48 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Inverse Sequence Matching
Message-Id: <slrne8iuj0.5b0.tadmc@magna.augustmail.com>
bilaribilari@yahoo.com <bilaribilari@yahoo.com> wrote:
> I have the following text:
>
><SP>http://poplet.com/laseaer<SP><SP>some:text with colon<SP>
>
> I am trying to come up with a regular expression that
> 1. Matches anything between <SP> tags, and
> 2. Does NOT match if the text contains ://
my @matches = grep !m#://#, /<SP>(.*?)(?=<SP>)/g;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Jun 2006 06:47:13 -0700
From: "sparrie2k" <duncan@itswakeling.com>
Subject: Merge part of CSV files
Message-Id: <1149860833.396416.91580@i39g2000cwa.googlegroups.com>
Hi,
I'm trying to merge some CSV files into one. They all have a header
line, a single data line and footer line, but it is only the data line
(minus the first field) that I want to merge. The bit I'm missing-out
from the data line is a line number (always 001 in the single files) so
I'll be doing an incremental count in the combined file. The header and
footer lines are not required at all.
Has anyone got any ideas on a quick and easy way to do this?
TIA,
Dunc
------------------------------
Date: 9 Jun 2006 07:59:05 -0700
From: "afrinspray" <afrinspray@gmail.com>
Subject: Re: MIME::Parser and Purge / Prune
Message-Id: <1149865145.165240.165120@c74g2000cwc.googlegroups.com>
Bump...
afrinspray wrote:
> I'm using MIME Parser to parse emails for a listserv application.
> Everything works great except for the final cleanup stage. I end up
> with literally hundreds of directories (one per message) which aren't
> pruned upon completion. I could rm -rf them, but I'm guessing that I'm
> not telling MIME::Parser to clean up correctly. Here's my code:
>
> $parser = new MIME::Parser;
> $parser->output_under("/tmp");
> $parser->output_prefix("msg");
> $parser->decode_headers(0);
> $parser->extract_nested_messages(0);
> $parser->extract_uuencode(1);
> $parser->ignore_errors(1);
>
> [...parsing...]
>
> $parser->filer->purge;
>
> I end up with hordes of /tmp/msg- directories. Did I miss a step here?
> Does the output_under directive intentionally leave a copy there? I
> was under the impression that purge should remove the directories.
>
>
> Thanks,
> Mike
------------------------------
Date: Fri, 9 Jun 2006 09:44:16 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Proposed Changes (was Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $))
Message-Id: <slrne8j2a0.5g9.tadmc@magna.augustmail.com>
tadmc@augustmail.com <tadmc@augustmail.com> wrote:
In a recent post (news://yvn8xozx7j5.fsf@famous02.dal.design.ti.com)
Joel Graber proposed some changes to the posting guidelines. I didn't
have time to monitor the discussion then, but now I do...
... so ... discuss!
Below is the current text, and Joel's suggested replacement text.
> Speak Perl rather than English, when possible
> Perl is much more precise than natural language. Saying it in Perl
> instead will avoid misunderstanding your question or problem.
>
> Do not say: I have variable with "foo\tbar" in it.
>
> Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
> or I have $var = <DATA> (and show the data line).
>
> Ask perl to help you
> You can ask perl itself to help you find common programming mistakes
> by doing two things: enable warnings (perldoc warnings) and enable
> "strict"ures (perldoc strict).
>
> You should not bother the hundreds/thousands of readers of the
> newsgroup without first seeing if a machine can help you find your
> problem. It is demeaning to be asked to do the work of a machine. It
> will annoy the readers of your article.
>
> You can look up any of the messages that perl might issue to find
> out what the message means and how to resolve the potential mistake
> (perldoc perldiag). If you would like perl to look them up for you,
> you can put "use diagnostics;" near the top of your program.
>
> Do not re-type Perl code
> Use copy/paste or your editor's "import" function rather than
> attempting to type in your code. If you make a typo you will get
> followups about your typos instead of about the question you are
> trying to get answered.
>
> Provide enough information
> If you do the things in this item, you will have an Extremely Good
> chance of getting people to try and help you with your problem!
> These features are a really big bonus toward your question winning
> out over all of the other posts that you are competing with.
>
> First make a short (less than 20-30 lines) and *complete* program
> that illustrates the problem you are having. People should be able
> to run your program by copy/pasting the code from your article. (You
> will find that doing this step very often reveals your problem
> directly. Leading to an answer much more quickly and reliably than
> posting to Usenet.)
>
> Describe *precisely* the input to your program. Also provide example
> input data for your program. If you need to show file input, use the
> __DATA__ token (perldata.pod) to provide the file contents inside of
> your Perl program.
>
> Show the output (including the verbatim text of any messages) of
> your program.
>
> Describe how you want the output to be different from what you are
> getting.
jgraber@ti.com <jgraber@ti.com> wrote:
JG> So here is a suggested cutdown to replace the 53 lines:
JG> /Speak Perl/ .. /from what you are getting./
JG>
JG> ## start new, 49 lines: saves 4 lines overall
JG> Ask perl to help you
JG> You can ask perl itself to help you find and understand
JG> common programming mistakes by doing three things:
JG> use strict; # see perldoc strict
JG> use warnings; # see perldoc warnings
JG> use diagnostics; # see perldoc diagnostics
JG>
JG> Provide enough information
JG> If you post like the example below, you will have an Extremely Good
JG> chance of getting people to try and help you with your problem!
JG> These features help your question win out over all the other posts.
JG>
JG> First make a short (less than 20-30 lines) and *complete* program
JG> that illustrates the problem you are having. You will find that
JG> this step often solves your problem or leads you to an answer
JG> more reliably than posting to Usenet.
JG>
JG> Do not re-type Perl code
JG> Use copy/paste instead of re-typing Perl code, to avoid typos.
JG> People should be able to run your program
JG> by copy/pasting from your article.
JG>
JG> The following article demonstrates at least 8 good guidelines:
JG> * show incorrect output * show desired output
JG> * short/complete * good subject line * Speak Perl
JG> * input __DATA__ * use warnings/strict * cut/pasteable
JG>
JG> Subject: How do I change all 'a' to 'b' with a regexp?
JG>
JG> I want to change all 'a' to 'b' with a regexp.
JG> but only the first 'a' is getting changed.
JG> This is the incorrect output of my program:
JG> First line of text dbta
JG> What I wanted is this, note dbtb, not dbta.
JG> First line of text dbtb
JG>
JG> Here is my program you can copy/paste to run.
JG>
JG> #!/usr/local/bin/perl
JG> use warnings;
JG> use strict;
JG> while (<DATA>) {
JG> $_ =~ s/a/b/;
JG> print $_; }
JG> __DATA__
JG> First line of text data
JG>
JG> However, the above may fail the faux pas "..cursory doc search",
JG> since the answer, s/a/b/g; is in 'perldoc perlop' near 's/PATTERN/'
JG> ## end new
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 9 Jun 2006 13:16:42 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: split a big program into multiple files
Message-Id: <ae5ol3-9iu.ln1@osiris.mauzo.dyndns.org>
Quoth "filippo" <filippo2991@virgilio.it>:
> I know more or less how to split. I'd like to know the best way to
> import. I know the 'do' way, are there problems to do this using do?
The modern way is to use 'use'. Read perlmod and perlnewmod.
Ben
--
Musica Dei donum optimi, trahit homines, trahit deos. |
Musica truces mollit animos, tristesque mentes erigit.|benmorrow@tiscali.co.uk
Musica vel ipsas arbores et horridas movet feras. |
------------------------------
Date: Fri, 9 Jun 2006 08:42:29 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Still error coming when connecting to database using Win32::ODBC
Message-Id: <slrne8ium5.5b0.tadmc@magna.augustmail.com>
madan <madan.narra@gmail.com> wrote:
> The following error is coming only when i use Win32::ODBC module..
Please do not send stealth Cc copies of Usenet postings.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Jun 2006 06:46:15 -0700
From: "madan" <madan.narra@gmail.com>
Subject: Still Error when connecting to database using Win32::ODBC
Message-Id: <1149860775.621019.9420@i40g2000cwc.googlegroups.com>
sir,
still the same error...befor i tried with strict and warning but didnt
execute...the same is the case when i included strict and warning...
the following errors are shown on browser...
#########
Undefined subroutine &Scalar::Util::blessed called at
W:/usr/lib/overload.pm line 89.
Compilation failed in require at W:/usr/lib/Config.pm line 70.
Compilation failed in require at W:/usr/site/lib/Win32/ODBC.pm line 27.
Compilation failed in require at W:/cgi-bin/dbtest.pl line 8.
BEGIN failed--compilation aborted at W:/cgi-bin/dbtest.pl line 8.
##########
------------------------------
Date: 9 Jun 2006 07:34:47 -0700
From: "Joe Marshall" <eval.apply@gmail.com>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <1149863687.298352.45980@h76g2000cwa.googlegroups.com>
Xah Lee wrote:
> in March, i posted a essay "What is Expressiveness in a Computer
> Language", archived at:
> http://xahlee.org/perl-python/what_is_expresiveness.html
>
> I was informed then that there is a academic paper written on this
> subject.
>
> On the Expressive Power of Programming Languages, by Matthias
> Felleisen, 1990.
> http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
>
> Has anyone read this paper? And, would anyone be interested in giving a
> summary?
The gist of the paper is this: Some computer languages seem to be
`more expressive' than
others. But anything that can be computed in one Turing complete
language can be computed in any other Turing complete language.
Clearly the notion of
expressiveness isn't concerned with ultimately computing the answer.
Felleisen's paper puts forth a formal definition of expressiveness in
terms of semantic
equivilances of small, local constructs. In his definition, wholescale
program transformation is
disallowed so you cannot appeal to Turing completeness to claim program
equivalence.
Expressiveness isn't necessarily a good thing. For instance, in C, you
can express the
addresses of variables by using pointers. You cannot express the same
thing in Java, and
most people consider this to be a good idea.
------------------------------
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 9273
***************************************