[25812] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8051 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 5 00:05:34 2005

Date: Wed, 4 May 2005 21: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           Wed, 4 May 2005     Volume: 10 Number: 8051

Today's topics:
    Re: a numbering question <geoff.cox@notquitecorrectfreeuk.com>
    Re: a numbering question <geoff.cox@notquitecorrectfreeuk.com>
    Re: a numbering question <geoff.cox@notquitecorrectfreeuk.com>
        Different POST encoding format <djb@global.net.mt>
    Re: Filling the Perl Stack <tassilo.von.parseval@rwth-aachen.de>
    Re: How do I parse certain "bits" out of bytes? <mikeh@perusion.net>
    Re: How do I parse certain "bits" out of bytes? <djames@thehub.com.au>
        How to parse .... <gis86508@cissol1.cis.nctu.edu.tw>
    Re: How to parse .... <tadmc@augustmail.com>
    Re: How to parse .... <matternc@comcast.net>
        How to parse with regular expression... <gis86508@cissol1.cis.nctu.edu.tw>
    Re: start_table problem axel@white-eagle.co.uk
    Re: start_table problem axel@white-eagle.co.uk
    Re: start_table problem <matternc@comcast.net>
        Using pod2html for all modules? <jsmith@nowhere.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 04 May 2005 22:16:59 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: a numbering question
Message-Id: <4bii71lq32vtauifrdtsucq4j6q0t9l7qn@4ax.com>

On Wed, 04 May 2005 13:17:38 GMT, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:

Jue,

Thanks for your suggestion below - it made me realise my silly mistake
- I had an initial value of 1 for $number ! When I changed to 0001 all
is well.

Thanks

Geoff

>Geoff Cox wrote:
>> I have some images named as
>> pic001.gif through pic010.gif to pic200.gif
>> I am not clear how I can use something like
>> pic$number++
>
>Does it have to be a separate "pic" and $number or would it be possible to 
>increment the file name as a whole?
>
>my $name = "pic001";
>for (0..20) {
>    print $name++ . ".gif\n";
>}
>
>jue 
>



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

Date: Wed, 04 May 2005 22:18:15 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: a numbering question
Message-Id: <0gii719hk5tes7dtdkhi33tqbk3crna1us@4ax.com>

On Wed, 4 May 2005 11:48:27 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:

>   my $filename = sprint 'pic%03d.gif', $number++;  # untested

Thanks Tad - will give it a try.

Cheers

Geoff



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

Date: Wed, 04 May 2005 22:18:58 GMT
From: Geoff Cox <geoff.cox@notquitecorrectfreeuk.com>
Subject: Re: a numbering question
Message-Id: <2hii71hjb4gmttdcr0sfceb0ts3d3vt9n1@4ax.com>

On 04 May 2005 19:59:15 GMT, Abigail <abigail@abigail.nl> wrote:

>Geoff Cox (geoff.cox@notquitecorrectfreeuk.com) wrote on MMMMCCLXIV
>September MCMXCIII in <URL:news:d8ih715j12ahn6foloap88jqhsrv1uljtu@4ax.com>:
>))  Hello,
>))  
>))  I have some images named as
>))  
>))  pic001.gif through pic010.gif to pic200.gif
>))  
>))  I am not clear how I can use something like
>))  
>))  pic$number++
>))  
>))  any pointers please!
>
>
>$ perl -wle '$f = "pic001"; print + $f ++ . ".gif" for 1 .. 10'

Thanks - will try this out..

Cheers

Geoff

>pic001.gif
>pic002.gif
>pic003.gif
>pic004.gif
>pic005.gif
>pic006.gif
>pic007.gif
>pic008.gif
>pic009.gif
>pic010.gif
>
>
>Abigail



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

Date: Thu, 5 May 2005 04:16:49 +0200
From: "David Joseph Bonnici" <djb@global.net.mt>
Subject: Different POST encoding format
Message-Id: <d5bvmk$j0d$1@domitilla.aioe.org>

Hi I was experimenting with perl, on the POST method. I am using 
LWP::UserAgent

    $response = $browser->post( $url,
    [ 'first name' => 'John',
      'last name' => 'Doe',
      'lastandfirst' => 'John Doe',
    ]  );

If I post, the data is sent something like this
"&first+name=John&last+name=Doe&lastandfirst=John+Doe"

I would like the post to be something enocoded like so (dont ask me why!)
&first%20name=John&last%20name=Doe&lastandfirst=John&20Doe

How do I do it (or what parameter do I need to modify).

This is sending me crazy.

David 




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

Date: Thu, 5 May 2005 01:21:30 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Filling the Perl Stack
Message-Id: <slrnd7im7q.1ib.tassilo.von.parseval@localhost.localdomain>

Also sprach Guenther Sohler:

> I supposed, that the complete c function calling the perl xsub is not
> interesting, because all the rest works. just putting a list
> of "coorindates" onto the perl stack does not seem to work.
> I dont use the xsubpp compiler. I have everything integrated into my c
> program(and it works for everything else)
>
> However I will paste all my function now:
>
>
>
> int perl_call(char *func,GsList<PCellParam> &pars)
> {
>         int i,ret;
>         dSP;
>         ENTER;
>         SAVETMPS;
>         PUSHMARK(SP);
>         for(i=0;i<pars.len();i++)
>         {
>                 switch(pars[i].type)
>                 {
>                         case PCELL_PAR_POINTS:
>                                 {
>                                         int j;
>                                         AV *points=newAV();
>                                         for(j=0;j<pars[i].points.len();j++)
>                                         {
>                                                 AV *point=newAV();
>                                                 av_push(point,newSVnv(pars[i].points[j].x*l.unit_db));
>                                                 av_push(point,newSVnv(pars[i].points[j].y*l.unit_db));
>                                                 av_push(points,newSVrv((SV *) point,NULL));
>                                         }
>                                         XPUSHs(sv_2mortal(newSVrv((SV *) points,NULL)));

Sorry, I am an idiot. I should have seen the error already in your first
posting. For putting a reference to something into the array, you have
to use newRV_(inc|noinc). For your case:

    {
	...
	av_push(points, newRV_noinc((SV*)point));
    }
    XPUSHs(sv_2mortal(newRV_noinc(SV*)points));

If you read perlapi's entry on newSVrv() a couple of times, you'll
notice that its return value is a new SV that its first argument will
be made a reference to. I can't remember ever having had a use for it
anywhere in my code.

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);


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

Date: Wed, 04 May 2005 22:42:29 -0000
From: Mike Heins <mikeh@perusion.net>
Subject: Re: How do I parse certain "bits" out of bytes?
Message-Id: <slrnd7ijul.cpq.mikeh@bill.heins.net>

On 2005-05-04, Adam Schneider <schneiderNOSPAM@N0SPAM.pobox.com> wrote:
> I have read all the documentation on "pack," "unpack," "vec," bitwise
> operators, and everything else, and I still have no idea how to extract
> a few bits out of a longer string of bytes.  The help files all seem to
> have been written with the assumption that I majored in computer
> science and learned how to program years ago in some pre-Perl language
> -- which I did not.

I didn't either, but I had to do some basic logic theory work before
I was anything approaching being a programmer. If you need to do
something like that, either buckle down and learn or hire someone.

You stated what you need to do, which means you know the problem.
Now all you have to do is figure out how to do it.

Here is a way that doesn't rely on the somewhat impenetrable
unpack() function:

	my $value = 0x65;
	my $binstring = sprintf '%b', $value;
	$binstring = '0' . $binstring while length($binstring) < 8;

	my $bin1 = '0b' . substr $binstring, 0, 5;
	my $bin2 = '0b' . substr $binstring, 5, 3;
	
	print "Two binary numbers are: $bin1, $bin2\n";

	print "First part is " . oct($bin1) . " in decimal\n";
	print "Second part is " . oct($bin2) . " in decimal\n";

Obviously using unpack() will be the same thing, but here you
might see just what unpack is doing.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/

Be patient. God isn't finished with me yet.  -- unknown


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

Date: Wed, 04 May 2005 23:45:37 GMT
From: Damian James <djames@thehub.com.au>
Subject: Re: How do I parse certain "bits" out of bytes?
Message-Id: <slrnd7inh9.2hi.djames@puli.local>

On Wed, 04 May 2005 10:45:10 -0700, Adam Schneider said:
> ...
> The people in this newsgroup are acting as if I were attacking them
> personally; my minor complaint is with the documentation, which makes
> the assumption that the reader is already familiar with a lot of
> technical programming terms, and furthermore has learned other
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> languages before perl.  (There is indeed good "beginner's"
> documentation for perl, but it never really gets into binary data;
> neither "Learning Perl" nor the "Perl Cookbook" were able to help.)

That's the issue, really. When you talk about binary manipulating
binary numbers, you are talking about binary arithmetic. Shifting bits,
bitwise AND and OR are fundamental operations, like addition or division.

So when you start using perl to manipulate binary data, knowing what it is
that you want to do with the data is not in the domain of the specific
programming language you are using. It is not the province of the perl
documentation to teach you how to do that, any more that you should expect
the perl documentation to teach you about addition and division.

Many of the folks here have made suggestions in keeping with knowing this.
None of the regulars here are people who would intend, in their responses,
merely to insult you. Most folks here would insist that you know something
about your problem domain before attempting to write a program that addresses
it, though. 

Hope this makes sense to you.

-damian


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

Date: Thu, 5 May 2005 01:36:42 +0000 (UTC)
From: stratus <gis86508@cissol1.cis.nctu.edu.tw>
Subject: How to parse ....
Message-Id: <d5btba$2h41$1@news.cis.nctu.edu.tw>

I have a command like the following in multiple line with "\" operator:
                -begin [yyy[xxx{xx}x]zz] -through [xxxxx \
                xxxxxx\
                xxxxx \
                ] -end [xxxxx [yy zz] {ww} \
                        xxxxx\
                        ]

        And I want to add some contents before and after the bracket [] if
        has the keyword "begin" "end"

	Hence, the results should look like
	 -begin +++++[yyy[xxx{xx}x]zz]+++++ -through [xxxxx \
                xxxxxx\
                xxxxx \
                ] -end +++[xxxxx [yy zz] {ww} \
                        xxxxx\
                        ]+++


	How to do this with the regular expression...
	Thanks !!!




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

Date: Wed, 4 May 2005 21:48:15 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to parse ....
Message-Id: <slrnd7j2bf.9br.tadmc@magna.augustmail.com>

stratus <gis86508@cissol1.cis.nctu.edu.tw> wrote:

> I have a command like the following in multiple line with "\" operator:


Please stop posting the same thing multiple times!


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 04 May 2005 23:39:34 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: How to parse ....
Message-Id: <3o-dnacW7LLrCOTfRVn-sA@comcast.com>

stratus wrote:

<snip>

I have this strangest feeling of deja vu...

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Thu, 5 May 2005 01:38:45 +0000 (UTC)
From: stratus <gis86508@cissol1.cis.nctu.edu.tw>
Subject: How to parse with regular expression...
Message-Id: <d5btf5$2h9l$1@news.cis.nctu.edu.tw>

I have a command like the following in multiple line with "\" operator:
                -begin [yyy[xxx{xx}x]zz] -through [xxxxx \
                xxxxxx\
                xxxxx \
                ] -end [xxxxx [yy zz] {ww} \
                        xxxxx\
                        ]

        And I want to add some contents before and after the bracket [] if
        has the keyword "begin" "end"

        Hence, the results should look like
         -begin +++++[yyy[xxx{xx}x]zz]+++++ -through [xxxxx \
              xxxxxx\
                xxxxx \
                ] -end +++[xxxxx [yy zz] {ww} \
                        xxxxx\
                        ]+++


        How to do this with the regular expression...
        Thanks !!!



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

Date: Thu, 05 May 2005 01:02:57 GMT
From: axel@white-eagle.co.uk
Subject: Re: start_table problem
Message-Id: <5heee.30519$qK3.27854@fe1.news.blueyonder.co.uk>

A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> Please STOP abusing this newsgroup.
 
> Please consider physically relocating to another planet, or maybe, at least 
> take up C programming. I hear the folks in comp.lang.c are much, much 
> friendlier.
 
> Besides, C is fast, lightning fast.

For someone who cannot even work out table names for himself, I think
your advice might be wasted. 

Maybe Algol 60 would be more approriate.

Axel




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

Date: Thu, 05 May 2005 01:10:26 GMT
From: axel@white-eagle.co.uk
Subject: Re: start_table problem
Message-Id: <6oeee.30569$qK3.16019@fe1.news.blueyonder.co.uk>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Anno Siegel wrote:
>> Gunnar Hjalmarsson  <noreply@gunnar.cc> wrote in comp.lang.perl.misc:
>>> Mark Clements wrote:
>>>> I may have to abandon reading this newsgroup: there is little point
>>>> in killfiling you because you generate so much traffic
>>>
>>> And *that* is not Nikos' fault, is it?
>> 
>> It is an immediate consequence of his behavior.
> 
> True, of course, but...  Don't we who respond have an option? Are we 
> just helpless victims of the circumstances?

An interesting philosophical question. Nikos claims to be Greek, but I
suspect he has not read many Socratic dialogues. Ah well, people can
always learn, I Hope.


Axel



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

Date: Wed, 04 May 2005 23:38:45 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: start_table problem
Message-Id: <3o-dnaQW7LLbCOTfRVn-sA@comcast.com>

axel@white-eagle.co.uk wrote:

> 
> An interesting philosophical question. Nikos claims to be Greek, but I
> suspect he has not read many Socratic dialogues. Ah well, people can
> always learn, I Hope.
> 
Well, Socrates also claimed he knew nothing.  But I think that was not
quite the same thing...

-- 
             Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"


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

Date: Wed, 4 May 2005 23:03:47 +0000 (UTC)
From: John Smith <jsmith@nowhere.com>
Subject: Using pod2html for all modules?
Message-Id: <Xns964CA367053B3jsmithnowherecom@132.239.1.221>

Hi,

Does anyone know of a simple way (maybe with pod2html?) to generate cross-
regferenced HTML pages for all the perl modules on my machine?

Thanks.


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

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


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