Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Include Bootstrap Files in Perl Script?

by NetWallah (Canon)
on May 10, 2016 at 17:07 UTC ( #1162650=note: print w/replies, xml ) Need Help??

in reply to Include Bootstrap Files in Perl Script?

As stated in this stackoverflow query , you should use a CDN, instead of local copies of jquery and bootstrap.

Here is how I incorporate that in one of my perl scripts:

print <<"__HEAD__"; Content-Type: text/html <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1 +"> <!-- The above 3 meta tags *must* come first in the head; any othe +r head content must come *after* these tags --> <title>MY Program's title</title> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src=""></script> <!-- Bootstrap V 3.3 CSS --> <link rel="stylesheet" href=" +ap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhj +VME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href=" +ap/3.3.6/css/bootstrap-theme.min.css" integrity= "sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0 +En5r" crossorigin="anonymous"> <!-- Bootstrap V 3.3 JavaScript (Minified)--> <script src=" +strap.min.js" integrity= "sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9a +J7xS" crossorigin="anonymous"></script> <script src=" +rter/2.25.1/js/jquery.tablesorter.combined.min.js"> </script> <style> ... __HEAD__
If you /msg me with your email, I can share a simple perl Bootstrap module that I wrote to help make buttons, dropdowns, alerts and panels. It does not do forms.

        This is not an optical illusion, it just looks like one.

Replies are listed 'Best First'.
Re^2: Include Bootstrap Files in Perl Script?
by Your Mother (Archbishop) on May 10, 2016 at 21:28 UTC

    ++ While I also tend to use CDNs it’s important to note some things: 1) it puts you at the mercy of someone else’s outages and it’s possibly a remote network so it shouldn’t be part of anything meant to be bulletproof or things like bundled webapps that might run in a VPN or intranet with no external access, 2) use Google’s, not jQuery’s or others unless it’s all there is (Google is more reliable, faster, and more likely to be in someone’s cache already), and 3) schemeless URIs are a best practice; so I say. :P

Re^2: Include Bootstrap Files in Perl Script?
by glennpm (Novice) on May 10, 2016 at 20:27 UTC
    Thanks Much NetWallah,

    Forgive me for this but is the code you showed in your example in perl? I'm a programmer but mostly on .NET client side and don't understand perl much at all.

    Would it be possible to show me complete .PL perl script showing the Bootstrap includes with the a simple button using the Bootstrap class in a form like below that I could run on my server to get a feel for perl using Bootstrap...

    <form> <input class="btn btn-default" type="submit" value="Order Product" nam +e="submit"> </form>

    I would greatly appreciate it. Thanks, Glenn

      You don't need to do anything special in Perl to include these files. Somewhere in your script it outputs HTML - it may also generate that HTML itself or read it in from an external file or template. What you need to do is find that place in your script and then insert the lines as shown by NetWallah into the output HTML. It could just be copy and paste - no Perl required.

      Hi Glenn,

      Your question is pretty vague. Think about how you would form the question using C# or whichever .NET language you're used to. A better question would be, I have an old Perl script that uses that I need to update to add the following to the output but here is the (sanitized version) script I need to update simplified:

      Your code would go here.  Preferably it would be code that would execute but code snippets can also be used

      Perl is the uber-tool of doing just about anything. There are many many ways of doing something. How to add those css and javascript to your code will depend on what your code looks like, what modules, if any, are being used and whether it uses a template system.

      While we would love to help you, you have to help us help you :)

      Jason L. Froebe

      Tech Blog

        Thanks Jason,

        I've looked at the shopping cart screens on an iPhone and don't look too bad in term of a "shopping experience" but the <form> buttons are really small and you can't read the text in the buttons.

        These 2 perl scripts were written by a perl expert in 1997 and is basically a complete shopping cart I need to continue to use for various reasons. Even though I'm very technical, the code is "all over the place" and messy. Even the guy who wrote it confirms this.

        The first script is the first part of the shopping cart and the second one is the secure script that is on a SSL layer.

        Should I post the whole scripts in this forum you think in order to seek advice from the perl guru's here? They are both very long 13K-14K lines in 2 .PL files.

        Thanks, Glenn
      The only "perl" in the code I posted is the "print" statement - the remaining 99% is HTML, and shows how you can incorporate external CDN references to the jquery, bootstrap and tablesorter components.

      It would not be practical to post the 5k line complete script from whence that snippet came.
      Even if I did, it would raise a lot more questions than it answers - it is a hairy mess mixing up HTML, javascript and perl.
      Today, I would not write a mess like that. So I certainly would not want it used as a sample to generate more such monstrosities.

      To get familiar with Bootstrap, you need to work with plain HTML, javascript, jquery and bootstrap.

      Only after you get your head around these, should you approach building your own monstrosity, or messing with someone elses.

      I suggest you follow the advice posted belo this comment, and seek external assistance in getting your project into this decade.

      Good luck.

              This is not an optical illusion, it just looks like one.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1162650]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-08-17 05:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found