[31292] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2537 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 5 18:09:41 2009

Date: Wed, 5 Aug 2009 15:09: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           Wed, 5 Aug 2009     Volume: 11 Number: 2537

Today's topics:
        Improving page layout when doing elementary CGI program <r.ted.byers@gmail.com>
    Re: Improving page layout when doing elementary CGI pro <nat.k@gm.ml>
    Re: Improving page layout when doing elementary CGI pro <ben@morrow.me.uk>
        latest mobiles <onlyarsalan4u@gmail.com>
    Re: lwp::simple and rget--can I compare <bdy120602@gmail.com>
    Re: lwp::simple and rget--can I compare <bdy120602@gmail.com>
    Re: lwp::simple and rget--can I compare <bdy120602@gmail.com>
        Passing structure from perl to C. <prathap.bgl@gmail.com>
    Re: Passing structure from perl to C. <ben@morrow.me.uk>
        Process to upload multiple files from a single <input t <edMbj@aes-intl.com>
    Re: Process to upload multiple files from a single <inp <smallpond@juno.com>
    Re: Process to upload multiple files from a single <inp <edMbj@aes-intl.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 5 Aug 2009 13:13:38 -0700 (PDT)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: Improving page layout when doing elementary CGI programming.
Message-Id: <5107f5ed-9e02-45d3-acd8-9b9f6bd74b2c@f10g2000vbf.googlegroups.com>

OK, I am using several CGI packages.  This is relatively easy and
quick.  And the pages are much much faster than similar web pages made
using JSP/JSF in NetBeans.

However, one thing I miss from when I am developing web pages using
JSP/JSF/Java servlets is that Netbeans makes it trivially easy to
place controls anywhere on the web page.

No, I am not looking for a perl development environment that will
duplicate Netbeans!  What I am looking for is an easy way to do things
like place that login button in the top right corner, a quarter inch
from the top and a quarter inch from the side, regardless of the
geometry of the users' screens, or place this chart in the middle of
the screen with a client side image map that displays the correct info
when the mouse is over the chart; and to do these things writing perl
code.

Therefore, my question is, "Is there a package related to the CGI
package, or complimentary to it, that makes it easy to handle page
layout for the web pages produced?"

I am using Activestate Perl 5.10 on both Windows XP and Windows Server
2003, if that matters.


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

Date: Wed, 05 Aug 2009 13:59:05 -0700
From: Nathan Keel <nat.k@gm.ml>
Subject: Re: Improving page layout when doing elementary CGI programming.
Message-Id: <uomem.86040$rg4.83593@newsfe02.iad>

Ted Byers wrote:

> K, I am using several CGI packages.  This is relatively easy and
> quick.  And the pages are much much faster than similar web pages made
> using JSP/JSF in NetBeans.
> 

I don't know about all of the CGI/Perl modules out there, but you might
want to browse over CPAN or try and search for something with the
appropriate key words or phrase using your favorite search engine.  The
only thing that comes to mind, is something like HTML::Template, but
I've never used it myself.  I know things like mod_perl w/ Mason and
templates some years ago that I had worked with allow you to just use
placeholder type of tags or just use a different syntax that embeds the
code in the page.  I've not used JSP much at all, so I can't say if
that's really even what you are looking for.  I've never had an issue
with just creating my own template system w/ placeholders in the actual
HTML pages it processes, so I've never felt the need to do anything
else (it's easy enough in my view).


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

Date: Wed, 5 Aug 2009 21:59:21 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Improving page layout when doing elementary CGI programming.
Message-Id: <9e8pk6-hko2.ln1@osiris.mauzo.dyndns.org>


Quoth Ted Byers <r.ted.byers@gmail.com>:
> OK, I am using several CGI packages.  This is relatively easy and
> quick.  And the pages are much much faster than similar web pages made
> using JSP/JSF in NetBeans.
> 
> However, one thing I miss from when I am developing web pages using
> JSP/JSF/Java servlets is that Netbeans makes it trivially easy to
> place controls anywhere on the web page.
> 
> No, I am not looking for a perl development environment that will
> duplicate Netbeans!  What I am looking for is an easy way to do things
> like place that login button in the top right corner, a quarter inch
> from the top and a quarter inch from the side, regardless of the
> geometry of the users' screens, or place this chart in the middle of
> the screen with a client side image map that displays the correct info
> when the mouse is over the chart; and to do these things writing perl
> code.
> 
> Therefore, my question is, "Is there a package related to the CGI
> package, or complimentary to it, that makes it easy to handle page
> layout for the web pages produced?"

Not that I know of, or at any rate not in the way you want. This isn't
really how HTML works: presumably NetBeans either has some standard
template it uses to position things, or it produces extremely nasty
HTML. In any case, the usual way of handling HTML layout in Perl
applications is through templates: you take the time required to create
a layout, and make it portable between browsers, and then you fill in
the layout with your actual content.

There are lots of modules you can use for templating. I would start with
Template::Simple, which is probably enough for any sort of
straightforward project. If you need more power (and think *really* hard
before you decide you do: pushing too much logic down into the template
is nearly always a bad idea) then the Template module (and associated
plugins) will do almost anything you need.

As for where you get your templates from, there's really no good reason
you can't design them in NetBeans. Just take the HTML NetBeans gives you
and (assuming you can decipher it) insert the appropriate template
markers.

Ben



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

Date: Wed, 5 Aug 2009 03:23:49 -0700 (PDT)
From: arsalan <onlyarsalan4u@gmail.com>
Subject: latest mobiles
Message-Id: <c0bc67d1-a715-454f-b5cd-9926a5846ab3@l35g2000pra.googlegroups.com>

http://arsalannewmobilephone.blogspot.com

General* GSM 900 / 1800 / 1900* 95 x 46 x 17.5 mm* 95 gDisplay* TFT,
256K colors* 240 x 320 pixels* 2.0 inche* Touch-sensitive navigation
keys with backlights* Downloadable wallpapersFeatures* Bluetooth v1.2*
EDGE Class 10, 236.8 kbps* 2 MP Camera with Autofocus, 1600 x 1200 px,
Flash* Java MIDP 2.0* MP3/AAC++/3GP/MPEG4 player* FM Radio* USB
ConnectivityBattery* Stand-by time up to 200 h* Talk time up to 2 h
30 ...

For more Details......
http://arsalannewmobilephone.blogspot.com


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

Date: Wed, 5 Aug 2009 11:13:13 -0700 (PDT)
From: bdy <bdy120602@gmail.com>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <ce170423-b11e-4355-aca5-d29e263653e7@a26g2000yqn.googlegroups.com>

On Jul 30, 10:55=A0am, Tad J McClellan <ta...@seesig.invalid> wrote:
> bdy <bdy120...@gmail.com> wrote:
> > On Jul 29, 9:46=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> >> bdy <bdy120...@gmail.com> wrote:
> >> > I would like to print out the differences between the two variables
> >> > instead of just printing the varialbe again after it determines
> >> > someithing was added; I just want to print what was added. Any ideas=
?
>
> >> > #!/usr/bin/perl
>
> >> > use LWP::Simple;
>
> >> > $| =3D 1;
>
> >> Why do you think that you need to enable auto-flushing?
>
> >> > while (1) {
>
> >> Where do you expect to exit this loop?
>
> >> > $firstcopy =3D $_;
>
> >> What, exactly, are you expecting the value of $firstcopy to be here?
>
> >> > print ('', '', $_);
>
> >> Why have you supplied those particular first two arguments to print()?
>
> >> --
> >> Tad McClellan
> >> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> It is bad manners to quote .sigs.
>
> Have you seen thePostingGuidelinesthat are posted here frequently?
>
> > Will answers to any of your questions help you answer this question:
>
> > Can I print the difference between two variables?
>
> Yes. That is why I asked them.
>
> Your code never puts anything into $_ before it copies it to
> $firstcopy, so you might as well have
>
> =A0 =A0$firstcopy =3D undef;
> instead of
> =A0 =A0$firstcopy =3D $_;
>
> You should always enable warnings when developing Perl code.
>
> > In this case, the difference between $_ =3Dget("http://www.google.com")
> > and
>
> If the get() succeeds then $_ will not contain undef, and will
> probably also not contain the empty string, so
>
> =A0 =A0 $firstcopy ne $_
>
> will be true every single time.
>
> The code you posted made no sense at all.
>
> My questions were an attempt to draw some sense from it.
>
> If you post a short and complete program *that we can run*, then
> we can surely help you solve your problem. If you don't, then
> we probably can't.
>
> Have you seen thePostingGuidelinesthat are posted here frequently?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"- Hid=
e quoted text -
>
> - Show quoted text -

>If you post a short and complete program *that we can run*, then
we can surely help you solve your problem. If you don't, then
we probably can't.

OK, so my problem is that I don't have a run-able program; so I may be
better off explaining what I'd like to do and what I've constructed
thus far:

I would like to assign a variable the content of a URL via "get,";
have Perl commit that to memory; then wait for a determined amount of
time; get via "get" the content of the same URL as the one committed
to memory earlier, and then compare the old, memory-committed version
of the URL to the recently retrieved content.

What I have so far is a program commits the two instances of the
retrieved URL and compares them, but I can only print out the second
instance if they are different, not the difference itself.

I've also used File::Compare, but that doesn't yield any results;
perhaps I'm using it wrong; I'm running it from a command prompt on
Windows XP; the following is the program:

#!/usr/bin/perl


use LWP::Simple;
use File::Compare;


$| =3D 1;


$firstcopy =3D get("http://www.google.com");
sleep 10;
$secondcopy =3D get("http://www.google.com");


if ($firstcopy ne $secondcopy) {
print ('There has been a content change');



}





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

Date: Wed, 5 Aug 2009 11:14:50 -0700 (PDT)
From: bdy <bdy120602@gmail.com>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <b5f3b1da-647f-4c08-8742-37292383dedb@b14g2000yqd.googlegroups.com>

On Jul 30, 10:55=A0am, Tad J McClellan <ta...@seesig.invalid> wrote:
> bdy <bdy120...@gmail.com> wrote:
> > On Jul 29, 9:46=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> >> bdy <bdy120...@gmail.com> wrote:
> >> > I would like to print out the differences between the two variables
> >> > instead of just printing the varialbe again after it determines
> >> > someithing was added; I just want to print what was added. Any ideas=
?
>
> >> > #!/usr/bin/perl
>
> >> > use LWP::Simple;
>
> >> > $| =3D 1;
>
> >> Why do you think that you need to enable auto-flushing?
>
> >> > while (1) {
>
> >> Where do you expect to exit this loop?
>
> >> > $firstcopy =3D $_;
>
> >> What, exactly, are you expecting the value of $firstcopy to be here?
>
> >> > print ('', '', $_);
>
> >> Why have you supplied those particular first two arguments to print()?
>
> >> --
> >> Tad McClellan
> >> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> It is bad manners to quote .sigs.
>
> Have you seen the Posting Guidelines that are posted here frequently?
>
> > Will answers to any of your questions help you answer this question:
>
> > Can I print the difference between two variables?
>
> Yes. That is why I asked them.
>
> Your code never puts anything into $_ before it copies it to
> $firstcopy, so you might as well have
>
> =A0 =A0$firstcopy =3D undef;
> instead of
> =A0 =A0$firstcopy =3D $_;
>
> You should always enable warnings when developing Perl code.
>
> > In this case, the difference between $_ =3Dget("http://www.google.com")
> > and
>
> If the get() succeeds then $_ will not contain undef, and will
> probably also not contain the empty string, so
>
> =A0 =A0 $firstcopy ne $_
>
> will be true every single time.
>
> The code you posted made no sense at all.
>
> My questions were an attempt to draw some sense from it.
>
> If you post a short and complete program *that we can run*, then
> we can surely help you solve your problem. If you don't, then
> we probably can't.
>
> Have you seen the Posting Guidelines that are posted here frequently?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"- Hid=
e quoted text -
>
> - Show quoted text -

> If you post a short and complete program *that we can run*, then
> we can surely help you solve your problem. If you don't, then
> we probably can't.

OK, so my problem is that I don't have a run-able program; so I may
be
better off explaining what I'd like to do and what I've constructed
thus far:


I would like to assign a variable the content of a URL via "get,";
have Perl commit that to memory; then wait for a determined amount of
time; get via "get" the content of the same URL as the one committed
to memory earlier, and then compare the old, memory-committed version
of the URL to the recently retrieved content.


What I have so far is a program commits the two instances of the
retrieved URL and compares them, but I can only print out the second
instance if they are different, not the difference itself.


I've also used File::Compare, but that doesn't yield any results;
perhaps I'm using it wrong; I'm running it from a command prompt on
Windows XP; the following is the program:


#!/usr/bin/perl


use LWP::Simple;
use File::Compare;


$| =3D 1;


$firstcopy =3D get("http://www.google.com");
sleep 10;
$secondcopy =3D get("http://www.google.com");


if ($firstcopy ne $secondcopy) {
print ('There has been a content change');

}


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

Date: Wed, 5 Aug 2009 11:20:25 -0700 (PDT)
From: bdy <bdy120602@gmail.com>
Subject: Re: lwp::simple and rget--can I compare
Message-Id: <b7db963a-10d1-488d-8d8b-74afbbb9b432@b14g2000yqd.googlegroups.com>

On Jul 30, 10:55=A0am, Tad J McClellan <ta...@seesig.invalid> wrote:
> bdy <bdy120...@gmail.com> wrote:
> > On Jul 29, 9:46=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> >> bdy <bdy120...@gmail.com> wrote:
> >> > I would like to print out the differences between the two variables
> >> > instead of just printing the varialbe again after it determines
> >> > someithing was added; I just want to print what was added. Any ideas=
?
>
> >> > #!/usr/bin/perl
>
> >> > use LWP::Simple;
>
> >> > $| =3D 1;
>
> >> Why do you think that you need to enable auto-flushing?
>
> >> > while (1) {
>
> >> Where do you expect to exit this loop?
>
> >> > $firstcopy =3D $_;
>
> >> What, exactly, are you expecting the value of $firstcopy to be here?
>
> >> > print ('', '', $_);
>
> >> Why have you supplied those particular first two arguments to print()?
>
> >> --
> >> Tad McClellan
> >> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> It is bad manners to quote .sigs.
>
> Have you seen the Posting Guidelines that are posted here frequently?
>
> > Will answers to any of your questions help you answer this question:
>
> > Can I print the difference between two variables?
>
> Yes. That is why I asked them.
>
> Your code never puts anything into $_ before it copies it to
> $firstcopy, so you might as well have
>
> =A0 =A0$firstcopy =3D undef;
> instead of
> =A0 =A0$firstcopy =3D $_;
>
> You should always enable warnings when developing Perl code.
>
> > In this case, the difference between $_ =3Dget("http://www.google.com")
> > and
>
> If the get() succeeds then $_ will not contain undef, and will
> probably also not contain the empty string, so
>
> =A0 =A0 $firstcopy ne $_
>
> will be true every single time.
>
> The code you posted made no sense at all.
>
> My questions were an attempt to draw some sense from it.
>
> If you post a short and complete program *that we can run*, then
> we can surely help you solve your problem. If you don't, then
> we probably can't.
>
> Have you seen the Posting Guidelines that are posted here frequently?
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"- Hid=
e quoted text -
>
> - Show quoted text -

> If you post a short and complete program *that we can run*, then
> we can surely help you solve your problem. If you don't, then
> we probably can't.

OK, so here's my code; I was able to run it on Windows XP from the
command prompt, call the .pl file:


#!/usr/bin/perl


use LWP::Simple;
use File::Compare;


$| =3D 1;


$firstcopy =3D get("http://www.google.com");
sleep 10;
$secondcopy =3D get("http://www.google.com");


if ($firstcopy ne $secondcopy) {
print ('There has been a content change');



}

It correctly recognizes a difference, if one exists; but I don't know
how to print that difference. I tried File:Compare as well; no
success; I didn't see any feature that would allow me to print the
difference between the two variables.


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

Date: Wed, 5 Aug 2009 04:01:51 -0700 (PDT)
From: Prathap <prathap.bgl@gmail.com>
Subject: Passing structure from perl to C.
Message-Id: <f44004d8-bae3-4592-a3d1-f068ef5bdeae@a37g2000prf.googlegroups.com>

Hi:

  I'm writing an application that requires perl to pass some data to C
function as a structure.
  I have this structure in C:
  struct test
   {
     int t1;
     int t2;
  }

  The C function addStruct will add the contents of fields t1 and t2
and will return the result.
  The C function addStruct takes pointer to structure as an input.

   How do I make perl pass the data as pointer to structure kind of
variable?
   I was trying with declaring a similar hash variable and passing the
hash referance to C function,
   but it does not work.

   I'm using perlxstut mechanism to get perl interact with C.

   Please guide me to get this working.

Regards,
Prathap


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

Date: Wed, 5 Aug 2009 17:09:53 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Passing structure from perl to C.
Message-Id: <hfnok6-b8n2.ln1@osiris.mauzo.dyndns.org>


Quoth Prathap <prathap.bgl@gmail.com>:
> 
>   I'm writing an application that requires perl to pass some data to C
> function as a structure.
>   I have this structure in C:
>   struct test
>    {
>      int t1;
>      int t2;
>   }
> 
>   The C function addStruct will add the contents of fields t1 and t2
> and will return the result.
>   The C function addStruct takes pointer to structure as an input.
> 
>    How do I make perl pass the data as pointer to structure kind of
> variable?
>    I was trying with declaring a similar hash variable and passing the
> hash referance to C function,
>    but it does not work.
> 
>    I'm using perlxstut mechanism to get perl interact with C.

So, what have you tried?

Ben



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

Date: Wed, 05 Aug 2009 12:23:48 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Process to upload multiple files from a single <input type=file>
Message-Id: <2nmj759un2j3jf49k3g9jbeqv16dg5134e@4ax.com>

I have a form that allows multiple files to be selected using a single
input element, e.g., <input type='file' min='1' max='999'>, and a Perl CGI
script to upload the files to my server. Unlike multiple single-file
uploads, the file that uploads is a concatenation of the individual files.

My questions is: How do I process the form information passed to the Perl
script such that I can recover the individual files and their respective
filenames?

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

Date: Wed, 05 Aug 2009 16:38:01 -0400
From: Steve C <smallpond@juno.com>
Subject: Re: Process to upload multiple files from a single <input type=file>
Message-Id: <h5cr2d$mfj$1@news.eternal-september.org>

Ed Jay wrote:
> I have a form that allows multiple files to be selected using a single
> input element, e.g., <input type='file' min='1' max='999'>, and a Perl CGI
> script to upload the files to my server. Unlike multiple single-file
> uploads, the file that uploads is a concatenation of the individual files.
> 
> My questions is: How do I process the form information passed to the Perl
> script such that I can recover the individual files and their respective
> filenames?
> 

The docs claim that you will get upload data as a multipart mime type,
just like email attachments, where the data for each file is separated
by a mime header which includes the file path.

If that's what you are getting, then the MIME::Parser module might be a
good place to start.


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

Date: Wed, 05 Aug 2009 14:03:41 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Process to upload multiple files from a single <input type=file>
Message-Id: <5tsj75dad7rc45rhfql68tsjalf5kac1c3@4ax.com>

Steve C wrote:

>Ed Jay wrote:
>> I have a form that allows multiple files to be selected using a single
>> input element, e.g., <input type='file' min='1' max='999'>, and a Perl CGI
>> script to upload the files to my server. Unlike multiple single-file
>> uploads, the file that uploads is a concatenation of the individual files.
>> 
>> My questions is: How do I process the form information passed to the Perl
>> script such that I can recover the individual files and their respective
>> filenames?
>> 
>
>The docs claim that you will get upload data as a multipart mime type,
>just like email attachments, where the data for each file is separated
>by a mime header which includes the file path.
>
>If that's what you are getting, then the MIME::Parser module might be a
>good place to start.

Thanks!

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


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

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 V11 Issue 2537
***************************************


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