[23125] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5346 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 12 11:05:49 2003

Date: Tue, 12 Aug 2003 08:05:07 -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           Tue, 12 Aug 2003     Volume: 10 Number: 5346

Today's topics:
        "hello world" using SWIG or inline.pm ? (thewhizkid)
    Re: "hello world" using SWIG or inline.pm ? <tassilo.parseval@rwth-aachen.de>
    Re: App distribution method? <Ed+nospam@ewildgoose.demon.co.uk@>
    Re: Brand New to Perl (Dave Cross)
        Can't see http_referrer in IE <hillmw@charter.net>
    Re: Can't see http_referrer in IE <NOSPAM@bigpond.com>
    Re: Can't see http_referrer in IE <ian@WINDOZEdigiserv.net>
        CGI::POST_MAX Question... <georgios@ulrik.uio.no>
    Re: connecting to a database (with no web server) <r_reidy@comcast.net>
        Data::Dumper How to quote keys while dumping (kamal)
    Re: Data::Dumper How to quote keys while dumping <usenet@dwall.fastmail.fm>
    Re: FTP doesn't add Carriage Return from VMS to NT? <flavell@mail.cern.ch>
    Re: help needed making unicode entities <zen13097@zen.co.uk>
        Help needed (Learner)
    Re: How to find the info from documentation quickly?? <bernie@fantasyfarm.com>
        mind.pl (Arthur T. Murray)
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 12 Aug 2003 01:20:09 -0700
From: thewhizkid@rock.com (thewhizkid)
Subject: "hello world" using SWIG or inline.pm ?
Message-Id: <31b3e6e5.0308120020.5726d297@posting.google.com>

Can somebody teach me how to mix perl code with c++ ?

That is, how can I use "inline.pm" or the SWIG package to 

write a c++ program which takes a string from perl and prints it ,
and vice-versa ?

Thanks.


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

Date: 12 Aug 2003 09:27:04 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: "hello world" using SWIG or inline.pm ?
Message-Id: <bhabt8$q2r$1@nets3.rz.RWTH-Aachen.DE>

Also sprach thewhizkid:

> Can somebody teach me how to mix perl code with c++ ?
> 
> That is, how can I use "inline.pm" or the SWIG package to 
> 
> write a c++ program which takes a string from perl and prints it ,
> and vice-versa ?

You can't use Inline for calling Perl from C++. If you want that, read
'perldoc perlembed' and 'perldoc perlcall'.

For the other direction, you have many possibilities:

Here's a couple of examples with C. C++ is only interesting if you want
to deal with C++ objects.

    #! /usr/bin/perl -w

    use Inline C;

    hello('world');

    __END__
    __C__
    void hello (SV *msg) {
        char *text = SvPV_nolen(msg);
        printf("hello, %s\n", text);
    }

The above explicitely passes a SV* (a Perl scalar) to hello() and then
retrieves the string stored inside. 'perldoc perlapi' shows the
available macros and functions provided by the Perl API.

Inline::C can also do some automatic type conversions for you:

    #! /usr/bin/perl -w

    use Inline C;

    hello('world');

    __END__
    __C__
    void hello (char *msg) {
        printf("hello, %s\n", msg);
    }

Here the transition from SV* to char* happens implicitely. This
automatism however only works for the basic C types. If you have a
library with complex types, you need to define your own conversion
routines. This is usally done in a file called 'Typemap' (they are
only sparesly documented so you might need google and some patience to
find out how they work).

Another alternative way is using pure XS. Inline::C/C++ are just
wrappers around XS. They look simpler but they aren't really. XS has the
advantage that development happens in a more standard way: You work on
the .xs file and use another console to do a 'make'. Errors are thus
appearing on your console and not dumped in files in a hidden directory
(as Inline does it).

When working with XS, you usually have the overhead of creating a real
module. But that's not really a bad thing. You start with h2xs:

    ethan@ethan:~/Projects$ h2xs -c -b 5.5.3 -n Hello::World
    Writing Hello/World/ppport.h
    Writing Hello/World/World.pm
    Writing Hello/World/World.xs
    Writing Hello/World/Makefile.PL
    Writing Hello/World/README
    Writing Hello/World/t/1.t
    Writing Hello/World/Changes
    Writing Hello/World/MANIFEST

This creates a skeletal module with all required files. The -b switch
adds a compatibility layer to your module so that the newer portions of
the PerlAPI will be made compatible with at least 5.00503 (for this
case).

After that, you add the functionality to Hello/World/World.xs. Right now
it only contains:

    #include "EXTERN.h"
    #include "perl.h"
    #include "XSUB.h"

    #include "ppport.h"


    MODULE = Hello::World		PACKAGE = Hello::World		

Adding an XS function that prints its argument as string looks like:

    void
    hello(string)
            SV *string;
        PPCODE:
            printf("hello, %s\n", SvPV_nolen(string));

You put this below the 'MODULE =' line. Now you go to the other console
and do a 'perl Makefile.PL && make':

ethan@ethan:~/Projects/Hello/World$ perl Makefile.PL && make
Checking if your kit is complete...
Looks good
Writing Makefile for Hello::World
cp World.pm blib/lib/Hello/World.pm
AutoSplitting blib/lib/Hello/World.pm (blib/lib/auto/Hello/World)
/usr/bin/perl /usr/lib/perl5/5.8.0/ExtUtils/xsubpp  -typemap
/usr/lib/perl5/5.8.0/ExtUtils/typemap  World.xs > World.xsc && mv
World.xsc World.c
Please specify prototyping behavior for World.xs (see perlxs manual)
cc -c  -I. -O3 -march=athlon -fno-strict-aliasing -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\"
-fpic "-I/usr/lib/perl5/5.8.0/i686-linux/CORE"   World.c
Running Mkbootstrap for Hello::World ()
chmod 644 World.bs
rm -f blib/arch/auto/Hello/World/World.so
LD_RUN_PATH="" cc  -shared -L/usr/local/lib World.o  -o
blib/arch/auto/Hello/World/World.so
chmod 755 blib/arch/auto/Hello/World/World.so
cp World.bs blib/arch/auto/Hello/World/World.bs
chmod 644 blib/arch/auto/Hello/World/World.bs
Manifying blib/man3/Hello::World.3

And now, you can already call your function without installing the
module:

    ethan@ethan:~/Projects/Hello/World$ perl -Mblib -MHello::World
    Hello::World::hello("world");
    __END__
    hello, world
    ethan@ethan:~/Projects/Hello/World$

If you do a 'make install' you have this module properly installed
system-wide.

Since it's a proper module, you have a file Hello/World/World.pm, too.
This is an ordinary Perl module file. If you want your function to be
exported automatically, you do it there:

    @EXPORT = qw(hello);

After doing 'make' again (whenever you change something, do a 'make'),
you call it thusly:

    ethan@ethan:~/Projects/Hello/World$ perl -Mblib -MHello::World
    hello("world");
    __END__
    hello, world
    ethan@ethan:~/Projects/Hello/World$

In the above command-lines, -Mblib tells perl to use the blib/ directory
as location of the module. blib/ holds the compiled but not yet
installed module.

XS does the same conversions as Inline::C, so the function hello() could
also be written as:

    void
    hello(string)
            char *string;
        PPCODE:
            printf("hello, %s\n", string);

Returning values from a function isn't hard either:

    char *
    hello_concat(string)
            char *string;
        PREINIT:
            char *retstring;
            int len;
        CODE:
            len = strlen(string) + 8;
            New(0, retstring, len, char);
            memcpy(retstring, "hello, ", 7);
            memcpy(retstring + 7, string, strlen(string));
            retstring[len] = 0;
            RETVAL = retstring;
        OUTPUT:
            RETVAL

Just as you can pass in Perl types and do the conversion yourself, you
can use the Perl stack explicitely to return a SV. That way, you can
return lists of values by XPUSH()ing them and then telling perl how many
values you pushed with XSRETURN(num_of_values):

    void
    hello_stack(string)
            char *string;
        PREINIT:
            SV *retval;
        PPCODE:
            retval = newSVpv("hello, ", 7);
            SvGROW(retval, strlen(string));
            sv_catpv(retval, (const char*)string);

            /* sv_2mortal() makes the SV mortal:
             * that is, it will auto-destroy itself when it goes
             * out of scope */
            XPUSHs(sv_2mortal(retval));
            XSRETURN(1);

I can't much comment on SWIG. From the XS/Inline/SWIG trio I'd say it is
the worst choice since it's not Perl specific. It may make the first
steps of wrapping a library into a Perl module easier, but you have
better control over what happens when using Inline or XS. If you ignore
the common myths that Inline is much easier than all the rest, XS is
still the best way of accessing C/C++ from Perl.

The manpages you should read are:

    perlxstut   /* a tutorial, not complete but helpful nonetheless */
    perlguts    /* explains the concepts behind the Perl internals */
    perlxs
    perlcall    /* if you call Perl code from your XS */
    perlapi
    perlapio    /* the I/O related PerlAPI */
    
Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Tue, 12 Aug 2003 14:23:04 GMT
From: "Edward Wildgoose" <Ed+nospam@ewildgoose.demon.co.uk@>
Subject: Re: App distribution method?
Message-Id: <cL6_a.2173575$mA4.301781@news.easynews.com>

> We want to deploy this application across a very large number of systems
and
> the problem is that we have Perl versions ranging back to 5.005 and up to
> 5.8.0.  Some have never been configured for CPAN and others have obsolete
> configurations.  The application will be deployed to a variety of Unixes
> (Tru64, Solaris) and Linux.

Try PAR

Latest version can even package stuff up for multiple architectures...




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

Date: 12 Aug 2003 03:16:07 -0700
From: dave@dave.org.uk (Dave Cross)
Subject: Re: Brand New to Perl
Message-Id: <9d3debce.0308120216.7a941c22@posting.google.com>

Chris Mattern <syscjm@gwu.edu> wrote in message news:<3F3127DB.4010605@gwu.edu>...
> Tassilo v. Parseval wrote:

[ about Matt Wright ]

> > Instead he even directs people to the nms-project.
> 
> No, he doesn't.  He provides a link to nms.

Actually he doesn't even do that. He has locally hosted copies of the
nms programs which he links to on his pages. Unfortunately, the
versions he has are more than a little out of date now.

Dave...


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

Date: Tue, 12 Aug 2003 12:52:14 -0500
From: "Michael Hill" <hillmw@charter.net>
Subject: Can't see http_referrer in IE
Message-Id: <vjhonqbbsarv03@corp.supernews.com>

I have a p[erl script that looks at the http_referrer for security purposes,
but when using the IE browser i can't see the http_referrer from the pgm,
i.e $env{http_referrer}. I can using mozilla.
What's up with that. On some of my pgms I need to make sure they are being
referrered by a url on my site
and not executed standalone.

Anyone familiar with this, or a workaround in IE?

Mike




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

Date: Tue, 12 Aug 2003 23:14:41 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Can't see http_referrer in IE
Message-Id: <bhap7u$vhi1i$1@ID-202028.news.uni-berlin.de>

"Michael Hill" <hillmw@charter.net> wrote in message
news:vjhonqbbsarv03@corp.supernews.com...
> I have a p[erl script that looks at the http_referrer for security
purposes,
> but when using the IE browser i can't see the http_referrer from the pgm,
> i.e $env{http_referrer}. I can using mozilla.
> What's up with that. On some of my pgms I need to make sure they are being
> referrered by a url on my site
> and not executed standalone.

It depends on your web server - try $ENV{HTTP_REFERER}.

To help you with debugging you might what to print out the entire ENV hash
to see what environment variables is sending - something like:

#!/usr/bin/perl
use strict;
$|++;
print "ContentType: text/html\n\n<html><head></head><body>";
my @thekeys=keys(%ENV);
foreach my $key (sort @thekeys)
  {print "$key = $ENV{$key}\n<br>";}
print"</body></html>";

gtoomey




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

Date: Tue, 12 Aug 2003 13:24:20 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: Can't see http_referrer in IE
Message-Id: <8hqhjvgres02ab6oruden8nvvjucgcsqfs@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Tue, 12 Aug 2003 12:52:14 -0500, "Michael
Hill" <hillmw@charter.net> amazingly managed to produce the following
with their Etch-A-Sketch:

> I have a p[erl script that looks at the http_referrer for security
> purposes, but when using the IE browser i can't see the
> http_referrer from the pgm, i.e $env{http_referrer}. I can using
> mozilla.
> What's up with that. On some of my pgms I need to make sure they
> are being referrered by a url on my site
> and not executed standalone.
> 
> Anyone familiar with this, or a workaround in IE?
> 
> Mike
> 


HTTP_REFERER _cannot_ be relied upon.

Some windoze bolt-on "firewalls" block / change this.. I coded a
small C++ app that sends a custom referrer header, and more on-topic,
with LWP::Simple, you can define the referrer header.



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzjqgWfqtj251CDhEQK28QCgsSUA2Oqyk1H9Ku7BlpJZtyjJ54EAni9z
3l3DsM+lt72/i2IsA+qmT17N
=d7Cz
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Programming, Web design, development & hosting.


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

Date: Tue, 12 Aug 2003 15:53:39 +0200
From: George Magklaras <georgios@ulrik.uio.no>
Subject: CGI::POST_MAX Question...
Message-Id: <3F38F163.10306@ulrik.uio.no>

In an attempt to control the file upload size on a PERL 5.6.1 CGI 
script, I used my own counters to set the maximum size of the file to 
around 4 MBytes. So I had my traditional while loop that looks like 
this (inside a subroutine):

sub UploadFile {

 .
 .
 .
  my $buffersize = 65_536;
  my $maxBuffers = 64;
 .
 .
 .
      while(read( $fh, $buffer, $buffersize)) {
          $cnter++;
          if ($cnter <= $maxBuffers) {
              print UPLOAD $buffer;
          } else {
              $returnData = 'uploaded file too big';
              return $returnData;
          }
 .
 .
 .
}

The subroutine works. it starts uploading the file and then when the 
file goes over 4MBytes, it drops out...Which is fine, but some people 
may have extremely low-speed connections, so it may take some time to 
discover that after waiting 10-20 minutes to upload the 4 Megs, they 
cannot continue. Hence, what I really want is to know the size of the 
file to-be-uploaded before hand.

I am wearing CGI::Corp and CGI::Safe and I read that CGI::POST_MAX can 
also be used to limit the size of the HTTP POST operation. The 
questions I have are:
1)Does this happen at the very beginning of the POST operation, or 
right after the file has already occupied 4Mbytes of RAM/Disk space. 
What I want is to prevent the operation from the very beginning if the 
file exceeds 4Megs.
2)If the answer to the previous question is 'No, it happens at the 
end.', does someone now of a reliable (aka browser independent way) to 
  'probe' the size of the file-to-be-uploaded from the very beginning?

Regards,
George Magklaras



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

Date: Tue, 12 Aug 2003 05:10:05 -0600
From: Ron Reidy <r_reidy@comcast.net>
Subject: Re: connecting to a database (with no web server)
Message-Id: <3F38CB0D.2050709@comcast.net>

Read the README files.  Follow the instructions exactly.  If you are on 
Windows using AS Perl
, install via ppm.
dominant wrote:
> I downloaded the source, as it is mentioned, oracle.pm. What can i do
> with that?
> 
> --
> Posted via http://dbforums.com


-- 
Ron Reidy
Oracle DBA



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

Date: 12 Aug 2003 05:01:23 -0700
From: kamal@india.ti.com (kamal)
Subject: Data::Dumper How to quote keys while dumping
Message-Id: <c34c425d.0308120401.49bac070@posting.google.com>

I am trying to dump a hash using Data::Dumper.
I need to quote the keys while dumping.

My progarm looks like this 

use Data::Dumper;
$Data::Dumper::Quotekeys  = 1;
$Data::Dumper::Useqq = 1;

my %tmp ;

$tmp{'1'} = "l";
$tmp{'2'} = "u";

open (STDOUT, ">");
print STDOUT Data::Dumper->Dump([\%tmp], ['*tmp']);
close STDOUT ;
---------------------------------------------------
Output 
%tmp = (
         1 => "l",
         2 => "u"
       );

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

i need it as 

%tmp = (
         '1' => "l",
         '2' => "u"
       );

Can anyone help out with this

Thanks
Kamal


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

Date: Tue, 12 Aug 2003 15:04:54 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Data::Dumper How to quote keys while dumping
Message-Id: <Xns93D570BA9DA5Cdkwwashere@216.168.3.30>

kamal <kamal@india.ti.com> wrote:

> I am trying to dump a hash using Data::Dumper.
> I need to quote the keys while dumping.
> 
> My progarm looks like this 
> 
> use Data::Dumper;
> $Data::Dumper::Quotekeys  = 1;
> $Data::Dumper::Useqq = 1;
> 
> my %tmp ;
> 
> $tmp{'1'} = "l";
> $tmp{'2'} = "u";
> 
> open (STDOUT, ">");

You should always check to see if open() succeeded:

    open (STDOUT, ">") or die "Cannot open STDOUT: $!";

Wy are you opening STDOUT, anyway?  It's already available for use 
unless you did something to it.


> print STDOUT Data::Dumper->Dump([\%tmp], ['*tmp']);

Quoting is the default.  Don't give Dump() names if that's not what 
you want.

    print STDOUT Data::Dumper->Dump([\%tmp]);

I'm lazy, so I'd write this as

    print Dumper \%tmp;


> close STDOUT ;


-- 
David Wall


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

Date: Tue, 12 Aug 2003 11:00:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: FTP doesn't add Carriage Return from VMS to NT?
Message-Id: <Pine.LNX.4.53.0308121057290.19349@lxplus088.cern.ch>

On Mon, Aug 11, Jay Emm Dee blurted out atop a fullquote:

> I hope the confusion over 012 and 015 v. 10 and 13 has been
> cleared up.

I didn't see any such confusion anywhere in what you quoted.

I'd say that whatever confusion there might have been before you
posted, could only have been made worse by your posting.

The killfile awaits.


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

Date: 12 Aug 2003 08:13:35 GMT
From: Dave Weaver <zen13097@zen.co.uk>
Subject: Re: help needed making unicode entities
Message-Id: <slrnbjhb26.bfj.zen13097@wormhole.homelinux.org>

On Mon, 11 Aug 2003 09:47:43 +0800, Dan Jacobson <jidanni@jidanni.org> wrote:
>  
>  Bad news, only the first one works:

>  echo =E7=A9=8D=E4=B8=B9=E5=B0=BC|mmencode -u -q|
>  PERLIO=:utf8 perl -wple 's/./"&#".ord($&).";"/eg'
>  &#31309;&#20025;&#23612;

>  echo =E7=A9=8D=E4=B8=B9=E5=B0=BC|mmencode -u -q|
>  perl -wple 'binmode(STDIN,":utf8");s/./"&#".ord($&).";"/eg'
>  &#231;&#169;&#141;&#228;&#184;&#185;&#229;&#176;&#188;

Don't know much about utf8 etc, but try putting the binmode in a BEGIN{}
block, so that it is done immediately and only once (rather than once per
line) :

[davew]% echo =E7=A9=8D=E4=B8=B9=E5=B0=BC|mmencode -u -q|
          perl -wple 'BEGIN{binmode(STDIN,":utf8")};s/./"&#".ord($&).";"/eg'
&#31309;&#20025;&#23612;
[davew]% perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi


-- 
Cheers,
Dave


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

Date: 12 Aug 2003 07:47:36 -0700
From: kernel_learner@yahoo.com (Learner)
Subject: Help needed
Message-Id: <42dfbbc2.0308120647.420c2fe4@posting.google.com>

I want to do this.

Traverse two directory trees (similar trees) and do a diff for the
files in those subdirectories.
I am not able to execute ls *.C using system it does not work right.
What I want to do is get a list of the files in one directory. Then
look for that same name in the other directory and do a diff between
those two..but I seem to be hopelessly lost!!

Here's a snippet of my code which works so far..but I am not able to
furhter it:

 ...
while(@SUBDIRS1)
{
	$Sub = shift(@SUBDIRS2);
   push(@Dir1,$DIRECTORY1.$Sub);

	$Sub = shift(@SUBDIRS1);
   push(@Dir2,$DIRECTORY2.$Sub);
}

#
# STEP 2. 
# Now go through each directory get a list of 
# .C .cpp .H .h files and then  do diff!
# 
while(@Dir2)
{
	$dir2 = shift(@Dir2);
	$dir1 = shift(@Dir1);
	print "******\n";
	print "$dir2 \n";
	print "$dir1 \n";
	print "******\n";

	
	system("find $dir2 -name '*.C'");
	system("find $dir1 -name '*.C' | xargs ls -l");
	
	system("find $dir2 -name '*.cpp' | xargs ls -l");
	system("find $dir1 -name '*.cpp' | xargs ls -l");

	system("find $dir2 -name '*.h' | xargs ls -l");
	system("find $dir1 -name '*.h' | xargs ls -l");

	system("find $dir2 -name '*.H' | xargs ls -l");
	system("find $dir1 -name '*.H' | xargs ls -l");
}


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

Date: Tue, 12 Aug 2003 08:27:00 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: How to find the info from documentation quickly??
Message-Id: <75nhjvcuf566bbntl6fobjdkl4mlafe40j@library.airnews.net>

Ted Zlatanov <tzz@lifelogs.com> wrote:

} On 11 Aug 2003, dhou@rohan.sdsu.edu wrote:
} 
} Simon Taylor <simon@unisolve.com.au> wrote:
} >        Actually, my question was "what is the first(,second,and
} >        third...)  thing I need to do in order to find info quickly
} >        using perldoc?".
} > 
} >        You are an experienced programmer, so you know where to
} >        locate information you need.  But I am just a newbie, how do
} >        I know I should look for File::Glob?
} 
} Read the Perl FAQs that come with Perl (perldoc -q "keyword" searches
} them; you can see the top list with "perldoc perlfaq").

Actually, it only searches the *questions*.  If you're looking for info
about a particular function or something like that, it is often an
interesting and difficult exercise to guess a term that was in the question
that includes what you're looking for...  I wonder why there's never been a
variant that searches the whole thing [overall, I get better results with
'grep <whatever> perlfaq*' than perldoc -q]

  /Bernie\

-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: 12 Aug 2003 03:48:31 -0800
From: uj797@victoria.tc.ca (Arthur T. Murray)
Subject: mind.pl
Message-Id: <3f38c5ff@news.victoria.tc.ca>
Keywords: artificial intelligence, mind.pl, open source AI, perlmind

#!/usr/bin/perl -w
#
sub security;
sub sensorium;
sub emotion;
sub think;
sub volition;
sub motorium;
while (1) {
  security();
  sensorium();
  emotion();
  think();
  volition();
  motorium();
}
sub security {
# http://mentifex.virtualentity.com/acm.html#security 
} def;
sub sensorium {
  # http://mentifex.virtualentity.com/acm.html#sensorium 
  print "Press ENTER or ESCAPE key: ";
  $_ = <STDIN>;
  exit if (/^\027/);
} def;
sub emotion {
  # http://mentifex.virtualentity.com/acm.html#emotion 
} def;
sub think {
  # http://mentifex.virtualentity.com/acm.html#think 
} def;
sub volition {
  # http://mentifex.virtualentity.com/acm.html#volition 
} def;
sub motorium {
  # http://mentifex.virtualentity.com/acm.html#motorium 
} def;
#---


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

Date: Tue, 12 Aug 2003 02:22:24 -0500
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
Message-Id: <kv6dndKgfuMtCKWiXTWJiA@august.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.4 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "Jeopardy" (because the answer comes before the question), or
        "TOFU".

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    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.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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.  

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 5346
***************************************


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