[22617] in Perl-Users-Digest
Perl-Users Digest, Issue: 4838 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 12 21:06:08 2003
Date: Sat, 12 Apr 2003 18: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 Sat, 12 Apr 2003 Volume: 10 Number: 4838
Today's topics:
Re: Consistent ithreads limit on Win32... ? <nospam-abuse@ilyaz.org>
Re: Convert curses screen output to space-delimited tex <sean@deletethistorespond.seanoneill.deletethistorespond.info>
Re: Dynamic loading of modules <arevos@arevol.co.uk>
Re: Dynamic loading of modules <noreply@gunnar.cc>
Re: Dynamic loading of modules <goldbb2@earthlink.net>
Re: Dynamic loading of modules <me@privacy.net>
Re: Dynamic loading of modules <bob@nowhere.com>
image value (KT)
Re: image value <mbudash@sonic.net>
Re: LWP Problem with 500 (Internal Server Error) Can't <bob@nowhere.com>
memproblem again (garbage collection) <pilsl_usenet@goldfisch.at>
Re: Newline problem <Jodyman@hotmail.com>
Re: Newline problem <kasp@epatra.com>
Re: Newline problem <krahnj@acm.org>
Re: Search for text than search again based on results. <krahnj@acm.org>
Re: Search for text than search again based on results. <wksmith@optonline.net>
Setting a session cookie in Perl <anthony@nospam.safferconsulting.com>
Re: Setting a session cookie in Perl <noreply@gunnar.cc>
Re: Setting a session cookie in Perl <anthony@nospam.safferconsulting.com>
Re: Setting a session cookie in Perl <jurgenex@hotmail.com>
Re: split question <garry@ifr.zvolve.net>
Re: split question <heaney@cablespeed.com>
Stack used by regexen <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 13 Apr 2003 00:14:29 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Consistent ithreads limit on Win32... ?
Message-Id: <b7aa55$27se$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Benjamin Goldberg
<goldbb2@earthlink.net>], who wrote in article <3E9736EF.68C57206@earthlink.net>:
> > Perl REx engine is (was?) very stack hungry; if you want to use RExes,
> > you better have megabytes of stack. Even with 1M of stack (pretty low
> > - one can match circa 4000 (groups)'s in /(COMPLICATED_REX)*/) you get
> > 111M of virtual memory allocated for the stacks. In short: at some
> > moment you will run off the virtual memory.
> Well, hopefully he's designing his program so that each io thread passes
> it's data back to the main thread, and all regex matching is done there;
> this would decrease the amount of memory needed.
Irrelevant - unless he has control over the stack size. Without such
a control the size of stack of the thread depends on what "a thread
could do", not on what "the thread does".
Threads' stack allocation is one of the major bottlenecks of
stack-bound multithread interpreters; since you cannot predict what
the thread will do, you need a pretty pessimal allocation. Does not
matter much with over-committing memory architectures - until you run
out of virtual space.
[A couple of years ago I build the infrastructure for stackless REx
engine, and instrumented one (of circa 10) stack-bound brnach to use
this infrastructure. If anybody cared enough to *copy* my patch into
other 9 branches, Perl does not need lots of stack any more - AFAIR,
only the REx engine was using stack.]
Hope this helps,
Ilya
------------------------------
Date: Sat, 12 Apr 2003 19:46:04 GMT
From: Sean O'Neill <sean@deletethistorespond.seanoneill.deletethistorespond.info>
Subject: Re: Convert curses screen output to space-delimited text output ?
Message-Id: <lfqg9vs4rn6rbc36evbts7a617k71n0pip@4ax.com>
On 12 Apr 2003 11:13:46 GMT, Thomas Dickey <dickey@saltmine.radix.net>
wrote:
>Sean O'Neill <sean@deletethistorespond.seanoneill.deletethistorespond.info> wrote:
>> On 11 Apr 2003 10:47:57 GMT, Thomas Dickey <dickey@saltmine.radix.net>
>> wrote:
>
>>>Sean O'Neill <sean@deletethistorespond.seanoneill.deletethistorespond.info> wrote:
>>>> Does anyone know of a modules or combo of modules that will take
>>>> curses screen output and convert it to space-delimited text output ?
>...
>> That's what I was kinda thinkin' but what about different terminal
>> types ? Not that I'm worried about a large number of them - probably
>> just VT100, VT220, sun, xterm, and maybe a few others. I haven't dug
>> into this yet but I would assume that the curses control sequences are
>> slightly different between terminal types and the "20-or-so" sequences
>> would actually be more.
>
>perhaps. I interpreted the question as asking about relatively simple
>programs such as "top", which don't generally use curses per se, but
>termcap (no optimization). For the ANSI terminals you would have the
>same cursor-position sequence. "sun" differs from vt100/vt220/xterm
>by its treatment of line-wrapping, which would mean that you'd have to
>worry about special cases in the optimized output from curses/ncurses.
>But since you'd be constructing a picture of the screen as you went,
>it wouldn't be that hard, relatively speaking (line-wrapping is only
>a few comparisons/assignments).
>
>To handle the non-ANSI cases, you'd have to be more elaborate - would
>have to build up regular expressions dynamically from the terminal
>description rather than being able to build them up by hand. The
>ANSI sequences are easy to pick out of the data stream (an escape,
>following by one of the initial character sequence, one or more intermediate
>characters and a final), and then match (you're only looking for cursor
>movement or cursor addressing).
If anything, you're teaching me there is a lot here to be dealt with.
I did mess around with systat in FreeBSD (that's the command I
interested in "scrapping") and if the TERM variable is setup with
trash, the systat display is trashed as well. So just from that I
would assume this would be what you called a "non-ANSI case". I was
thinking I was going to have to read in terminal description from
termcap when I started my thought process on this idea.
It almost seems to make this work I would have to do the following:
- Create "virtual" display settings say 80x24 within my Perl script -
I think I've seen some Perl modules that do this.
- Make this somewhat easier by selecting a single terminal description
to work with, e.g. vt100, and alway use that in the Perl script. This
seems the easiest way considering the display output is never going to
hit a screen anyway.
- Treat the 80x24 (or whatever) virtual array as a big array with 80
rows and 24 columns. As positional control sequences are encountered,
strip them and move the "virtual cursor" to that position in the array
and update the text seen following.
That what seems logical to me.
BTW, where can I get information about what the various elements in
termcap mean, e.g. do, le, ce, md, etc ?
------------------------------
Date: Sat, 12 Apr 2003 19:57:09 +0100
From: James Reeves <arevos@arevol.co.uk>
Subject: Re: Dynamic loading of modules
Message-Id: <9uZla.1796$Aq1.54@newsfep4-winn.server.ntli.net>
Norbert Schmidt wrote:
>> use $pagename;
>> $page = $pagename::output(\%args, \%session);
>
> try "require" instead of "use".
Thanks, it works partially now, but I still can't figure out how to access a
function from the required module. $pagename::output obviously doesn't
work, so it there anyway to access the output function in the loaded up
module?
Though I suppose I could use 'eval' for this. If the module is already
compiled, then there won't be much overhead from evaluating the output
method. Am I correct in this assumption, or am I just being dumb again? :)
--
James Reeves
http://www.arevol.co.uk
------------------------------
Date: Sat, 12 Apr 2003 21:58:45 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Dynamic loading of modules
Message-Id: <b79rt5$cfjo5$1@ID-184292.news.dfncis.de>
James Reeves wrote:
> Norbert Schmidt wrote:
>>>use $pagename;
>>>$page = $pagename::output(\%args, \%session);
>>
>> try "require" instead of "use".
>
> Thanks, it works partially now, but I still can't figure out how to
> access a function from the required module. $pagename::output
> obviously doesn't work, so it there anyway to access the output
> function in the loaded up module?
Why not just do:
use Journal;
use Editor;
$page = $pagename eq 'journal' ?
Journal::output(\%args, \%session) :
Editor::output(\%args, \%session);
In the subject you are talking about "dynamic" loading of modules. Are
the modules located in one of the ordinary @INC paths, or are you
changing @INC with use lib in order to access them? If the latter is
the case, "dynamic" loading isn't a good idea at all, since you are
running the script under mod_perl.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 12 Apr 2003 16:29:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Dynamic loading of modules
Message-Id: <3E987721.D7C43C4@earthlink.net>
James Reeves wrote:
>
> So far I have some code that looks something like this:
>
> if ($pagename eq 'journal')
> {
> use Journal;
> $page = Journal::output(\%args, \%session);
> }
> elsif ($pagename eq 'editor')
> {
> use Editor;
> $page = Editor::output(\%args, \%session);
> }
> .
> .
> .
> etc.
>
> Does anyone know if it is possible to access a module with a scalar, so
> that I could replace the above with something like:
>
> use $pagename;
> $page = $pagename::output(\%args, \%session);
my $package = ucfirst $pagename;
require "$pack.pm";
no strict 'refs';
my $page = &{ $package . "::output" }( \%args, \%session );
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Sat, 12 Apr 2003 23:37:05 +0200
From: Norbert Schmidt <me@privacy.net>
Subject: Re: Dynamic loading of modules
Message-Id: <16kfrasa4cqfq$.rdbyy5rn4rwj$.dlg@40tude.net>
Hello James,
> Thanks, it works partially now, but I still can't figure out how to access a
> function from the required module. $pagename::output obviously doesn't
> work, so it there anyway to access the output function in the loaded up
> module?
this is *Perl*, we're talking about. ;-)
One way:
my $output = \&{ $pagename . "::output" };
...
&$output( );
Or, if you're bold (and/or crazy) enough, fake an import with:
*output = \&{ $pagename . "::output" };
...
output( );
Regards, Norbert
------------------------------
Date: Sat, 12 Apr 2003 17:50:28 -0500
From: bob <bob@nowhere.com>
Subject: Re: Dynamic loading of modules
Message-Id: <3e989234$1_1@127.0.0.1>
use Journal;
use Editor;
$e = new Editor;
$j = new Journal;
if ($pagename eq 'journal')
{
$r = $j;
}
elsif ($pagename eq 'editor')
{
$r = $e;
}
# etc
$page = $r->output(args);
IIRC, this is the approximatley correct OO way to do it. The businees of
constructing package names from variables isn't.
This doesn't address the dynamic loading - if that's absolutley required,
use 'require' and 'new' inside the coniditionals - though I;m not sure
that will compile, since the comiler won't have the right 'new' at that
point???
On Sat, 12 Apr 2003 08:29:01 -0500, James Reeves wrote:
> So far I have some code that looks something like this:
>
> if ($pagename eq 'journal')
> {
> use Journal;
> $page = Journal::output(\%args, \%session);
> }
> elsif ($pagename eq 'editor')
> {
> use Editor;
> $page = Editor::output(\%args, \%session);
> }
> .
> .
> .
> etc.
>
> Does anyone know if it is possible to access a module with a scalar, so
> that I could replace the above with something like:
>
> use $pagename;
> $page = $pagename::output(\%args, \%session);
>
> Any help would be greatly appreciated :) - though as far as I can tell,
> this isn't possible to do in perl. Except possibly using "eval", but
> then that loses the advantage of precompiling the code (this is a
> mod_perl handler), or wouldn't this make much difference?
>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
------------------------------
Date: 12 Apr 2003 17:07:00 -0700
From: kennedyel_5000@yahoo.com (KT)
Subject: image value
Message-Id: <6495f466.0304121607.7a029d8b@posting.google.com>
Hi all
I would like to ask how to ask a image value after users have clicked
on it and how to convert it to integer so that i can go to the
intended web site
eg. <input type ="image" name="hello" src="a">
after the users click and get the value hell0.x=10 hello.y=20
if y is larger than 50 , it will go to a.html. otherwise b.html
Can anyone please tell me how to do it pls
thx a lot
Kennedy
------------------------------
Date: Sun, 13 Apr 2003 00:21:12 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: image value
Message-Id: <mbudash-EB2BA1.17211112042003@typhoon.sonic.net>
In article <6495f466.0304121607.7a029d8b@posting.google.com>,
kennedyel_5000@yahoo.com (KT) wrote:
> Hi all
>
> I would like to ask how to ask a image value after users have clicked
> on it and how to convert it to integer so that i can go to the
> intended web site
>
> eg. <input type ="image" name="hello" src="a">
>
> after the users click and get the value hell0.x=10 hello.y=20
>
> if y is larger than 50 , it will go to a.html. otherwise b.html
>
> Can anyone please tell me how to do it pls
>
> thx a lot
>
> Kennedy
sounds like you want to use an image map... which is an html issue, not
a perl issue...
--
Michael Budash
------------------------------
Date: Sat, 12 Apr 2003 13:41:54 -0500
From: bob <bob@nowhere.com>
Subject: Re: LWP Problem with 500 (Internal Server Error) Can't read entity body
Message-Id: <3e9857f3_1@127.0.0.1>
It'd probably work better if $posturl were defined.
On Sat, 12 Apr 2003 08:31:23 -0500, Chacrint Charinthorn wrote:
> I tried to post using LWP but I got the following error:
>
> 500 (Internal Server Error) Can't read entity body: Connection reset by
> peer
>
> is it the problem with the problem I tried to post to?
>
> Below is my code:
> ---------------------------------
>
> use HTTP::Request::Common qw(POST);
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new('Poster/1.0 '); $ua->agent('Poster/1.0');
> BEGIN { $LWP::DebugFile::outpath = './tmp/' } use LWP::DebugFile ('+');
> .
> .
> .
> $count=1;
>
> while ($count <= $maxnum) {
>
> my $req = POST $posturl,
> [
> refno => $refno,
> snum => $snum,
> dservice => $dservice,
> $namediff => $strdiff,
> typemobile => $typemobile
> ];
>
> $content = $ua->request($req)->as_string;
>
> foreach (split(/\n/,$content))
> {
> $_ =~ s/\s//g; # To eliminate white spaces if ($_ eq 'Status=0') {
> print("Posted to $snum\_$refno -$count- $tmstamp\n"); $status =
> $_;
> &write_log_file;
> exit;
> }
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
------------------------------
Date: Sun, 13 Apr 2003 00:06:37 +0200
From: peter pilsl <pilsl_usenet@goldfisch.at>
Subject: memproblem again (garbage collection)
Message-Id: <3e988e01$1@e-post.inode.at>
sorry for bothering you with my memory-problems all the time, but I have an
application dealing with really big datastrutures and I get grey hairs ...
I create an object with a big structure and upon the destruction of this
object the memory should be released. Sometimes it does and sometimes it
does not. Fortunately this is reproduceable, depending on the type of the
structure.
If the structure is a large string, then the mem is released. If its a big
but empty anonymous array then its released too. If its an filled anonymous
array then it is not ! And so it is with big anonymous hash-structures.
I simply dont unterstand. No circular references, just simple structures.
Even looping through the array and undefing each entry did not release the
mem ...
thnx for the guys responding to my last two questions that gave me lot of
new insights. thnx,
peter
-------------mem.pl---------------
#!/usr/bin/perl -w
use strict;
package test;
sub new{
my $class=shift;
my $s={};
bless($s,$class);
my $way=shift;
if ($way eq '1') {
$s->{bigarray}=[];
$#{$s->{bigarray}}=5000000;
}
if ($way eq '2') {
foreach my $row (0..300000) {
$s->{ref}->[$row]=$row.'-'.'0123456789012345678901234567890123456789';
}
}
if ($way eq '3') {
foreach my $row (0..300000) {
$s->{string}.=$row.'-'.'0123456789012345678901234567890123456789';
}
}
return $s;
}
#sub DESTROY{warn "DESTROY"}
package main;
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
my $s=test->new(1); print "1\n";
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
undef $s;
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
$s=test->new(2); print "2\n";
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
undef $s;
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
$s=test->new(3); print "3\n";
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
undef $s;
print `ps waux | grep mem.pl | grep -v grep | grep -v emacs`;
-------------------------------------------------
a output would be, where mem is released after 1 and after 3 but not after
2 !! (mem is 5th col of output and name of the script is not printed here
to fit the line :)
$ ./mem.pl
pilsl 1568 0.0 0.3 2860 1308 pts/6 S 23:16 0:00
1
pilsl 1568 0.0 5.4 22396 20856 pts/6 S 23:16 0:00
pilsl 1568 37.0 0.3 2864 1328 pts/6 S 23:16 0:00
2
pilsl 1568 80.5 7.1 29040 27504 pts/6 S 23:16 0:01
pilsl 1568 77.6 6.6 26992 25456 pts/6 S 23:16 0:02
3
pilsl 1568 85.0 10.1 40656 39124 pts/6 S 23:16 0:03
pilsl 1568 85.0 6.6 26992 25460 pts/6 S 23:16 0:03
--
peter pilsl
pilsl_usenet@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Sat, 12 Apr 2003 18:22:36 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: Newline problem
Message-Id: <MPYla.22009$4P1.1927629@newsread2.prod.itd.earthlink.net>
"Kasp" <kasp@epatra.com> wrote in message:
> I have made a perl script which reads email addresses and Text Message to
be
> sent using Net::SMTP.
>
> The input file is a simple text file with "NAME<TAB>Message\n"
format...i.e
> Name and Messages are tab seperated and each record is in a newline.
> My code does $smtp->datasend("$message") but I can't figure out a way to
put
> newlines in the email.
>
> For eg, consider the message being as:
> Hello ABC,\n Nice to Meet you.\nRegards,\nXYZ.
>
> I want this to appear in email as :
> Hello ABC,
> Nice to Meet you.
> Regards,
> XYZ.
>
> But I can't get these \n converted to newlines.
> Where is the problem, scanning the data from text file or while sending
the
> email data?
> How can I solve it?
use diagnostics;
use strict;
my $message = 'This is a\nmessage for\n you.\n';
print "\$message = $message\n";
(my $dmess = $message) =~ s/\\n/\n/g;
print "\$dmess = $dmess";
This should solve your problem.
HTH,
Jodyman
------------------------------
Date: Sun, 13 Apr 2003 00:50:18 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Newline problem
Message-Id: <b79p06$iao$1@newsreader.mailgate.org>
> (my $dmess = $message) =~ s/\\n/\n/g;
Thanks for the help Jodyman, I got your $message ;-)
--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
-- Larry Wall> print "\$message = $message\n";
------------------------------
Date: Sat, 12 Apr 2003 21:08:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Newline problem
Message-Id: <3E988033.11F4D313@acm.org>
Kasp wrote:
>
> I have made a perl script which reads email addresses and Text Message to be
> sent using Net::SMTP.
>
> The input file is a simple text file with "NAME<TAB>Message\n" format...i.e
> Name and Messages are tab seperated and each record is in a newline.
> My code does $smtp->datasend("$message") but I can't figure out a way to put
> newlines in the email.
>
> For eg, consider the message being as:
> Hello ABC,\n Nice to Meet you.\nRegards,\nXYZ.
>
> I want this to appear in email as :
> Hello ABC,
> Nice to Meet you.
> Regards,
> XYZ.
>
> But I can't get these \n converted to newlines.
> Where is the problem, scanning the data from text file or while sending the
> email data?
> How can I solve it?
Instead of using a tab character as the field separator and a newline as
the record separator create your own unique field and record separators:
$/ = "<RS>\n";
while ( <DATA> ) {
my ( $name, $data ) = split /<FS>\n/;
# do something with $name and $data here
}
__DATA__
name1@sample.com<FS>
Hello ABC,
Nice to Meet you.
Regards,
XYZ.
<RS>
name2@sample.com<FS>
Hello ABC,
Nice to Meet you.
Regards,
XYZ.
<RS>
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sat, 12 Apr 2003 20:24:00 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Search for text than search again based on results.
Message-Id: <3E9875B0.D38C2DA8@acm.org>
Bill Smith wrote:
>
> Loops are not necessary at all if you are willing to read the entire
> file into a single string.
But your code doesn't "read the entire file into a single string".
> use strict;
> use warnings;
> local $/ = '';
^^
Paragraph mode.
> my $act_pat = 'MyAccount';
> my $whole_file = <DATA>;
Read the *first paragraph* into $whole_file.
> (my $desired_line) = $whole_file =~ /$act_pat.*\n(0764[^\n]*)\n/s;
> print $desired_line;
> __END__
Using
local $/;
will allow you to slurp the whole file into a scalar.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 13 Apr 2003 00:19:35 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Search for text than search again based on results.
Message-Id: <r22ma.51816$Xd1.17744283@news4.srv.hcvlny.cv.net>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3E9875B0.D38C2DA8@acm.org...
> Bill Smith wrote:
> >
> > Loops are not necessary at all if you are willing to read the entire
> > file into a single string.
>
> But your code doesn't "read the entire file into a single string".
>
>
> > use strict;
> > use warnings;
> > local $/ = '';
> ^^
> Paragraph mode.
>
You are right! That explains the reason for blank lines being
considered special.
Thanks,
Bill
------------------------------
Date: Sat, 12 Apr 2003 14:20:44 -0500
From: "Anthony Saffer" <anthony@nospam.safferconsulting.com>
Subject: Setting a session cookie in Perl
Message-Id: <3e98674a_1@nntp2.nac.net>
I recently saw a VERY simple way to set a session cookie in Perl. It was
like 1 line but I can't find it again. Can anyone give me any tips? Are
session cookies any different than regular cookies?
Anthony
------------------------------
Date: Sat, 12 Apr 2003 22:21:14 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Setting a session cookie in Perl
Message-Id: <b79t7e$cjl82$1@ID-184292.news.dfncis.de>
Anthony Saffer wrote:
> I recently saw a VERY simple way to set a session cookie in Perl.
> It was like 1 line but I can't find it again.
Where did you look?
> Can anyone give me any tips?
print "Set-cookie: $name=$value\n";
> Are session cookies any different than regular cookies?
Yes. But that question has nothing to do with Perl.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 12 Apr 2003 16:49:09 -0500
From: "Anthony Saffer" <anthony@nospam.safferconsulting.com>
Subject: Re: Setting a session cookie in Perl
Message-Id: <3e988a17_1@nntp2.nac.net>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:b79t7e$cjl82$1@ID-184292.news.dfncis.de...
> Anthony Saffer wrote:
> > I recently saw a VERY simple way to set a session cookie in Perl.
> > It was like 1 line but I can't find it again.
>
> Where did you look?
I've spent the past week searching GOOGLE.COM search results.
> > Can anyone give me any tips?
>
> print "Set-cookie: $name=$value\n";
Thank you very much. That was what I was looking or.
> > Are session cookies any different than regular cookies?
>
> Yes. But that question has nothing to do with Perl.
Well, it's IMPLEMENTATION has everything to do with Perl :-)
Thanks!
------------------------------
Date: Sat, 12 Apr 2003 21:59:44 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Setting a session cookie in Perl
Message-Id: <k%%la.8611$Zx.8158@nwrddc01.gnilink.net>
Anthony Saffer wrote:
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:b79t7e$cjl82$1@ID-184292.news.dfncis.de...
>> Anthony Saffer wrote:
>>> Can anyone give me any tips?
>>
>> print "Set-cookie: $name=$value\n";
>
>> Yes. But that question has nothing to do with Perl.
>
> Well, it's IMPLEMENTATION has everything to do with Perl :-)
Ok, then the Perl answer to your question is: Use the print() function.
Further details please the man page for print().
WHAT to print had nothing to do with your question, because you were looking
for the Perl part only and as far as Perl is concerned the text to be
printed is just some text and it could have been any other text.
As I said: As far as Perl is concerned.
jue
------------------------------
Date: Sat, 12 Apr 2003 18:39:31 -0000
From: Garry Williams <garry@ifr.zvolve.net>
Subject: Re: split question
Message-Id: <slrnb9gnb3.sb2.garry@zfw.zvolve.net>
On 12 Apr 2003 08:29:19 -0700, Bruno Skorepa <bruno@Skorepa.com> wrote:
> split question:
>
> Excel spreadsheets can be exported to textfiles, where columns are
> seperated by commas:
> for example:
>
> 364,Tools,Import Ärzte aus Kammerdatei (VPN)
>
> I split this line:
>
> ($bugid,$topic,$bug) = split /,/, $_;
>
> -----------------------------
>
> So far so good.
> If there is a comma in one of the columns, Excel puts the data within
> "..."
> for example:
>
> 370,SKF,4/3/2003,Warteliste,"termin editieren, pat wählen",,,,,,
>
> If there is a " within the data, Excel escapes that by a second one:
> for example:
>
> 377,Dorfinger,4/15/2003,WinMed,"Der Cursor bleibt beim
> Fensterverschieben ""kleben"", so daß man oft ungewollt das Fenster
> verschiebt",,,,,,
>
> can this be done with one split command?
Take a look at Text::ParseWords (in the core). Or have a look at
Text::CSV (or Text::CSV_XS) on CPAN.
--
Garry Williams
------------------------------
Date: 12 Apr 2003 14:42:52 -0400
From: "Tim Heaney" <heaney@cablespeed.com>
Subject: Re: split question
Message-Id: <87wuhzftg3.fsf@mrbun.watterson>
"Jürgen Exner" <jurgenex@hotmail.com> writes:
>
> Bruno Skorepa wrote:
> [Attempt to use split and REs to separate fields in a CSV]
> > can this be done with one split command?
>
> You may be better off using Text::CSV instead of trying to reinvent the
> wheel.
But he has eight-bit characters in his examples. According to
http://search.cpan.org/author/ALANCITT/Text-CSV-0.01/CSV.pm#CAVEATS
those are not allowed in Text::CSV. Perhaps he would have more luck
with Text::ParseWords. He would just have to get rid of the quotes
himself, as
my @fields = quotewords(',', 0, $_);
would get rid of all of the quotes, rather than putting the doubled
quotes back to singles. Something like
my @fields = quotewords(',', 1, $_);
foreach (@fields) {
s/""/"/g;
s/^"//g;
s/"$//g;
}
might be what he wants. Also, Text::ParseWords is a standard module,
rather than a CPAN module, so he should already have it.
Tim
------------------------------
Date: Sat, 12 Apr 2003 20:48:37 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Stack used by regexen
Message-Id: <3E98B3E5.D2F8B0BA@earthlink.net>
Ilya Zakharevich wrote:
[snip]
> [A couple of years ago I build the infrastructure for stackless REx
> engine,
How can you do backtracking without a stack?
Or do you merely mean, you use an explicitly allocated stack, instead of
recursion, and so you avoid using the C stack (which saves rather more
stuff than you actually need saved)?
Obviously, if all parts of a regex are non-greedy, or if you're using a
DFA, then no backtracking is needed, but I cannot see how you can have a
regex engine which support greedy matching without backtracking, nor how
you can have backtracking without a stack.
In perl6/parrot, the regex stack is explicitly allocated, and the only
things which get pushed onto it are integer indices into the string
being examined. (And "mark"s, to tell when a particular piece can't be
backtracked further... but these are merely ints with a -1 value).
> and instrumented one (of circa 10) stack-bound brnach to use
> this infrastructure. If anybody cared enough to *copy* my patch into
> other 9 branches, Perl does not need lots of stack any more - AFAIR,
> only the REx engine was using stack.]
Could you explain what you are talking about, for us unenlightened
folks?
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
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 4838
***************************************