Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27013 > unrolled thread

how to call perl script from html using python

Started bymullapervez@gmail.com
First post2012-08-13 22:12 -0700
Last post2012-08-16 12:00 +0100
Articles 9 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  how to call perl script from html using python mullapervez@gmail.com - 2012-08-13 22:12 -0700
    Re: how to call perl script from html using python Simon Cropper <simoncropper@fossworkflowguides.com> - 2012-08-14 15:22 +1000
    Re: how to call perl script from html using python mullapervez@gmail.com - 2012-08-13 22:31 -0700
      Re: how to call perl script from html using python Simon Cropper <simoncropper@fossworkflowguides.com> - 2012-08-14 15:44 +1000
    Re: how to call perl script from html using python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-14 06:00 +0000
    Re: how to call perl script from html using python Pervez Mulla <mullapervez@gmail.com> - 2012-08-13 23:21 -0700
      Re: how to call perl script from html using python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-14 07:19 +0000
    Re: how to call perl script from html using python Pervez Mulla <mullapervez@gmail.com> - 2012-08-16 00:23 -0700
      Re: how to call perl script from html using python andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-16 12:00 +0100

#27013 — how to call perl script from html using python

Frommullapervez@gmail.com
Date2012-08-13 22:12 -0700
Subjecthow to call perl script from html using python
Message-ID<1df80eca-4dc2-48c6-9804-77e993931244@googlegroups.com>
Hi,

I wanna call perl script in HTML form n store that data in DB using Python.

How can i do this.......??

Please help me

Thank you
Pervez

[toc] | [next] | [standalone]


#27014

FromSimon Cropper <simoncropper@fossworkflowguides.com>
Date2012-08-14 15:22 +1000
Message-ID<mailman.3246.1344921754.4697.python-list@python.org>
In reply to#27013
On 14/08/12 15:12, mullapervez@gmail.com wrote:
> Hi,
>
> I wanna call perl script in HTML form n store that data in DB using Python.
>
> How can i do this.......??
>
> Please help me
>
> Thank you
> Pervez
>

Google you question.

Many solutions already exist on the Internet.

-- 
Cheers Simon

    Simon Cropper - Open Content Creator

    Free and Open Source Software Workflow Guides
    ------------------------------------------------------------
    Introduction               http://www.fossworkflowguides.com
    GIS Packages           http://www.fossworkflowguides.com/gis
    bash / Python    http://www.fossworkflowguides.com/scripting

[toc] | [prev] | [next] | [standalone]


#27015

Frommullapervez@gmail.com
Date2012-08-13 22:31 -0700
Message-ID<194f8d12-3c5d-422a-b5a7-98948ccbc1ae@googlegroups.com>
In reply to#27013
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, mulla...@gmail.com wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez

Hey Simon,

Thank You for your mail and time,

Yest I spent entire day for this , But I didn't get any solution for this problem .I google it but am not able to get any solution for this 

[toc] | [prev] | [next] | [standalone]


#27016

FromSimon Cropper <simoncropper@fossworkflowguides.com>
Date2012-08-14 15:44 +1000
Message-ID<mailman.3247.1344923090.4697.python-list@python.org>
In reply to#27015
On 14/08/12 15:31, mullapervez@gmail.com wrote:
> On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, mulla...@gmail.com wrote:
>> Hi,
>>
>>
>>
>> I wanna call perl script in HTML form n store that data in DB using Python.
>>
>>
>>
>> How can i do this.......??
>>
>>
>>
>> Please help me
>>
>>
>>
>> Thank you
>>
>> Pervez
>
> Hey Simon,
>
> Thank You for your mail and time,
>
> Yest I spent entire day for this , But I didn't get any solution for this problem .I google it but am not able to get any solution for this
>

Then you should outline what you have tried and what the problems you 
encountered that way people can help.

-- 
Cheers Simon

    Simon Cropper - Open Content Creator

    Free and Open Source Software Workflow Guides
    ------------------------------------------------------------
    Introduction               http://www.fossworkflowguides.com
    GIS Packages           http://www.fossworkflowguides.com/gis
    bash / Python    http://www.fossworkflowguides.com/scripting

[toc] | [prev] | [next] | [standalone]


#27017

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-14 06:00 +0000
Message-ID<5029e966$0$29867$c3e8da3$5496439d@news.astraweb.com>
In reply to#27013
On Mon, 13 Aug 2012 22:12:48 -0700, mullapervez wrote:

> Hi,
> 
> I wanna call perl script in HTML form n store that data in DB using
> Python.
> 
> How can i do this.......??
> 
> Please help me

Okay, let me give you some general advice first, then some programming 
advice

If your question looks like you have put no thought into the question, 
you will get answers that also have no thought put into them.

Try to write proper English sentences. We will make allowances for non-
native English speakers, and simple typos, but if u cnt b bothrd 2 rite 
gd we cnt b bothrd 2 answr gd ethr.


To solve your programming problem, break it up into smaller pieces:

1) write some code to get a perl script from some HTML;

2) write some more code to take a perl script and run it, collecting the 
results;

3) write some more code to take those results and put them into a 
database;

4) finally write some code to put the first three pieces together.


Do you need help on any of these? If so, please tell us:

- What is your experience with Python? Complete newbie, beginner, 
intermediate, advanced, expert, guru. Do you know any other programming 
languages?

- What you have already tried? Show us your code.

- Show us some *simple* sample data.


The more you help us, the more we can help you.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#27018

FromPervez Mulla <mullapervez@gmail.com>
Date2012-08-13 23:21 -0700
Message-ID<8138ce19-e3a6-4a69-bb07-89af0b327c56@googlegroups.com>
In reply to#27013
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez

Thank you for your advice steven,

I am beginner to this language, I have exp in JAVA and C....

I wanna call perl objects using Python . I checked in internet ,I can make use of inline function for this, But in HTML......??

Thank You  

[toc] | [prev] | [next] | [standalone]


#27027

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-14 07:19 +0000
Message-ID<5029fbfd$0$29867$c3e8da3$5496439d@news.astraweb.com>
In reply to#27018
On Mon, 13 Aug 2012 23:21:34 -0700, Pervez Mulla wrote:

> I wanna call perl objects using Python . I checked in internet ,I can
> make use of inline function for this, But in HTML......??

You need to explain more about your problem, because I don't understand 
what you want to do in detail.

For example:

1) "I have a URL to a perl script, like this:

http://example.com/somewhere/script.pl

and I want to download the script, run it, and collect the results."

Difficulty: (0 is trivial, 10 is impossible) About 2 or 3.


2) "I have a web page like this:

http://example.com/somewhere/homepage.html

Inside this web page I have a block of text that is actually Perl code. I 
want to download the HTML page, extract the Perl code, and run it."

Difficulty: (0 is trivial, 10 is impossible) Between 6 and 10, depending 
on the exact details of how the Perl code is stored.


Please explain in more detail what you want to do.

Where is the Perl code? In a script? Inside a HTML file? Mixed in with 
other text, or in a HTML element of its own?

Once you know where the Perl code lives, you can write a function to 
extract it. If you don't know where the code lives, you can't.

Once you have the Perl code, you can then run it using the subprocess 
module, and collect its results.

Once you have the results, you can store it in a database.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#27144

FromPervez Mulla <mullapervez@gmail.com>
Date2012-08-16 00:23 -0700
Message-ID<18ec5f51-ceca-4ecb-82b4-c472ea2faa22@googlegroups.com>
In reply to#27013
On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez



On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez



On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez



On Tuesday, August 14, 2012 10:42:48 AM UTC+5:30, Pervez Mulla wrote:
> Hi,
> 
> 
> 
> I wanna call perl script in HTML form n store that data in DB using Python.
> 
> 
> 
> How can i do this.......??
> 
> 
> 
> Please help me
> 
> 
> 
> Thank you
> 
> Pervez

Hey Steven ,

Thank you for your response,

I will in detail now about my project,

Actually the project entire backend in PERL language , Am using Django framework for my front end .

I have written code for signup page in python , which is working perfectly .

In HTml when user submit POST method, it calling Python code ....Instead of this I wanna call perl script for sign up ......
 
below in form for sign up page in python ....

form.py
from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from user_profile.models import Profile

class RegistrationForm(ModelForm):
    username    = forms.CharField(label=(u'User Name'))
    email       = forms.EmailField(label=(u'E-mail'))
    password    = forms.CharField(label=(u'Password'),widget=forms.PasswordInput(render_value=False))
    password1   = forms.CharField(label=(u'Verify Password'),widget=forms.PasswordInput(render_value=False))

    class Meta:
        model = Profile
        exclude = ('user',)
        
    def clean_username(self):
        username = self.cleaned_data['username']
        try:
            User.objects.get(username==username)
        except User.DoesNotExist:
            return username
        raise forms.ValidationError("That username is already taken. Please select another.")
        
    def clean_password(self):
        if self.cleaned_data['password'] != self.cleaned_data['password1']:
            raise forms.ValidationError("Password didnt match... Please try again")
        return self.cleaned_data
-----------------------------------------------------------------------------

view.py


def ProfileRegistration(request):
    if request.user.is_authenticated():
        return HttpResponseRedirect('/profile/')
    if request.method =="POST":
        form = RegistrationForm(request.POST)
        if form.is_valid():
            user = User.objects.create_user(username = form.cleaned_data['username'],
                                            email = form.cleaned_data['email'],
                                            password = form.cleaned_data['password'])
            user.save()
            profile = Profile(user=user, firstname=form.cleaned_data['firstname'],
                                         lastname=form.cleaned_data['lastname'],
                                         phone=form.cleaned_data['phone'],
                                         title=form.cleaned_data['title'],
                                         companyname=form.cleaned_data['companyname'])
            profile.save()
            return HttpResponseRedirect('/profile/')
        else:
            return render_to_response ('register.html',{'form':form},context_instance=RequestContext(request))
    else: 
        form = RegistrationForm()
        context = {'form':form}
        return render_to_response('register.html', context, context_instance=RequestContext(request))


In view instead invoking python script I wanna invoke Perl script .....for the signup page 


Thank You


   

[toc] | [prev] | [next] | [standalone]


#27153

Fromandrea crotti <andrea.crotti.0@gmail.com>
Date2012-08-16 12:00 +0100
Message-ID<mailman.3354.1345114861.4697.python-list@python.org>
In reply to#27144
2012/8/16 Pervez Mulla <mullapervez@gmail.com>:
>
> Hey Steven ,
>
> Thank you for your response,
>
> I will in detail now about my project,
>
> Actually the project entire backend in PERL language , Am using Django framework for my front end .

> I have written code for signup page in python , which is working perfectly .
>
> In HTml when user submit POST method, it calling Python code ....Instead of this I wanna call perl script for sign up ......
>
> below in form for sign up page in python ....

Good that's finally an explanation, so the question you can ask google
was "how do I call an external process from Python",
which has absolutely nothing to with HTML, and is very easy to find
out (hint: subprocess).

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web